12#include "GaudiKernel/ISvcLocator.h"
13#include "GaudiKernel/Bootstrap.h"
14#include "GaudiKernel/IDataProviderSvc.h"
15#include "GaudiKernel/MsgStream.h"
16#include "G4Svc/IG4Svc.h"
17#include "G4Svc/G4Svc.h"
18#include "G4DigiManager.hh"
19#include "ReadBoostRoot.hh"
20#include "ScintSingle.hh"
21#include "Randomize.hh"
22#include "BesTofDigitizer.hh"
27 collectionName.push_back(
"BesTofDigitsCollection");
28 m_besTofDigitsCollection=0;
45 ISvcLocator* svcLocator = Gaudi::svcLocator();
47 StatusCode scReal = svcLocator->service(
"RealizationSvc",tmpReal);
48 if (!scReal.isSuccess()) {
49 std::cout <<
" Could not initialize Realization Service in BesTofDigitizerBrV2" << std::endl;
59 std::cout << std::endl <<
"TofSim: BesTofDigitizer You are using the new End Cap Tof (MRPC) Digitizer!" << std::endl;
63 std::cout << std::endl <<
"TofSim: BesTofDigitizer You are using the old End Cap Tof (Scintillator) Digitizer!" << std::endl;
83 G4DigiManager* digiManager = G4DigiManager::GetDMpointer();
84 G4int THCID = digiManager->GetHitsCollectionID(
"BesTofHitsCollection");
88 m_scintGroup =
new vector<ScintSingle*>;
90 G4int size = m_scintGroup->size();
96 for( G4int i=0; i<size; i++ ) {
97 scint = (*m_scintGroup)[i];
104 tofDMBr1->
Digitize(scint,m_besTofDigitsCollection);
105 else if( m_versionBr==2 ) {
107 tofDMBr2->
Digitize(scint,m_besTofDigitsCollection);
110 tofDMBr2->
Digitize(scint,m_besTofDigitsCollection);
114 if( m_versionEc==1 ) {
115 tofDMEc1->
Digitize(scint,m_besTofDigitsCollection);
117 else if( m_versionEc==2 ) {
118 tofDMEc2->
Digitize(scint,m_besTofDigitsCollection);
120 else if( m_versionEc==3 ) {
121 tofDMEc3->
Digitize(scint,m_besTofDigitsCollection);
123 else if( m_versionEc==4 ) {
124 tofDMEc4->
Digitize(scint,m_besTofDigitsCollection);
127 cout <<
"TofSim: Warning: BesTofDigitizerEcV2 is utilized otherwise!" << endl;
128 tofDMEc2->
Digitize(scint,m_besTofDigitsCollection);
134 for(
size_t i=0; i<m_scintGroup->size(); i++ ) {
135 delete (*m_scintGroup)[i];
139 m_scintGroup->clear();
144 StoreDigiCollection(m_besTofDigitsCollection);
150 G4int partId, scinNb,size,
flag,trackId;
153 G4int nHits = m_THC->entries();
156 vector<G4int> deadTrackVec;
157 deadTrackVec.clear();
158 G4int runId = m_RealizationSvc->
getRunId();
159 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-80000 && runId<=-23463 ) ) {
160 G4int previousTrack = -999;
161 vector<G4int> trackVec;
163 for( G4int i=0; i<nHits; i++ ) {
166 if( trackId != previousTrack ) {
167 previousTrack = trackId;
169 vector<G4int>::iterator
iter = trackVec.begin();
170 for( ;
iter!=trackVec.end();
iter++ ) {
171 if( (*
iter) == trackId ) {
177 trackVec.push_back( trackId );
178 G4double ranSignal = G4UniformRand();
179 if( ranSignal>0.988 ) {
180 deadTrackVec.push_back( trackId );
189 for (G4int i=0;i<nHits;i++) {
192 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-80000 && runId<=-23463 ) ) {
196 vector<G4int>::iterator
iter = deadTrackVec.begin();
197 for( ;
iter!=deadTrackVec.end();
iter++ ) {
198 if( ( trackId == (*
iter) ) && ( partId!=3 && partId!=4 ) ) { aband =
true; }
200 if( aband )
continue;
206 size = m_scintGroup->size();
210 for( G4int j=0; j<size; j++ ) {
211 oldScint = (*m_scintGroup)[j];
229 m_scintGroup->push_back(newScint);
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
G4THitsCollection< BesTofHit > BesTofHitsCollection
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
virtual void Digitize(ScintSingle *, BesTofDigitsCollection *)
BesTofDigitizer(G4String modName)
vector< G4int > * GetHitIndexes()