88 G4double edep = aStep->GetTotalEnergyDeposit();
89 G4double stepl = aStep->GetStepLength();
90 if ((edep==0.)&&(stepl==0.))
return false;
92 G4TouchableHistory* theTouchable
93 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
94 G4VPhysicalVolume* physVol = theTouchable->GetVolume();
96 if(physVol->GetName().contains(
"physicalCrystal"))
99 CryNumberPhi=theTouchable->GetReplicaNumber(2);
100 CryNumberTheta=theTouchable->GetReplicaNumber(1);
102 else if(physVol->GetName().contains(
"logicalCrystal"))
105 std::istringstream thetaBuf((theTouchable->GetVolume(1)->GetName()).substr(16,2));
106 thetaBuf >> CryNumberTheta ;
107 CryNumberPhi = 308-theTouchable->GetCopyNumber(2);
109 else if(physVol->GetName().contains(
"physicalEndCrystal"))
111 PartId=theTouchable->GetReplicaNumber(3);
112 G4int endSector=theTouchable->GetReplicaNumber(2);
113 G4int endNb=theTouchable->GetReplicaNumber(0);
116 else if(physVol->GetName().contains(
"logicalEndCrystal"))
118 PartId=2-2*theTouchable->GetCopyNumber(3);
119 G4int endSector=theTouchable->GetCopyNumber(2);
120 G4int endNb,endNbGDML;
121 std::istringstream thetaBuf((theTouchable->GetVolume(0)->GetName()).substr(20,2));
127 else if(physVol->GetName().contains(
"physicalPD"))
131 CryNumberPhi=theTouchable->GetReplicaNumber(2);
132 CryNumberTheta=theTouchable->GetReplicaNumber(1);
134 else if(physVol->GetName().contains(
"logicalPD"))
138 G4int nb=theTouchable->GetCopyNumber(1);
142 CryNumberTheta = 43-(nb-2)/5;
144 CryNumberPhi = 308-theTouchable->GetCopyNumber(2);
148 G4cout <<
"(Check ID)New EMC Hit on crystal: "
149 << CryNumberPhi <<
"(phi)"
150 << CryNumberTheta <<
"(theta)"
151 <<
" and the volume is " << physVol->GetName()
155 G4int trackId = aStep->GetTrack()->GetTrackID();
162 calHit->
SetPosCrystal(aStep->GetPreStepPoint()->GetPosition());
163 calHit->
SetTimeCrystal(aStep->GetPreStepPoint()->GetGlobalTime());
164 calHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
167 if(edep>0&&nHit<20000)
168 HitID[nHit]=CalCollection->insert(calHit)-1;
180 G4int trackIndex, g4TrackId;
184 if(m_trackIndex != trackIndex)
186 m_trackIndex = trackIndex;
189 G4int pdg =
abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
190 if(pdg==12 || pdg==14 || pdg==16) {
194 if(flag && aStep->GetTrack()->GetTrackID()==g4TrackId )
201 truHit->
SetPosCrystal(aStep->GetPreStepPoint()->GetPosition());
202 truHit->
SetTimeCrystal(aStep->GetPreStepPoint()->GetGlobalTime());
203 truHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
205 CalList->insert(truHit);
209 else if(m_trackIndex == trackIndex)
211 G4int
length = CalList->entries();
214 for(G4int i=0;i<
length;i++)
231 G4int trackIndex, g4TrackId;
236 if(CalTruthList->entries()>0) {
237 for(G4int i=0;i<CalTruthList->entries();i++) {
242 if(oldHit->
Find(
id)!=oldHit->
End()) {
253 G4int pdg =
abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
254 if(!(pdg==12 || pdg==14 || pdg==16)) {
262 if(aStep->GetTrack()->GetTrackID()==g4TrackId) {
264 truHit->
SetPDGCode(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
265 truHit->
SetPDGCharge(aStep->GetTrack()->GetDefinition()->GetPDGCharge());
266 truHit->
SetParticleName(aStep->GetTrack()->GetDefinition()->GetParticleName());
267 truHit->
SetTime(aStep->GetPreStepPoint()->GetGlobalTime());
268 truHit->
SetPosition(aStep->GetPreStepPoint()->GetPosition());
269 truHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
274 std::vector<BesTruthTrack*> *trackList = sensitiveManager->
GetTrackList();
276 for(
unsigned i=0;i<trackList->size();i++) {
279 if(trackIndex==truthTrack->
GetIndex()) {
299 CalTruthList->insert(truHit);
311 if((sector>=0)&&(sector<3))
318 CryNumberPhi = (sector-3)*4+nb;
320 else if((nb>=4)&&(nb<8))
323 CryNumberPhi = (sector-3)*4+nb-4;
325 else if((nb>=8)&&(nb<13))
328 CryNumberPhi = (sector-3)*5+nb-8;
330 else if((nb>=13)&&(nb<18))
333 CryNumberPhi = (sector-3)*5+nb-13;
335 else if((nb>=18)&&(nb<24))
338 CryNumberPhi = (sector-3)*6+nb-18;
340 else if((nb>=24)&&(nb<30))
343 CryNumberPhi = (sector-3)*6+nb-24;
382 switch(CryNumberTheta)
386 CryNumberPhi = 31-CryNumberPhi;
388 CryNumberPhi = 95-CryNumberPhi;
392 CryNumberPhi = 31-CryNumberPhi;
394 CryNumberPhi = 95-CryNumberPhi;
398 CryNumberPhi = 39-CryNumberPhi;
400 CryNumberPhi = 119-CryNumberPhi;
404 CryNumberPhi = 39-CryNumberPhi;
406 CryNumberPhi = 119-CryNumberPhi;
410 CryNumberPhi = 47-CryNumberPhi;
412 CryNumberPhi = 143-CryNumberPhi;
416 CryNumberPhi = 47-CryNumberPhi;
418 CryNumberPhi = 143-CryNumberPhi;