#include <BesTofDigitizer.hh>
Public Member Functions | |
BesTofDigitizer (G4String modName) | |
~BesTofDigitizer () | |
void | GroupHits () |
void | GroupHits_mrpc () |
virtual void | Digitize () |
Private Attributes | |
BesTofDigitizerBrV1 * | tofDMBr1 |
BesTofDigitizerEcV1 * | tofDMEc1 |
BesTofDigitizerBrV2 * | tofDMBr2 |
BesTofDigitizerEcV2 * | tofDMEc2 |
BesTofDigitizerEcV3 * | tofDMEc3 |
BesTofDigitizerEcV4 * | tofDMEc4 |
BesTofDigitsCollection * | m_besTofDigitsCollection |
BesTofHitsCollection * | m_THC |
vector< ScintSingle * > * | m_scintGroup |
G4int | m_versionBr |
G4int | m_versionEc |
RealizationSvc * | m_RealizationSvc |
Definition at line 31 of file BesTofDigitizer.hh.
BesTofDigitizer::BesTofDigitizer | ( | G4String | modName | ) |
Definition at line 25 of file BesTofDigitizer.cc.
References ReadBoostRoot::GetTof(), m_besTofDigitsCollection, m_RealizationSvc, m_versionBr, m_versionEc, tofDMBr1, tofDMBr2, tofDMEc1, tofDMEc2, tofDMEc3, and tofDMEc4.
00025 :G4VDigitizerModule(modName) { 00026 00027 collectionName.push_back("BesTofDigitsCollection"); 00028 m_besTofDigitsCollection=0; 00029 //m_digiMessenger = new BesTofDigitizerMessenger(this); 00030 00031 tofDMBr1 = new BesTofDigitizerBrV1(); 00032 tofDMEc1 = new BesTofDigitizerEcV1(); 00033 tofDMBr2 = new BesTofDigitizerBrV2(); 00034 tofDMEc2 = new BesTofDigitizerEcV2(); 00035 tofDMEc3 = new BesTofDigitizerEcV3(); // Scintillator 00036 tofDMEc4 = new BesTofDigitizerEcV4(); // MRPC Double End 00037 00038 //retrieve G4Svc 00039 /*ISvcLocator* svcLocator = Gaudi::svcLocator(); 00040 IG4Svc* tmpSvc; 00041 StatusCode sc=svcLocator->service("G4Svc", tmpSvc); 00042 G4Svc* g4Svc=dynamic_cast<G4Svc *>(tmpSvc);*/ 00043 00044 //retrieve RealizationSvc 00045 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00046 IRealizationSvc *tmpReal; 00047 StatusCode scReal = svcLocator->service("RealizationSvc",tmpReal); 00048 if (!scReal.isSuccess()) { 00049 std::cout << " Could not initialize Realization Service in BesTofDigitizerBrV2" << std::endl; 00050 } 00051 else { 00052 m_RealizationSvc = dynamic_cast<RealizationSvc*>(tmpReal); 00053 } 00054 00055 m_versionBr=2; 00056 00057 if( ReadBoostRoot::GetTof()==3 || ReadBoostRoot::GetTof()==4 ) { 00058 m_versionEc=4; 00059 std::cout << std::endl << "TofSim: BesTofDigitizer You are using the new End Cap Tof (MRPC) Digitizer!" << std::endl; 00060 } 00061 else { 00062 m_versionEc=3; 00063 std::cout << std::endl << "TofSim: BesTofDigitizer You are using the old End Cap Tof (Scintillator) Digitizer!" << std::endl; 00064 } 00065 00066 }
BesTofDigitizer::~BesTofDigitizer | ( | ) |
Definition at line 69 of file BesTofDigitizer.cc.
References tofDMBr1, tofDMBr2, tofDMEc1, tofDMEc2, tofDMEc3, and tofDMEc4.
00069 { 00070 //delete m_digiMessenger; 00071 delete tofDMBr1; 00072 delete tofDMEc1; 00073 delete tofDMBr2; 00074 delete tofDMEc2; 00075 delete tofDMEc3; 00076 delete tofDMEc4; 00077 }
void BesTofDigitizer::Digitize | ( | ) | [virtual] |
Definition at line 80 of file BesTofDigitizer.cc.
References BesTofDigitizerEcV4::Digitize(), BesTofDigitizerEcV3::Digitize(), BesTofDigitizerEcV2::Digitize(), BesTofDigitizerEcV1::Digitize(), BesTofDigitizerBrV2::Digitize(), BesTofDigitizerBrV1::Digitize(), ScintSingle::GetPartId(), GroupHits(), genRecEmupikp::i, m_besTofDigitsCollection, m_scintGroup, m_THC, m_versionBr, m_versionEc, delete_small_size::size, tofDMBr1, tofDMBr2, tofDMEc1, tofDMEc2, tofDMEc3, and tofDMEc4.
00080 { 00081 00082 m_besTofDigitsCollection = new BesTofDigitsCollection( moduleName, collectionName[0] ); 00083 G4DigiManager* digiManager = G4DigiManager::GetDMpointer(); 00084 G4int THCID = digiManager->GetHitsCollectionID("BesTofHitsCollection"); 00085 m_THC = (BesTofHitsCollection*) (digiManager->GetHitsCollection(THCID)); 00086 00087 if( m_THC ) { 00088 m_scintGroup = new vector<ScintSingle*>; //ScintSingle contains: partId, scintnb, edep <--only the basics 00089 GroupHits(); //If one finds more hits in one scintillator, they are grouped together 00090 G4int size = m_scintGroup->size(); 00091 00092 // std::cout << "TofSim: BesTofDigitizer m_scintGroup->size(): " << size << std::endl; 00093 00094 ScintSingle* scint; 00095 G4int partId; 00096 for( G4int i=0; i<size; i++ ) { 00097 scint = (*m_scintGroup)[i]; 00098 partId = scint->GetPartId(); 00099 00100 // std::cout << "TofSim: BesTofDigitizer scint->GetPartId(): " << partId << std::endl; 00101 00102 if( partId==1 ) { // for barrel part 00103 if( m_versionBr==1 ) 00104 tofDMBr1->Digitize(scint,m_besTofDigitsCollection); 00105 else if( m_versionBr==2 ) { 00106 //std::cout << "TofSim: tofDMBr2->Digitize" << std::endl; 00107 tofDMBr2->Digitize(scint,m_besTofDigitsCollection); 00108 } 00109 else { 00110 tofDMBr2->Digitize(scint,m_besTofDigitsCollection); 00111 } 00112 } 00113 else { // for endcap part 00114 if( m_versionEc==1 ) { 00115 tofDMEc1->Digitize(scint,m_besTofDigitsCollection); 00116 } 00117 else if( m_versionEc==2 ) { 00118 tofDMEc2->Digitize(scint,m_besTofDigitsCollection); 00119 } 00120 else if( m_versionEc==3 ) { 00121 tofDMEc3->Digitize(scint,m_besTofDigitsCollection); 00122 } 00123 else if( m_versionEc==4 ) { 00124 tofDMEc4->Digitize(scint,m_besTofDigitsCollection); 00125 } 00126 else { 00127 cout << "TofSim: Warning: BesTofDigitizerEcV2 is utilized otherwise!" << endl; 00128 tofDMEc2->Digitize(scint,m_besTofDigitsCollection); 00129 } 00130 } // Close endcap part 00131 } 00132 00133 if( m_scintGroup ) { 00134 for( size_t i=0; i<m_scintGroup->size(); i++ ) { 00135 delete (*m_scintGroup)[i]; 00136 //std::cout << "TofSim: i: " << i << std::endl; 00137 //std::cout << "TofSim: delete m_scintGroup[i] successfully " << std::endl; 00138 } 00139 m_scintGroup->clear(); 00140 delete m_scintGroup; 00141 } 00142 } //close if(m_THC) 00143 00144 StoreDigiCollection(m_besTofDigitsCollection); 00145 }
void BesTofDigitizer::GroupHits | ( | ) |
Definition at line 148 of file BesTofDigitizer.cc.
References ScintSingle::AddEdep(), BesTofHit::GetEdep(), ScintSingle::GetHitIndexes(), ScintSingle::GetPartId(), BesTofHit::GetPartId(), RealizationSvc::getRunId(), ScintSingle::GetScinNb(), BesTofHit::GetScinNb(), BesTofHit::GetTrackIndex(), genRecEmupikp::i, iter(), ganga-rec::j, m_RealizationSvc, m_scintGroup, m_THC, ScintSingle::SetEdep(), ScintSingle::SetPartId(), ScintSingle::SetScinNb(), and delete_small_size::size.
Referenced by Digitize().
00148 { 00149 00150 G4int partId, scinNb,size,flag,trackId; 00151 G4double edep; 00152 BesTofHit* hit; 00153 G4int nHits = m_THC->entries(); 00154 00155 // sunss 20140508 add to suppress the efficiency of TOF signal 00156 vector<G4int> deadTrackVec; 00157 deadTrackVec.clear(); 00158 G4int runId = m_RealizationSvc->getRunId(); 00159 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-80000 && runId<=-23463 ) ) { 00160 G4int previousTrack = -999; 00161 vector<G4int> trackVec; 00162 trackVec.clear(); 00163 for( G4int i=0; i<nHits; i++ ) { 00164 hit = (*m_THC)[i]; 00165 trackId = hit->GetTrackIndex(); 00166 if( trackId != previousTrack ) { 00167 previousTrack = trackId; 00168 bool same = false; 00169 vector<G4int>::iterator iter = trackVec.begin(); 00170 for( ; iter!=trackVec.end(); iter++ ) { 00171 if( (*iter) == trackId ) { 00172 same = true; 00173 break; 00174 } 00175 } 00176 if( !same ) { 00177 trackVec.push_back( trackId ); 00178 G4double ranSignal = G4UniformRand(); 00179 if( ranSignal>0.988 ) { // hhliu 20140613 00180 deadTrackVec.push_back( trackId ); 00181 } 00182 } 00183 } 00184 } 00185 } 00186 // sunss 20140508 00187 00188 //group the hits which are in the same scintillator 00189 for (G4int i=0;i<nHits;i++) { 00190 hit=(*m_THC)[i]; 00191 // sunss 20140508 00192 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-80000 && runId<=-23463 ) ) { 00193 trackId = hit->GetTrackIndex(); 00194 partId = hit->GetPartId(); 00195 bool aband = false; 00196 vector<G4int>::iterator iter = deadTrackVec.begin(); 00197 for( ; iter!=deadTrackVec.end(); iter++ ) { 00198 if( ( trackId == (*iter) ) && ( partId!=3 && partId!=4 ) ) { aband = true; } 00199 } 00200 if( aband ) continue; 00201 } 00202 // sunss 20140508 00203 partId = hit->GetPartId(); 00204 scinNb = hit->GetScinNb(); 00205 edep = hit->GetEdep(); 00206 size = m_scintGroup->size(); 00207 flag = 0; 00208 if( size>0 ) { 00209 ScintSingle* oldScint; 00210 for( G4int j=0; j<size; j++ ) { 00211 oldScint = (*m_scintGroup)[j]; 00212 if( oldScint->GetPartId()==partId && oldScint->GetScinNb()==scinNb ) { 00213 //std::cout << "BesTodDigitizer: GroupHits: 'Oldhit:' partID | scinnb : " << partId << " | " << scinNb << std::endl; 00214 oldScint->GetHitIndexes()->push_back(i); 00215 // ATTENTION!!! sum over all deposited energy! 00216 oldScint->AddEdep(edep); 00217 flag=1; 00218 break; 00219 } 00220 } 00221 } 00222 00223 if( flag==0 ) { 00224 ScintSingle* newScint = new ScintSingle; 00225 newScint->SetPartId(partId); 00226 newScint->SetScinNb(scinNb); 00227 newScint->SetEdep(edep); 00228 newScint->GetHitIndexes()->push_back(i); 00229 m_scintGroup->push_back(newScint); 00230 00231 // std::cout << "BesTofDigitizer: GroupHits: NewHitGroup: " << partId << " " << scinNb << std::endl; 00232 } 00233 } 00234 00235 }
void BesTofDigitizer::GroupHits_mrpc | ( | ) |
RealizationSvc* BesTofDigitizer::m_RealizationSvc [private] |
vector<ScintSingle*>* BesTofDigitizer::m_scintGroup [private] |
BesTofHitsCollection* BesTofDigitizer::m_THC [private] |
G4int BesTofDigitizer::m_versionBr [private] |
G4int BesTofDigitizer::m_versionEc [private] |
BesTofDigitizerBrV1* BesTofDigitizer::tofDMBr1 [private] |
Definition at line 46 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().
BesTofDigitizerBrV2* BesTofDigitizer::tofDMBr2 [private] |
Definition at line 48 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().
BesTofDigitizerEcV1* BesTofDigitizer::tofDMEc1 [private] |
Definition at line 47 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().
BesTofDigitizerEcV2* BesTofDigitizer::tofDMEc2 [private] |
Definition at line 49 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().
BesTofDigitizerEcV3* BesTofDigitizer::tofDMEc3 [private] |
Definition at line 50 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().
BesTofDigitizerEcV4* BesTofDigitizer::tofDMEc4 [private] |
Definition at line 51 of file BesTofDigitizer.hh.
Referenced by BesTofDigitizer(), Digitize(), and ~BesTofDigitizer().