Back to index

PadRecModule.cc

 
//-------------------------------------------------------- 
// 
// Class: PadRecModule (implementation) 
// 
// Created by: Paul B Nilsson 
// 
// Description: PC Cluster Reconstruction 
// 
// Details: This is the Pad Chamber cluster reconstruction 
//          module class that contains the interface to 
//          the cluster reconstruction algorithm 
//-------------------------------------------------------- 
 
#include "PadRecModule.hh" 
#include "PadRec.hh" 
#include <iostream> 
#include <list> 
 
 
//******************************************************** 
// Name:       event 
// 
// Definition: 'main' function of the class called from phool 
//  
// History:    04/26/00 Original by P. Nilsson 
//             08/14/01 PISA-to-DST modification 
//******************************************************** 
 
PHBoolean PadRecModule::event(short pc, PHpadDetectorGeo* refGeo, PHCompositeNode* topNode) 
{ 
  PHBoolean state = True; 
 
  // check on PISA-to-DST mode 
  if (pc < 0) 
    { 
      pc = -pc; 
      pisaToDSTMod = 1; 
      if (pisaToDSTPrintMod) 
	{ 
	  pisaToDSTPrintMod = 0; 
	  cout << "\n\n   PadRecModule in PISA-to-DST mode for PC" << pc+1 << "\n" << endl; 
	} 
    } 
 
#ifdef DEBUG 
  cout << "Pad Chamber Cluster Reconstruction by P. Nilsson" << endl; 
  cout << "------------------------------------------------" << endl; 
  cout << "Running reconstruction on PC" << pc+1 << "..." << endl; 
#endif 
 
  // Create main pad cluster reconstruction object 
  PadRec *padRecObj = 0; 
  if (!pisaToDSTMod) 
    padRecObj = new PadRec(pc,topNode);     
  else 
    padRecObj = new PadRec(-pc,topNode); 
 
  short parList[14]; 
  parList[0] = eventNumber; 
  parList[1] = debug; 
  parList[2] = splitMax; 
  parList[3] = mode; 
  parList[4] = padTypeLimit; 
  parList[5] = oneW; 
  parList[6] = oneZ; 
  parList[7] = oneL; 
  parList[8] = twoW; 
  parList[9] = twoZ; 
  parList[10] = twoL; 
  parList[11] = threeW; 
  parList[12] = threeZ; 
  parList[13] = threeL; 
  padRecObj->setParameters(&parList[0]); 
 
  // Fetch the cells for all sectors 
  if ( !(padRecObj->getCells()) ) 
    { 
      // Create cluster lists 
      list<Cell> cluster; 
      for (short sector = 0; sector < numberOfSectors[pc]; sector++) 
	{ 
	  // Set up a new sector 
	  padRecObj->setSector(sector, refGeo); 
 
	  while (padRecObj->getNumberOfCells() > 0) 
	    { 
	      // Get one cluster at the time from the main cell list 
	      cluster = padRecObj->getCluster(); 
 
	      // Create a fake cluster (for testing purposes - run on only one sector) 
	      // cluster = padRecObj->fakeCluster(); 
 
	      // Process the cluster. If necessary, split it into subclusters, 
	      // calculate and store the hit positions. 
	      padRecObj->processCluster(cluster, refGeo); 
 
	      // Uncomment next line if fakeCluster is used 
	      // break; 
	    } 
	  // Delete the main cell list for the current sector 
	  padRecObj->clear(); 
	} 
    } 
  else 
    state = False; 
 
  // Dump some statistics 
  if (state && (debug == 2)) padRecObj->showStat(); 
 
  delete padRecObj; 
  padRecObj = 0; 
 
  return state; 
 
} // End method PadRecModule::event 
 
 
//******************************************************** 
// Name:       setClusterSize 
// 
// Definition: Limits of cluster sizes. These variables set 
//             the sizes of the cluster boxes. 
// 
// History:    06/29/00 Original by P. Nilsson 
//             05/01/01 Only the one* and two* are used from now on 
//******************************************************** 
 
void PadRecModule::setClusterSizes(short onePW, short onePZ, short onePL, short twoPW, short twoPZ, short twoPL, short threePW, short threePZ, short threePL) 
{ 
#ifdef DEBUG  
  cout << "PadRecModule::setClusterSize called" << endl; 
#endif 
 
  oneW = onePW; // Box height 
  oneZ = onePZ; // Box width 
  oneL = onePL; // Maximum number of allowed cells within a one particle box 
 
  twoW = twoPW; 
  twoZ = twoPZ; 
  twoL = twoPL; 
 
  threeW = threePW; 
  threeZ = threePZ; 
  threeL = threePL; 
} 

Back to index