40{
42 G4Exception("sTGCSensitiveDetector::ProcessHits", "sTGCHitCollectionMissing", FatalException,
43 "Hit collection not initialized; did SetupEvent run?");
44 return false;
45 }
46 G4Track* currentTrack = aStep->GetTrack();
47 int charge=currentTrack->GetDefinition()->GetPDGCharge();
48
49 bool geantinoHit = (currentTrack->GetDefinition()==G4Geantino::GeantinoDefinition()) ||
50 (currentTrack->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition());
51
52 if (!
charge && (!geantinoHit))
return false;
53
54 G4StepPoint* postStep=aStep->GetPostStepPoint();
55 const G4Step* post_Step=aStep->GetTrack()->GetStep();
56
58
59 G4StepPoint* preStep = aStep->GetPreStepPoint();
61
62 int pdgCode=currentTrack->GetDefinition()->GetPDGEncoding();
63
64 float globalTime=postStep->GetGlobalTime();
65
67 float depositEnergy=post_Step->GetTotalEnergyDeposit();
68
69 if (depositEnergy<0.0001 && (!geantinoHit)) return false;
70
71 const G4TouchableHistory* touchHist = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
72
73
74
75 int nLayer=touchHist->GetVolume(
m_baseDepth)->GetCopyNo();
76 std::string
chName=touchHist->GetVolume(1+
m_baseDepth)->GetLogicalVolume()->GetName();
77
79
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);
83
84
85
86
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;
93 if (subType[1]==
'L')
iPhi-=1;
94
95 int iSide=1;
96 if (position.z()<0) iSide=-1;
97
98 int mLayer=0;
99 if (subType[1]=='S')
100 {
101 if (subType[3]=='C') mLayer=1;
102 else if (subType[3]=='P') mLayer=2;
103 }
104 else if (subType[1]=='L')
105 {
106 if (subType[3]=='P') mLayer=1;
107 else if (subType[3]=='C') mLayer=2;
108 }
109
110 if (mLayer != 1 && mLayer !=2) G4cout << " something is wrong - multilayer index is " << mLayer << G4endl;
111
112 int sTgcId =
m_muonHelper->BuildsTgcHitId(subType, iPhi, iRing, mLayer,nLayer, iSide);
113 TrackHelper trHelp(aStep->GetTrack());
114
117 preStep->GetKineticEnergy(),preposition);
118
119 return true;
120}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double charge(const T &p)
const sTgcHitIdHelper * m_muonHelper
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Eigen::Matrix< double, 3, 1 > Vector3D
const std::string & chName(ChIndex index)
convert ChIndex into a string