8 #include "G4Geantino.hh"
9 #include "G4ChargedGeantino.hh"
19 : G4VSensitiveDetector(
name )
20 , m_sTGCSimHitCollection( hitCollectionName )
34 G4Track* currentTrack = aStep->GetTrack();
35 int charge=currentTrack->GetDefinition()->GetPDGCharge();
37 bool geantinoHit = (currentTrack->GetDefinition()==G4Geantino::GeantinoDefinition()) ||
38 (currentTrack->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition());
40 if (!
charge && (!geantinoHit))
return false;
42 G4StepPoint* postStep=aStep->GetPostStepPoint();
43 const G4Step* post_Step=aStep->GetTrack()->GetStep();
47 G4StepPoint* preStep = aStep->GetPreStepPoint();
50 int pdgCode=currentTrack->GetDefinition()->GetPDGEncoding();
52 float globalTime=postStep->GetGlobalTime();
55 float depositEnergy=post_Step->GetTotalEnergyDeposit();
57 if (depositEnergy<0.0001 && (!geantinoHit))
return false;
59 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
63 int nLayer=touchHist->GetVolume(0)->GetCopyNo();
64 std::string chName=touchHist->GetVolume(1)->GetLogicalVolume()->GetName();
66 std::string subType=chName.substr(chName.find(
'-')+1);
68 if (subType[0]!=
'T'&&subType[0]!=
'Q' ) G4cout <<
" something is wrong, this is no sTGC!"<<G4endl;
69 std::string temp(&subType[2]);
70 std::istringstream is(temp);
77 G4ThreeVector posH=postStep->GetPosition();
78 if (subType[1]==
'L') posH.rotateZ(
M_PI/8.);
79 double phiHit=posH.phi();
80 if(phiHit<=0) phiHit+=2.*
M_PI;
83 if (subType[1]==
'L')
iPhi-=1;
86 if (position.z()<0) iSide=-1;
91 if (subType[3]==
'C') mLayer=1;
92 else if (subType[3]==
'P') mLayer=2;
94 else if (subType[1]==
'L')
96 if (subType[3]==
'P') mLayer=1;
97 else if (subType[3]==
'C') mLayer=2;
100 if (mLayer != 1 && mLayer !=2) G4cout <<
" something is wrong - multilayer index is " << mLayer << G4endl;
106 preStep->GetKineticEnergy(),preposition);