00001 //---------------------------------------------------------------------------// 00002 // BOOST --- BESIII Object_Oreiented Simulation Tool // 00003 //---------------------------------------------------------------------------// 00004 //Descpirtion: EMC detector 00005 //Author: Hemiao 00006 //Created: Sep, 2004 00007 //Comment: 00008 //---------------------------------------------------------------------------// 00009 // $Id:BesEmcDigitizer.hh 00010 00011 #ifndef BesEmcDigitizer_h 00012 #define BesEmcDigitizer_h 1 00013 00014 #include "G4VDigitizerModule.hh" 00015 #include "BesEmcDigi.hh" 00016 #include "BesEmcHit.hh" 00017 #include "globals.hh" 00018 #include <vector> 00019 #include "GaudiKernel/NTuple.h" 00020 using namespace std; 00021 00022 class BesEmcHit; 00023 class G4Svc; 00024 class IEmcCalibConstSvc; 00025 00026 class CrystalSingle 00027 { 00028 friend class BesEmcDigitizer; 00029 00030 public: 00031 00032 CrystalSingle() 00033 { 00034 hitIndexes = new vector<G4int>; 00035 } 00036 CrystalSingle(const CrystalSingle& right) 00037 { 00038 partId = right.partId; 00039 nTheta = right.nTheta; 00040 nPhi = right.nPhi; 00041 edep = right.edep; 00042 hitIndexes =right.hitIndexes; 00043 } 00044 const CrystalSingle& operator=(const CrystalSingle& right) 00045 { 00046 partId = right.partId; 00047 nTheta = right.nTheta; 00048 nPhi = right.nPhi; 00049 edep = right.edep; 00050 hitIndexes =right.hitIndexes; 00051 return *this; 00052 } 00053 ~CrystalSingle() 00054 { 00055 delete hitIndexes; 00056 } 00057 00058 G4int GetPartId() {return partId;} 00059 G4int GetNTheta() {return nTheta;} 00060 G4int GetNPhi() {return nPhi;} 00061 G4double GetEdep() {return edep;} 00062 vector<G4int>* GetHitIndexes() {return hitIndexes;} 00063 00064 void SetPartId(G4int id) {partId = id;} 00065 void SetNTheta(G4int theta) {nTheta = theta;} 00066 void SetNPhi(G4int phi) {nPhi = phi;} 00067 void SetEdep(G4double e) {edep = e;} 00068 void AddEdep(G4double e) {edep += e;} 00069 00070 private: 00071 00072 G4int partId; 00073 G4int nTheta; 00074 G4int nPhi; 00075 G4double edep; 00076 vector<G4int>* hitIndexes; 00077 }; 00078 00079 class BesEmcDigitizer : public G4VDigitizerModule 00080 { 00081 public: 00082 BesEmcDigitizer(G4String modName); 00083 ~BesEmcDigitizer(); 00084 00085 public: 00086 virtual void Digitize(); 00087 virtual void GroupHits(BesEmcHitsCollection*); 00088 // Add noise to 5x5 matrix around the seed 00089 virtual void AddNoise5x5(G4double coherentNoise); 00090 // Add noise to all crystals 00091 virtual void AddNoiseAll(G4double coherentNoise); 00092 00093 private: //memory size needed optimizing 00094 void Initialize(); 00095 // void Smear(); 00096 00097 private: 00098 BesEmcDigitsCollection* m_besEmcDigitsCollection; 00099 vector<CrystalSingle*>* m_crystalGroup; 00100 G4double m_energy; 00101 00102 private: 00103 G4Svc* m_G4Svc; 00104 IEmcCalibConstSvc *m_emcCalibConstSvc; 00105 NTuple::Tuple* m_tupleEmc1; //digi level 00106 NTuple::Item<long> m_partId; 00107 NTuple::Item<long> m_nTheta; 00108 NTuple::Item<long> m_nPhi; 00109 NTuple::Item<double> m_eDep; 00110 NTuple::Item<long> m_nHits; 00111 NTuple::Item<double> m_adc; 00112 NTuple::Item<long> m_tdc; 00113 00114 NTuple::Tuple* m_tupleEmc2; //event level 00115 NTuple::Item<double> m_eTot; 00116 NTuple::Item<long> m_nDigi; 00117 00118 }; 00119 #endif