56{
57 if (verboseLevel>5) G4cout << "Process Hit" << G4endl;
58
59 G4double edep = aStep->GetTotalEnergyDeposit();
60 edep *= CLHEP::MeV;
61 if(edep==0.) {
62 if(aStep->GetTrack()->GetDefinition() != G4Geantino::GeantinoDefinition() &&
63 aStep->GetTrack()->GetDefinition() != G4ChargedGeantino::ChargedGeantinoDefinition())
64 return false;
65 }
66
67
68
69
70
71 const G4TouchableHistory *myTouch = dynamic_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
72 if (not myTouch) {
73 G4cout << "PixelSensorSD::ProcessHits bad dynamic_cast" << G4endl;
74 return false;
75 }
76 if(verboseLevel>5){
77 for (
int i=0;
i<myTouch->GetHistoryDepth();
i++){
78 std::string detname=myTouch->GetVolume(i)->GetLogicalVolume()->GetName();
79 int copyno=myTouch->GetVolume(i)->GetCopyNo();
80 G4cout << "Volume " <<detname <<" Copy Nr. " << copyno << G4endl;
81 }
82 }
83
84
85
86 G4ThreeVector coord1 = aStep->GetPreStepPoint()->GetPosition();
87 G4ThreeVector coord2 = aStep->GetPostStepPoint()->GetPosition();
88
89
90
91
92
93 const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
94 G4ThreeVector localPosition1 = transformation.TransformPoint(coord1);
95 G4ThreeVector localPosition2 = transformation.TransformPoint(coord2);
96
97 HepGeom::Point3D<double> lP1,lP2;
101
105
106
107
108
109
110
111
112
113
114
115
116
117 int BrlEcap = 0;
118 int LayerDisk = 0;
120 int phiMod = 0;
122
123
124
125
126
127
128
129 int BEcopyNo = myTouch->GetVolume()->GetCopyNo();
130
131
132 if(BEcopyNo == 100) {
133
134
135 etaMod = myTouch->GetVolume(1)->GetCopyNo();
136
137
138
139 phiMod = myTouch->GetVolume(2)->GetCopyNo();
140
141
142
143 LayerDisk = myTouch->GetVolume(3)->GetCopyNo();
144
145
146
147 if (verboseLevel>5){
148 G4cout << "In the Pixel Barrel" << G4endl;
149 G4cout << "----- Phi Module # " << phiMod << G4endl;
150 G4cout <<
"----- Eta Ladder # " <<
etaMod << G4endl;
151 G4cout << "----- Layer # " << LayerDisk << G4endl;
152 }
153
154
155 } else if (BEcopyNo == 200) {
156
157
158 phiMod = myTouch->GetVolume(1)->GetCopyNo();
159 if (phiMod == 48) phiMod = 0;
160
161
162
163
164 LayerDisk = myTouch->GetVolume(2)->GetCopyNo();
165
166
167 BrlEcap = myTouch->GetVolume(3)->GetCopyNo();
168
169
170
171
172 if (BrlEcap == 0) {
173 BrlEcap = (coord1.z() > 0) ? 2 : -2;
174 }
175
176
177 if (verboseLevel>5){
178 G4cout << "In the Pixel EndCap" << G4endl;
179 G4cout << "----- PhiModule # " << phiMod << G4endl;
180 G4cout << "----- Disk # " << LayerDisk << G4endl;
181 G4cout << "----- Endcap # " << BrlEcap << G4endl;
182 }
183
184
185 } else if (BEcopyNo == 300) {
186
187
188 phiMod = myTouch->GetVolume(1)->GetCopyNo();
189
190
191 etaMod = myTouch->GetVolume(2)->GetCopyNo()/2;
192
193
194 LayerDisk = myTouch->GetVolume(3)->GetCopyNo();
195
196
197 BrlEcap = myTouch->GetVolume(4)->GetCopyNo();
198
199
200
201 if (verboseLevel>5){
202 G4cout << "In the SLHC Pixel EndCap" << G4endl;
203 G4cout << "----- PhiModule # " << phiMod << G4endl;
204 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
205 G4cout << "----- Disk # " << LayerDisk << G4endl;
206 G4cout << "----- Endcap # " << BrlEcap << G4endl;
207 }
208
209 } else if(BEcopyNo == 400) {
210
211
212
213
214
216
217
218 LayerDisk = myTouch->GetVolume(1)->GetCopyNo();
219
220
221 phiMod = myTouch->GetVolume(3)->GetCopyNo();
222
223
224 BrlEcap = myTouch->GetVolume(4)->GetCopyNo();
225
226
227 if (verboseLevel>5){
228 G4cout << "In the DBM" << G4endl;
229 G4cout << "----- PhiModule # " << phiMod << G4endl;
230 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
231 G4cout << "----- Disk # " << LayerDisk << G4endl;
232 G4cout << "----- Endcap # " << BrlEcap << G4endl;
233 }
234
235 } else if(BEcopyNo == 500) {
236
237 std::string volName = myTouch->GetVolume()->GetName();
238
239
240 std::replace(volName.begin(),volName.end(),'_',' ');
241
242 std::vector<std::string>
v;
243 std::istringstream
s(volName);
245 while (s >> tmp) {
247 }
248
249 BrlEcap = 0;
250 LayerDisk =
atoi(v[1].c_str());
251 phiMod =
atoi(v[2].c_str());
253
254 if (verboseLevel>5){
255 G4cout << "Volume name " << volName <<G4endl;
256 double xpos = coord1.x();
257 double ypos = coord1.y();
258 double zpos = coord1.z();
259 double r = sqrt(xpos*xpos+ypos*ypos);
260 G4cout << "In the Alpine " << G4endl;
261 G4cout << "----- PhiModule # " << phiMod << G4endl;
262 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
263 G4cout << "----- Disk # " << LayerDisk << G4endl;
264 G4cout << "----- Endcap # " << BrlEcap << G4endl;
265 G4cout <<
"----- Pos # " <<
r<<
" "<<zpos << G4endl;
266 G4cout << "----- volume " << myTouch->GetVolume()->GetName()<< G4endl;
267 G4cout << " " << myTouch->GetVolume(1)->GetName()<<" "<<
268 myTouch->GetVolume(2)->GetName()<< " " << myTouch->GetVolume(3)->GetName()<<G4endl;
269 }
270
271 } else if(BEcopyNo == 600) {
272
273 std::string volName = myTouch->GetVolume()->GetName();
274
275
276 std::replace(volName.begin(),volName.end(),'_',' ');
277
278 std::vector<std::string>
v;
279 std::istringstream
s(volName);
281 while (s >> tmp) {
283 }
284
285 BrlEcap =
atoi(v[1].c_str());
286 LayerDisk =
atoi(v[2].c_str());
287 phiMod =
atoi(v[3].c_str());
289
290 if (verboseLevel>5){
291 double xpos = coord1.x();
292 double ypos = coord1.y();
293 double zpos = coord1.z();
294 double r = sqrt(xpos*xpos+ypos*ypos);
295 G4cout << "Volume name " << volName <<G4endl;
296 G4cout << "In the ITk EC ring " << G4endl;
297 G4cout << "----- PhiModule # " << phiMod << G4endl;
298 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
299 G4cout << "----- Disk # " << LayerDisk << G4endl;
300 G4cout << "----- Endcap # " << BrlEcap << G4endl;
301 G4cout <<
"----- Pos # " <<
r<<
" "<<zpos << G4endl;
302 G4cout << "----- volume " << myTouch->GetVolume()->GetName()<< G4endl;
303 G4cout << " " << myTouch->GetVolume(1)->GetName()<<" "<<
304 myTouch->GetVolume(2)->GetName()<< " " << myTouch->GetVolume(3)->GetName()<<G4endl;
305 }
306 }
307 else {
308
310 description <<
"ProcessHits: Unrecognized geometry in Pixel sensitive detector. Please contact the maintainer of the Pixel Detector Description.";
311 description <<
"If you are processing a GeoModelXML geometry, please ensure a PixelSensorGmxSD instance is used instead of this (PixelSensorSD).";
312 G4Exception(
"PixelSensorSD",
"UnrecognizedPixelGeometry", FatalException,
description);
313 abort();
314 }
315
316
317
318 TrackHelper trHelp(aStep->GetTrack());
319
321 lP2,
322 edep,
323 aStep->GetPreStepPoint()->GetGlobalTime(),
325 0,BrlEcap,LayerDisk,etaMod,phiMod,side);
326 return true;
327}
std::string description
glabal timer - how long have I taken so far?
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...