18 #include "G4ChargedGeantino.hh"
19 #include "G4Geantino.hh"
20 #include "G4SDManager.hh"
22 #include "G4ThreeVector.hh"
25 #include "CLHEP/Geometry/Transform3D.h"
26 #include "CLHEP/Units/SystemOfUnits.h"
34 : G4VSensitiveDetector(
name )
35 , m_HitColl( hitCollectionName )
50 if (verboseLevel>5) G4cout <<
"Process Hit" << G4endl;
52 G4double edep = aStep->GetTotalEnergyDeposit();
55 if(aStep->GetTrack()->GetDefinition() != G4Geantino::GeantinoDefinition() &&
56 aStep->GetTrack()->GetDefinition() != G4ChargedGeantino::ChargedGeantinoDefinition())
64 const G4TouchableHistory *myTouch =
dynamic_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
66 G4cout <<
"PixelSensorSD::ProcessHits bad dynamic_cast" << G4endl;
70 for (
int i=0;
i<myTouch->GetHistoryDepth();
i++){
71 std::string detname=myTouch->GetVolume(
i)->GetLogicalVolume()->GetName();
72 int copyno=myTouch->GetVolume(
i)->GetCopyNo();
73 G4cout <<
"Volume " <<detname <<
" Copy Nr. " << copyno << G4endl;
79 G4ThreeVector coord1 = aStep->GetPreStepPoint()->GetPosition();
80 G4ThreeVector coord2 = aStep->GetPostStepPoint()->GetPosition();
86 const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
87 G4ThreeVector localPosition1 = transformation.TransformPoint(coord1);
88 G4ThreeVector localPosition2 = transformation.TransformPoint(coord2);
90 HepGeom::Point3D<double> lP1,lP2;
122 int BEcopyNo = myTouch->GetVolume()->GetCopyNo();
125 if(BEcopyNo == 100) {
128 etaMod = myTouch->GetVolume(1)->GetCopyNo();
132 phiMod = myTouch->GetVolume(2)->GetCopyNo();
136 LayerDisk = myTouch->GetVolume(3)->GetCopyNo();
141 G4cout <<
"In the Pixel Barrel" << G4endl;
142 G4cout <<
"----- Phi Module # " << phiMod << G4endl;
143 G4cout <<
"----- Eta Ladder # " <<
etaMod << G4endl;
144 G4cout <<
"----- Layer # " <<
LayerDisk << G4endl;
148 }
else if (BEcopyNo == 200) {
151 phiMod = myTouch->GetVolume(1)->GetCopyNo();
152 if (phiMod == 48) phiMod = 0;
157 LayerDisk = myTouch->GetVolume(2)->GetCopyNo();
160 BrlEcap = myTouch->GetVolume(3)->GetCopyNo();
166 BrlEcap = (coord1.z() > 0) ? 2 : -2;
171 G4cout <<
"In the Pixel EndCap" << G4endl;
172 G4cout <<
"----- PhiModule # " << phiMod << G4endl;
173 G4cout <<
"----- Disk # " <<
LayerDisk << G4endl;
174 G4cout <<
"----- Endcap # " << BrlEcap << G4endl;
178 }
else if (BEcopyNo == 300) {
181 phiMod = myTouch->GetVolume(1)->GetCopyNo();
184 etaMod = myTouch->GetVolume(2)->GetCopyNo()/2;
187 LayerDisk = myTouch->GetVolume(3)->GetCopyNo();
190 BrlEcap = myTouch->GetVolume(4)->GetCopyNo();
195 G4cout <<
"In the SLHC Pixel EndCap" << G4endl;
196 G4cout <<
"----- PhiModule # " << phiMod << G4endl;
197 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
198 G4cout <<
"----- Disk # " <<
LayerDisk << G4endl;
199 G4cout <<
"----- Endcap # " << BrlEcap << G4endl;
202 }
else if(BEcopyNo == 400) {
211 LayerDisk = myTouch->GetVolume(1)->GetCopyNo();
214 phiMod = myTouch->GetVolume(3)->GetCopyNo();
217 BrlEcap = myTouch->GetVolume(4)->GetCopyNo();
221 G4cout <<
"In the DBM" << G4endl;
222 G4cout <<
"----- PhiModule # " << phiMod << G4endl;
223 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
224 G4cout <<
"----- Disk # " <<
LayerDisk << G4endl;
225 G4cout <<
"----- Endcap # " << BrlEcap << G4endl;
228 }
else if(BEcopyNo == 500) {
230 std::string volName = myTouch->GetVolume()->GetName();
235 std::vector<std::string>
v;
236 std::istringstream
s(volName);
244 phiMod =
atoi(
v[2].c_str());
248 G4cout <<
"Volume name " << volName <<G4endl;
249 double xpos = coord1.x();
250 double ypos = coord1.y();
251 double zpos = coord1.z();
252 double r = sqrt(xpos*xpos+ypos*ypos);
253 G4cout <<
"In the Alpine " << G4endl;
254 G4cout <<
"----- PhiModule # " << phiMod << G4endl;
255 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
256 G4cout <<
"----- Disk # " <<
LayerDisk << G4endl;
257 G4cout <<
"----- Endcap # " << BrlEcap << G4endl;
258 G4cout <<
"----- Pos # " <<
r<<
" "<<zpos << G4endl;
259 G4cout <<
"----- volume " << myTouch->GetVolume()->GetName()<< G4endl;
260 G4cout <<
" " << myTouch->GetVolume(1)->GetName()<<
" "<<
261 myTouch->GetVolume(2)->GetName()<<
" " << myTouch->GetVolume(3)->GetName()<<G4endl;
264 }
else if(BEcopyNo == 600) {
266 std::string volName = myTouch->GetVolume()->GetName();
271 std::vector<std::string>
v;
272 std::istringstream
s(volName);
278 BrlEcap =
atoi(
v[1].c_str());
280 phiMod =
atoi(
v[3].c_str());
284 double xpos = coord1.x();
285 double ypos = coord1.y();
286 double zpos = coord1.z();
287 double r = sqrt(xpos*xpos+ypos*ypos);
288 G4cout <<
"Volume name " << volName <<G4endl;
289 G4cout <<
"In the ITk EC ring " << G4endl;
290 G4cout <<
"----- PhiModule # " << phiMod << G4endl;
291 G4cout <<
"----- Ring/Eta # " <<
etaMod << G4endl;
292 G4cout <<
"----- Disk # " <<
LayerDisk << G4endl;
293 G4cout <<
"----- Endcap # " << BrlEcap << G4endl;
294 G4cout <<
"----- Pos # " <<
r<<
" "<<zpos << G4endl;
295 G4cout <<
"----- volume " << myTouch->GetVolume()->GetName()<< G4endl;
296 G4cout <<
" " << myTouch->GetVolume(1)->GetName()<<
" "<<
297 myTouch->GetVolume(2)->GetName()<<
" " << myTouch->GetVolume(3)->GetName()<<G4endl;
303 description <<
"ProcessHits: Unrecognized geometry in Pixel sensitive detector. Please contact the maintainer of the Pixel Detector Description.";
304 description <<
"If you are processing a GeoModelXML geometry, please ensure a PixelSensorGmxSD instance is used instead of this (PixelSensorSD).";
305 G4Exception(
"PixelSensorSD",
"UnrecognizedPixelGeometry", FatalException,
description);
314 aStep->GetPreStepPoint()->GetGlobalTime(),