42 G4Exception(
"sTGCSensitiveDetector::ProcessHits",
"sTGCHitCollectionMissing", FatalException,
43 "Hit collection not initialized; did SetupEvent run?");
46 G4Track* currentTrack = aStep->GetTrack();
47 int charge=currentTrack->GetDefinition()->GetPDGCharge();
49 bool geantinoHit = (currentTrack->GetDefinition()==G4Geantino::GeantinoDefinition()) ||
50 (currentTrack->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition());
52 if (!
charge && (!geantinoHit))
return false;
54 G4StepPoint* postStep=aStep->GetPostStepPoint();
55 const G4Step* post_Step=aStep->GetTrack()->GetStep();
59 G4StepPoint* preStep = aStep->GetPreStepPoint();
62 int pdgCode=currentTrack->GetDefinition()->GetPDGEncoding();
64 float globalTime=postStep->GetGlobalTime();
67 float depositEnergy=post_Step->GetTotalEnergyDeposit();
69 if (depositEnergy<0.0001 && (!geantinoHit))
return false;
71 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
75 int nLayer=touchHist->GetVolume(
m_baseDepth)->GetCopyNo();
76 std::string chName=touchHist->GetVolume(1+
m_baseDepth)->GetLogicalVolume()->GetName();
78 std::string subType=chName.substr(chName.find(
'-')+1);
80 if (subType[0]!=
'T'&&subType[0]!=
'Q' )
ATH_MSG_WARNING(
" something is wrong, this is no sTGC! "<<chName<<
", "<<
Amg::toString(preposition));
81 int iRing = std::atoi(&subType[2]) -1;
82 ATH_MSG_VERBOSE(
"Volume name: "<<chName<<
", nLayer: "<<nLayer<<
", subType: "<<subType<<
", iRing: "<<iRing);
87 G4ThreeVector posH=postStep->GetPosition();
88 if (subType[1]==
'L') posH.rotateZ(
M_PI/8.);
89 double phiHit=posH.phi();
90 if(phiHit<=0) phiHit+=2.*
M_PI;
91 int iPhi=1+int(phiHit/(
M_PI/4.));
93 if (subType[1]==
'L') iPhi-=1;
96 if (position.z()<0) iSide=-1;
101 if (subType[3]==
'C') mLayer=1;
102 else if (subType[3]==
'P') mLayer=2;
104 else if (subType[1]==
'L')
106 if (subType[3]==
'P') mLayer=1;
107 else if (subType[3]==
'C') mLayer=2;
110 if (mLayer != 1 && mLayer !=2) G4cout <<
" something is wrong - multilayer index is " << mLayer << G4endl;
112 int sTgcId =
m_muonHelper->BuildsTgcHitId(subType, iPhi, iRing, mLayer,nLayer, iSide);
117 preStep->GetKineticEnergy(),preposition);