Back to index

See source file

PadRec.hh

 
//-------------------------------------------------------- 
// 
// Class: PadRec (definition) 
// 
// Created by: Paul B Nilsson 
// 
// Description: PC Cluster Reconstruction 
// 
// Details: This is the Pad Chamber cluster class that 
//          contains the cluster reconstruction algorithm 
// 
//-------------------------------------------------------- 
 
#ifndef __PADREC_HH__ 
#define __PADREC_HH__ 
 
#include <list> 
#include <string.h> 
#include <math.h> 
#include <fstream> 
#include "phool.h" 
#include "PHCompositeNode.h" 
#include "PHNodeIterator.h"  
#include "PHIODataNode.h"  
#include "PHNode.h" 
#include "PHTable.hh" 
#include "PHPanel.h" 
#include "PHPoint.h" 
#include "PHGeometron.h" 
#include "PHpadDetectorGeo.hh" 
#include "dPadRawWrapper.h" 
#include "dPadRawClusWrapper.h" 
#include "dPadClusterWrapper.h" 
#include "PadRecCell.hh" 
 
// Patch for PISA-to-DST use, as of July 30 change in PadRec.cc 
static int pisaToDSTMod = 0;      // PISA-to-DST flag for Module 
static int pisaToDSTPrintMod = 1; // information message 
static int pisaToDSTRec = 0;      // PISA-to-DST flag for Rec 
static int pisaToDSTPrintRec = 1; // information message 
 
// Cell type 
typedef PadRecCell Cell; 
 
// STL cell list iterator 
typedef list<Cell>::iterator CI; 
 
// Phool table node 
typedef PHIODataNode<PHTable> TableNode_t; 
 
// Definitions 
static const short numberOfPads = 2160; 
static const short numberOfSectors[3] = { 16, 8, 8 }; 
static const short numberOfPadWires[3] = { 20, 40, 40 }; 
static const short wireAdjust[3] = { 0, -1, 1 }; 
static const short cellsAlongWire = 106; 
static const short padsAlongWire = 108; 
static const short cellsAcrossWire[3] = { 58, 116, 116 }; 
 
class PadRec { 
 
 public: 
 
  PadRec(short, PHCompositeNode *); // Default Constructor 
  PadRec(const PadRec &) { };       // Copy Constructor 
  ~PadRec(void);                    // Destructor 
 
  // Set and get methods 
  void setParameters(short *); 
  void setSector(short, PHpadDetectorGeo *); 
  inline void setPadChamber(short pc) { currentPc = pc; } 
  inline void setArm(short arm) { currentArm = arm; } 
  inline void setSide(short cz) { currentSide = (cz < cellsAlongWire) ? 0 : 1; } 
  inline short getNumberOfCells(void) { return (cells[currentSector].size()); }; 
  inline short getNumberOfCells(list<Cell>& li) { return (li.size()); }; 
 
  // Main reconstruction algorithm methods 
  list<Cell> getCluster(void);             // Find a cluster in a hitlist 
  list<Cell> fakeCluster(void);            // Create a fake cluster (for debugging) 
  short getCells(void);                    // Convert pads to cells 
  short getNumberOfParticles(list<Cell>&); // Estimation of #particles in a cluster 
  void dumpCells(list<Cell>&);             // Dump the list (for debugging) 
  void showStat(void) const;               // Dump some statistics 
  inline void clear(void)                  // Erase and delete the main cell list 
    { cells[currentSector].clear(); }; 
  void processCluster(list<Cell>&, PHpadDetectorGeo *); // Process a cluster 
  void setPosition(list<Cell>&, PHpadDetectorGeo *);    // Determine hit position 
 
 private: 
 
  // Pointers to the phool tables 
  dPadRawWrapper     *dPcXRaw; 
  dPadRawClusWrapper *dPcXRawClus; 
  dPadClusterWrapper *dPcXCluster; 
  TableNode_t *dPcXRawNode; 
  TableNode_t *dPcXRawClusNode; 
  TableNode_t *dPcXClusterNode; 
 
  list<Cell> cells[16];                   // Main cell lists for all sectors 
  short debug;                            // Global debug flag 
  short mode;                             // Cluster split flag 
  short currentPc;                        // 0,1,2 for PC1,2,3 
  short currentArm;                       // 1 for West, 0 for East 
  short currentSector;                    // 0-15 for PC1, 0-7 for PC2/3 
  short currentSectorReduced;             // 0-7 for PC1, 0-3 for PC2/3 
  short currentSide;                      // 0 for South, 1 for North 
  short padTypeLimit;                     // Require at least x number of normal 
                                          // pads in a cell 
  short kPads[2][16][numberOfPads*2];     // Pad vectors 
  short kPadTypes[2][16][numberOfPads*2]; // Pad type vectors 
  short kPadID[16][40][padsAlongWire];    // Pad id's for the relational table 
  short oneW, oneZ, oneL, twoW, twoZ, twoL, threeW, threeZ, threeL; 
  short numberOfCells[16], numberOfClusters[16]; 
  short eventNumber; 
  unsigned short splitMax; 
 
  // Output file with hit information 
  ofstream outfile; 
 
  short init(short, PHCompositeNode *);         // Initialize 
  short getPads(void);                          // Get the pads from the dPadRaw table 
  short getkPadID(list<Cell>&, double, double); // Get simulation pixel id 
  inline short near(double a) const             // Round off method 
    { return ((short) (ceil( (a + 0.500000000000001) ) - 1.0)); }; 
 
  // Logical database variable. True if geometry is read from database 
  // and False if geometry is read from the padGeometry.txt ascii file 
  PHBoolean fromDatabase; 
 
  // The pcPanel objects correspond to real pad chamber volumes in the global frame 
  // and are used here to build the sector frames 
  PHPanel pcPanel[PC1MAXSECTPERARM]; 
 
  // Pointer to the geometron object (to be used for coordinate transformations) 
  //PHGeometron* geometron; 
 
  // Clusters dimensions 
  void getDimensions(list<Cell>&, short&, short&, short&, short&) const; 
  inline short sideLength(float length, float nparts) const 
    { return ( (short)ceil( (length/nparts - 0.000001) ) ); }; 
 
  // Checks if two cells are neighbours. 
  // - Do not allow diagonals: (default setting) 
  // inline short isNeighbor(short dw, short dz) const 
  //   { return ((((dw <= 1) && (dz <= 1)) && !((dw == 1) && (dz == 1))) ? 1 : 0); } 
  // - Allow diagonals: (we will try this for a while) 
  inline short isNeighbor(short dw, short dz) const 
    { return ( ((dw <= 1) && (dz <= 1)) ? 1 : 0); } 
 
  // Pads-to-cell conversion methods (From D. Silvermyr) 
  inline short padWire(short z, short w) const 
    { return (wireAdjust[(z + 999)%3] + ((w - wireAdjust[(z + 999)%3] + 1)/3)*3); }; 
  inline short padWireToPadx(short z, short w) const 
    { return ((w - wireAdjust[(z + 999)%3])/3); }; 
}; 
 
#endif 

Back to index

See source file