#include <BesTofDigitizer.hh>
Public Member Functions | |
BesTofDigitizer (G4String modName) | |
BesTofDigitizer (G4String modName) | |
virtual void | Digitize () |
virtual void | Digitize () |
void | GroupHits () |
void | GroupHits () |
~BesTofDigitizer () | |
~BesTofDigitizer () | |
Private Attributes | |
BesTofDigitsCollection * | m_besTofDigitsCollection |
BesTofDigitsCollection * | m_besTofDigitsCollection |
vector< ScintSingle * > * | m_scintGroup |
vector< ScintSingle * > * | m_scintGroup |
BesTofHitsCollection * | m_THC |
BesTofHitsCollection * | m_THC |
G4int | m_versionBr |
G4int | m_versionEc |
BesTofDigitizerBrV1 * | tofDMBr1 |
BesTofDigitizerBrV1 * | tofDMBr1 |
BesTofDigitizerBrV2 * | tofDMBr2 |
BesTofDigitizerBrV2 * | tofDMBr2 |
BesTofDigitizerEcV1 * | tofDMEc1 |
BesTofDigitizerEcV1 * | tofDMEc1 |
BesTofDigitizerEcV2 * | tofDMEc2 |
BesTofDigitizerEcV2 * | tofDMEc2 |
BesTofDigitizerEcV3 * | tofDMEc3 |
BesTofDigitizerEcV3 * | tofDMEc3 |
|
00029 :G4VDigitizerModule(modName) 00030 { 00031 collectionName.push_back("BesTofDigitsCollection"); 00032 m_besTofDigitsCollection=0; 00033 //m_digiMessenger = new BesTofDigitizerMessenger(this); 00034 00035 tofDMBr1 = new BesTofDigitizerBrV1(); 00036 tofDMEc1 = new BesTofDigitizerEcV1(); 00037 tofDMBr2 = new BesTofDigitizerBrV2(); 00038 tofDMEc2 = new BesTofDigitizerEcV2(); 00039 tofDMEc3 = new BesTofDigitizerEcV3(); 00040 00041 //retrieve G4Svc 00042 /*ISvcLocator* svcLocator = Gaudi::svcLocator(); 00043 IG4Svc* tmpSvc; 00044 StatusCode sc=svcLocator->service("G4Svc", tmpSvc); 00045 G4Svc* g4Svc=dynamic_cast<G4Svc *>(tmpSvc);*/ 00046 m_versionBr=2; 00047 m_versionEc=3; 00048 }
|
|
00051 {
00052 //delete m_digiMessenger;
00053 }
|
|
|
|
|
|
|
|
00056 { 00057 m_besTofDigitsCollection=new BesTofDigitsCollection 00058 (moduleName, collectionName[0]); 00059 G4DigiManager* digiManager = G4DigiManager::GetDMpointer(); 00060 G4int THCID = digiManager->GetHitsCollectionID("BesTofHitsCollection"); 00061 m_THC = (BesTofHitsCollection*) (digiManager->GetHitsCollection(THCID)); 00062 if (m_THC) 00063 { 00064 m_scintGroup = new vector<ScintSingle*>; 00065 GroupHits(); 00066 G4int size=m_scintGroup->size(); 00067 ScintSingle* scint; 00068 G4int partId; 00069 for (G4int i=0;i<size;i++) 00070 { 00071 scint = (*m_scintGroup)[i]; 00072 partId = scint->GetPartId(); 00073 if (partId==1) // for barrel part 00074 { 00075 if (m_versionBr==1) 00076 tofDMBr1->Digitize(scint,m_besTofDigitsCollection); 00077 else if (m_versionBr==2){ 00078 //std::cout << " tofDMBr2->Digitize" << std::endl; 00079 tofDMBr2->Digitize(scint,m_besTofDigitsCollection); 00080 } 00081 else 00082 tofDMBr2->Digitize(scint,m_besTofDigitsCollection); 00083 } 00084 else // for endcap part 00085 { 00086 if (m_versionEc==1) 00087 tofDMEc1->Digitize(scint,m_besTofDigitsCollection); 00088 else if (m_versionEc==2) 00089 tofDMEc2->Digitize(scint,m_besTofDigitsCollection); 00090 else if (m_versionEc==3){ 00091 //std::cout << " tofDMEc3->Digitize" << std::endl; 00092 tofDMEc3->Digitize(scint,m_besTofDigitsCollection); 00093 } 00094 else 00095 { 00096 cout << "Warning: BesTofDigitizerEcV2 is utilized otherwise!" << endl; 00097 tofDMEc2->Digitize(scint,m_besTofDigitsCollection); 00098 } 00099 } 00100 } 00101 if (m_scintGroup) 00102 { 00103 for (size_t i=0;i<m_scintGroup->size();i++) 00104 { 00105 delete (*m_scintGroup)[i]; 00106 //std::cout << "i: " << i << std::endl; 00107 //std::cout << "delete m_scintGroup[i] successfully " << std::endl; 00108 } 00109 m_scintGroup->clear(); 00110 delete m_scintGroup; 00111 } 00112 } 00113 00114 StoreDigiCollection(m_besTofDigitsCollection); 00115 }
|
|
|
|
00118 { 00119 G4int partId, scinNb,size,flag; 00120 G4double edep; 00121 BesTofHit* hit; 00122 G4int nHits = m_THC->entries(); 00123 00124 //group the hits which are in the same scintillator 00125 for (G4int i=0;i<nHits;i++) 00126 { 00127 hit=(*m_THC)[i]; 00128 partId=hit->GetPartId(); 00129 scinNb=hit->GetScinNb(); 00130 edep = hit->GetEdep(); 00131 size=m_scintGroup->size(); 00132 flag=0; 00133 if (size>0) 00134 { 00135 ScintSingle* oldScint; 00136 for (G4int j=0; j<size;j++) 00137 { 00138 oldScint = (*m_scintGroup)[j]; 00139 if (oldScint->GetPartId()==partId &&oldScint->GetScinNb()==scinNb) 00140 { 00141 oldScint->GetHitIndexes()->push_back(i); 00142 oldScint->AddEdep(edep); 00143 flag=1; 00144 break; 00145 } 00146 } 00147 } 00148 if (flag==0) 00149 { 00150 ScintSingle* newScint = new ScintSingle; 00151 newScint->SetPartId(partId); 00152 newScint->SetScinNb(scinNb); 00153 newScint->SetEdep(edep); 00154 newScint->GetHitIndexes()->push_back(i); 00155 m_scintGroup->push_back(newScint); 00156 } 00157 } 00158 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|