Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

LCDG4CalSD.hh

Go to the documentation of this file.
00001 #ifndef LCDG4CalSD_h
00002 #define LCDG4CalSD_h 1
00003 
00004 #include "LCDG4CalHit.hh"
00005 #include "G4VSensitiveDetector.hh"
00006 #include "G4LogicalVolume.hh"
00007 #include <map>
00008 
00009 class G4Step;
00010 class G4HCofThisEvent;
00011 class G4TouchableHistory;
00012 
00013 /* SensitiveDetector base class for calorimeter-like subdetectors */
00014 // Some derived classes are LCDG4CalSDProj and LCDG4CalSDNonProj
00015 class LCDG4CalSD : public G4VSensitiveDetector {
00016 
00017 public:
00018   // constructor
00019   LCDG4CalSD(G4String name);
00020   // destructor
00021   ~LCDG4CalSD();
00022 
00023   // For each geant4 step, find which Cal cell was hit.
00024   // If that cell is not hit yet, create it.
00025   // Otherwise, just add up the deposited energy into that cell
00026   G4bool ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist);
00027 
00028   // Begin of event processing
00029   void Initialize(G4HCofThisEvent* HCE);
00030 
00031   // end of event processing
00032   void EndOfEvent(G4HCofThisEvent* HCE);
00033 
00034   //*** Pure virtual methods
00035   // find calorimeter cell from a given position
00036   virtual unsigned int findCell(const G4ThreeVector& position) = 0;
00037   // get cell center
00038   virtual G4ThreeVector getCellCenter(unsigned int cellIndex) = 0;
00039   // get cell indices which depend on virtual cells
00040   virtual unsigned int getIndex1(unsigned int cellIndex) const = 0;
00041   virtual unsigned int getIndex2(unsigned int cellIndex) const = 0;
00042   virtual unsigned int getIndex3(unsigned int cellIndex) const = 0;
00043 
00044   // some convenience methods
00045   void clear();
00046   void DrawAll();
00047   void PrintAll();
00048 
00049 public:
00050   G4int AddLogVolInfo(G4LogicalVolume* g4vxdlog, G4int startlayerNo,
00051                       G4int sysNo, G4int be, G4int ns, G4int fsens);
00052 
00053   // These are needed to calculate cell centers in projective geometry
00054   void SetLayerZeroCenterDepth(G4double cd) { layer0CenterDepth = cd; }
00055   void SetLayerThickness(G4double t) { layerThickness = t; }
00056 
00057 protected:
00058   // hit collection ID associated to this sensitive detector
00059   G4int HCID;
00060   // pointer to calorimeter hits collection
00061   LCDG4CalHitsCollection* _hitCollection;
00062   // Cal layer map
00063   std::map<G4LogicalVolume*,G4int> _maplayer;
00064   // Cal sysNo map
00065   std::map<G4LogicalVolume*,G4int> _mapsys;
00066   // Cal barrel/endcap map
00067   std::map<G4LogicalVolume*,G4int> _mapbe;
00068   // Cal n/s map: -1,0,1 for north endcap, barrel, south endcap
00069   std::map<G4LogicalVolume*,G4int> _mapns;
00070   // Cal sensitive/absorber map
00071   std::map<G4LogicalVolume*,G4int> _mapsens;
00072 
00073   // Calorimeter hit collections handled by this SD
00074   std::map<G4int,LCDG4CalHit*> _cellhit;
00075 
00076   // These are needed to calculate radius for centers of sensitive layers
00077   // This is only used by projective SD...
00078   G4double layer0CenterDepth;
00079   G4double layerThickness;
00080   G4int north, barend;
00081 
00082   // debug flag
00083   int debugLevel;
00084   // convenience info: cell indices
00085   // index[0] is system number (2=LUM, 10=EM, 12=HAD, 7=MU)
00086   // index[1] is ilayer
00087   // index[2] is iphi
00088   // index[3] is itheta (proj) or iz (nonproj)
00089   unsigned int index[4];
00090 };
00091 
00092 #endif

Generated on Thu Oct 7 18:44:46 2004 for LCDG4 by doxygen 1.3.4