92 gErrorIgnoreLevel = kFatal;
94 G4double edep = aStep->GetTotalEnergyDeposit();
95 G4double stepl = aStep->GetStepLength();
96 if ((edep==0.)&&(stepl==0.))
return false;
98 G4TouchableHistory* theTouchable
99 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
100 G4VPhysicalVolume* physVol = theTouchable->GetVolume();
102 if(physVol->GetName().contains(
"physicalCrystal"))
105 CryNumberPhi=theTouchable->GetReplicaNumber(2);
106 CryNumberTheta=theTouchable->GetReplicaNumber(1);
108 else if(physVol->GetName().contains(
"logicalCrystal"))
111 std::istringstream thetaBuf((theTouchable->GetVolume(1)->GetName()).substr(16,2));
112 thetaBuf >> CryNumberTheta ;
113 CryNumberPhi = 308-theTouchable->GetCopyNumber(2);
115 else if(physVol->GetName().contains(
"physicalEndCrystal"))
117 PartId=theTouchable->GetReplicaNumber(3);
118 G4int endSector=theTouchable->GetReplicaNumber(2);
119 G4int endNb=theTouchable->GetReplicaNumber(0);
122 else if(physVol->GetName().contains(
"logicalEndCrystal"))
124 PartId=2-2*theTouchable->GetCopyNumber(3);
125 G4int endSector=theTouchable->GetCopyNumber(2);
126 G4int endNb,endNbGDML;
127 std::istringstream thetaBuf((theTouchable->GetVolume(0)->GetName()).substr(20,2));
133 else if(physVol->GetName().contains(
"physicalPD"))
137 CryNumberPhi=theTouchable->GetReplicaNumber(2);
138 CryNumberTheta=theTouchable->GetReplicaNumber(1);
140 else if(physVol->GetName().contains(
"logicalPD"))
144 G4int nb=theTouchable->GetCopyNumber(1);
148 CryNumberTheta = 43-(nb-2)/5;
150 CryNumberPhi = 308-theTouchable->GetCopyNumber(2);
154 G4cout <<
"(Check ID)New EMC Hit on crystal: "
155 << CryNumberPhi <<
"(phi)"
156 << CryNumberTheta <<
"(theta)"
157 <<
" and the volume is " << physVol->GetName()
161 G4int trackId = aStep->GetTrack()->GetTrackID();
168 calHit->
SetPosCrystal(aStep->GetPreStepPoint()->GetPosition());
169 calHit->
SetTimeCrystal(aStep->GetPreStepPoint()->GetGlobalTime());
170 calHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
174 G4int idhit = CalCollection->insert(calHit)-1;
175 if(nHit<40000) HitID[nHit]=idhit;
188 G4int trackIndex, g4TrackId;
192 if(m_trackIndex != trackIndex)
194 m_trackIndex = trackIndex;
197 G4int pdg =
abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
198 if(pdg==12 || pdg==14 || pdg==16) {
202 if(
flag && aStep->GetTrack()->GetTrackID()==g4TrackId )
209 truHit->
SetPosCrystal(aStep->GetPreStepPoint()->GetPosition());
210 truHit->
SetTimeCrystal(aStep->GetPreStepPoint()->GetGlobalTime());
211 truHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
213 CalList->insert(truHit);
217 else if(m_trackIndex == trackIndex)
219 G4int length = CalList->entries();
222 for(G4int i=0;i<length;i++)
239 G4int trackIndex, g4TrackId;
244 if(CalTruthList->entries()>0) {
245 for(G4int i=0;i<CalTruthList->entries();i++) {
250 if(oldHit->
Find(
id)!=oldHit->
End()) {
261 G4int pdg =
abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
262 if(!(pdg==12 || pdg==14 || pdg==16)) {
270 if(aStep->GetTrack()->GetTrackID()==g4TrackId) {
272 truHit->
SetPDGCode(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
273 truHit->
SetPDGCharge(aStep->GetTrack()->GetDefinition()->GetPDGCharge());
274 truHit->
SetParticleName(aStep->GetTrack()->GetDefinition()->GetParticleName());
275 truHit->
SetTime(aStep->GetPreStepPoint()->GetGlobalTime());
276 truHit->
SetPosition(aStep->GetPreStepPoint()->GetPosition());
277 truHit->
SetMomentum(aStep->GetPreStepPoint()->GetMomentum());
282 std::vector<BesTruthTrack*> *trackList = sensitiveManager->
GetTrackList();
284 for(
unsigned i=0;i<trackList->size();i++) {
287 if(trackIndex==truthTrack->
GetIndex()) {
307 CalTruthList->insert(truHit);
319 if((sector>=0)&&(sector<3))
326 CryNumberPhi = (sector-3)*4+nb;
328 else if((nb>=4)&&(nb<8))
331 CryNumberPhi = (sector-3)*4+nb-4;
333 else if((nb>=8)&&(nb<13))
336 CryNumberPhi = (sector-3)*5+nb-8;
338 else if((nb>=13)&&(nb<18))
341 CryNumberPhi = (sector-3)*5+nb-13;
343 else if((nb>=18)&&(nb<24))
346 CryNumberPhi = (sector-3)*6+nb-18;
348 else if((nb>=24)&&(nb<30))
351 CryNumberPhi = (sector-3)*6+nb-24;
390 switch(CryNumberTheta)
394 CryNumberPhi = 31-CryNumberPhi;
396 CryNumberPhi = 95-CryNumberPhi;
400 CryNumberPhi = 31-CryNumberPhi;
402 CryNumberPhi = 95-CryNumberPhi;
406 CryNumberPhi = 39-CryNumberPhi;
408 CryNumberPhi = 119-CryNumberPhi;
412 CryNumberPhi = 39-CryNumberPhi;
414 CryNumberPhi = 119-CryNumberPhi;
418 CryNumberPhi = 47-CryNumberPhi;
420 CryNumberPhi = 143-CryNumberPhi;
424 CryNumberPhi = 47-CryNumberPhi;
426 CryNumberPhi = 143-CryNumberPhi;