40 {
41
43 G4Exception("TGCSensitiveDetectorCosmics::ProcessHits", "TGCCosmicHitCollectionMissing", FatalException,
44 "Hit collection not initialized; did SetupEvent run?");
45 return false;
46 }
47
48 G4Track*
track = aStep->GetTrack();
49
50 if (
track->GetDefinition()->GetPDGCharge() == 0.0) {
51 if (
track->GetDefinition()!=G4Geantino::GeantinoDefinition())
return true;
52 else if (
track->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
53 }
54 const G4TouchableHistory* touchHist = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
55 G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();
56 const G4AffineTransform trans =
track->GetTouchable()->GetHistory()->GetTopTransform();
57
58
63
64
65 double globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
67 G4ThreeVector direcos = aStep->GetPreStepPoint()->GetMomentumDirection();
69
70
71
72 G4ThreeVector globVrtx = aStep->GetPreStepPoint()->GetPosition();
73
74
75 double dist = globVrtx.mag();
76 double inv_lightspeed = 1. / CLHEP::c_light;
77 double tOrigin = dist * inv_lightspeed;
78
79 G4int trackid = aStep->GetTrack()->GetTrackID();
81
82
84
88
92
93 }
94 double globalDist = sqrt((
m_globH[0] - globVrtx[0])*(
m_globH[0] - globVrtx[0]) +
97 double tof = globalDist * inv_lightspeed;
98
99
100
101 int zside(0);
102 for (int i=touchHist->GetHistoryDepth();i>=0;i--) {
103
104 std::string::size_type npos;
105 std::string volName = touchHist->GetVolume(i)->GetName();
106
107
108 if ((npos = volName.find("station")) != std::string::npos) {
109
111 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
112 if (volCopyNo > 0) {
113 zside = 1;
114 } else {
115 zside = -1;
116 }
118
120 if (abs(volCopyNo/100) > 3) {
122 } else {
124 }
125
127 if (stationPhi <= 0) {
129 }
130
133
134 stationPhi = (abs(volCopyNo%100)-1)*3+abs(volCopyNo/100);
135
136 if (abs(volCopyNo%100) < 4) {
138 if (stationPhi <= 0) {
140 }
141 } else if(abs(volCopyNo%100) < 7) {
143 } else {
145 }
146
147 } else {
148
149 stationPhi = (abs(volCopyNo%100)-1)*6+abs(volCopyNo/100);
150
152 if (stationPhi <= 0) {
154 }
155 }
156 }
157
158
159 } else if ((npos = volName.find("tgccomponent")) != std::string::npos) {
160 int volCopyNo = abs(touchHist->GetVolume(i)->GetCopyNo());
162 if (volCopyNo > 1000) {
164 }
165
166
167 } else if ((npos = volName.find("Gas Volume Layer")) != std::string::npos) {
168 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
170 if (zside < 0) {
171 if (iStation == 1)
172 gasGap = 3-(volCopyNo-3)/4;
173 else
174 gasGap = 2-(volCopyNo-3)/4;
175 } else {
176
177 gasGap = (volCopyNo-3)/4+1;
178
179
180 }
181 } else if ((npos = volName.find("TGCGas")) != std::string::npos) {
182
183 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
184
185 if (volCopyNo != 0)
187 }
188 }
189
190
192 stationPhi,
193 stationEta,
194 gasGap);
195
196
198
200
201
202
203
204
205 TrackHelper trHelp(aStep->GetTrack());
206
209 localPosition,
210 localDireCos,
212 aStep->GetTotalEnergyDeposit(),
213 aStep->GetStepLength());
214 return true;
215}
Amg::Vector3D m_currVertex
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
constexpr uint8_t stationPhi
station Phi 1 to 8
constexpr uint8_t stationEta
1 to 3