44 if (verboseLevel>5) G4cout <<
"Process Hit" << G4endl;
46 G4double edep = aStep->GetTotalEnergyDeposit();
50 if (aStep->GetTrack()->GetDefinition() != G4Geantino::GeantinoDefinition() &&
51 aStep->GetTrack()->GetDefinition() != G4ChargedGeantino::ChargedGeantinoDefinition())
58 const G4TouchableHistory* myTouch =
dynamic_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
61 for (
int i=0;
i<myTouch->GetHistoryDepth();
i++){
62 std::string detname = myTouch->GetVolume(
i)->GetLogicalVolume()->GetName();
63 int copyno = myTouch->GetVolume(
i)->GetCopyNo();
64 G4cout <<
"Volume " << detname <<
" Copy Nr. " << copyno << G4endl;
71 G4ThreeVector startCoord = aStep->GetPreStepPoint()->GetPosition();
72 G4ThreeVector endCoord = aStep->GetPostStepPoint()->GetPosition();
74 G4ThreeVector globalPosition = (startCoord + endCoord)/2;
77 int posNegEndcap = ( globalPosition.z() > 0. ? 1 : -1 );
80 std::string detname_layer=myTouch->GetVolume(0)->GetLogicalVolume()->GetName();
81 if ( detname_layer.find(
"Sensor") == std::string::npos ) {
84 description <<
"ProcessHits: No HGTD sensitive detector with substring Sensor found. Check HGTD Detector Description.";
85 G4Exception(
"HGTDSensorSD",
"UnrecognizedHGTDGeometry", FatalException,
description);
92 for (
int i = myTouch->GetHistory()->GetDepth();
i >= 0 ;
i-- ) {
93 std::string detname = myTouch->GetHistory()->GetVolume(
i)->GetLogicalVolume()->GetName();
94 G4VisExtent extent = myTouch->GetHistory()->GetVolume(
i)->GetLogicalVolume()->GetSolid()->GetExtent();
95 int copyno=myTouch->GetHistory()->GetVolume(
i)->GetCopyNo();
96 const G4AffineTransform transformation1 = myTouch->GetHistory()->GetTransform(
i );
97 const G4AffineTransform transformationInverse = transformation1.Inverse();
98 G4ThreeVector pos_center_local(0.0, 0.0, 0.0);
99 G4ThreeVector pos_center_global = transformationInverse.TransformPoint( pos_center_local );
100 G4ThreeVector pos_current = transformation1.TransformPoint( globalPosition );
101 G4cout <<
"DEBUG HGTDG4SD : "
102 <<
"VOLUME: " <<
i <<
" detname: " << detname
103 <<
", center of element : " << pos_center_global.x()*
CLHEP::mm <<
", y: " << pos_center_global.y()*
CLHEP::mm <<
", z: " << pos_center_global.z()*
CLHEP::mm
104 <<
", extent: x: " << extent.GetXmax() - extent.GetXmin() <<
", y: " << extent.GetYmax() - extent.GetYmin() <<
", z: " << extent.GetZmax() - extent.GetZmin()
105 <<
", copyno: " << copyno << G4endl;
106 G4cout <<
"DEBUG HGTDG4SD : LOCAL: x: " << pos_current.x()*
CLHEP::mm <<
", y: " << pos_current.y()*
CLHEP::mm <<
", z: " << pos_current.z()*
CLHEP::mm << G4endl;
109 const G4AffineTransform transformation2 = myTouch->GetHistory()->GetTransform(
i-1 );
110 G4AffineTransform transformation_up;
111 transformation_up.Product( transformationInverse, transformation2 );
112 G4ThreeVector pos_up = transformation_up.TransformPoint( pos_current );
113 G4RotationMatrix rotmat = transformation_up.NetRotation();
114 G4ThreeVector translation = transformation_up.NetTranslation();
115 G4cout <<
"DEBUG HGTDG4SD : Rotation:"
116 <<
"| xx:" << rotmat.xx() <<
", xy: " << rotmat.xy() <<
", xz: " << rotmat.xz()
117 <<
"| yx:" << rotmat.yx() <<
", yy: " << rotmat.yy() <<
", yz: " << rotmat.yz()
118 <<
"| zx:" << rotmat.zx() <<
", zy: " << rotmat.zy() <<
", zz: " << rotmat.zz() <<
" | " << G4endl;
119 G4cout <<
"DEBUG HGTDG4SD : Translation: x: " << translation.x() <<
", y:" << translation.y() <<
", z:" << translation.z() << G4endl;
120 G4cout <<
"DEBUG HGTDG4SD : TRANSFORMED: x:" << pos_up.x()*
CLHEP::mm <<
", y:" << pos_up.y()*
CLHEP::mm <<
", z:" << pos_up.z()*
CLHEP::mm << G4endl;
127 const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
129 G4ThreeVector localPosition1 = transformation.TransformPoint(startCoord);
130 G4ThreeVector localPosition2 = transformation.TransformPoint(endCoord);
133 G4cout <<
" PreStepPoint " << G4endl;
134 G4cout <<
" x (global/local) " << startCoord.x()*
CLHEP::mm <<
" " << localPosition1[0]*
CLHEP::mm << G4endl;
135 G4cout <<
" y (global/local) " << startCoord.y()*
CLHEP::mm <<
" " << localPosition1[1]*
CLHEP::mm << G4endl;
136 G4cout <<
" z (global/local) " << startCoord.z()*
CLHEP::mm <<
" " << localPosition1[2]*
CLHEP::mm << G4endl;
138 G4cout <<
" PostStepPoint: " << G4endl;
139 G4cout <<
" x (global/local) " << endCoord.x()*
CLHEP::mm <<
" " << localPosition2[0]*
CLHEP::mm << G4endl;
140 G4cout <<
" y (global/local) " << endCoord.y()*
CLHEP::mm <<
" " << localPosition2[1]*
CLHEP::mm << G4endl;
141 G4cout <<
" z (global/local) " << endCoord.z()*
CLHEP::mm <<
" " << localPosition2[2]*
CLHEP::mm << G4endl;
144 HepGeom::Point3D<double> lP1,lP2;
153 std::string module_indices = myTouch->GetVolume(1)->GetLogicalVolume()->GetName();
154 std::size_t
found = module_indices.find_last_of(
"_");
159 int eta =
atoi((module_indices.substr(
found+1)).c_str());
160 module_indices.erase(
found);
161 found = module_indices.find_last_of(
"_");
162 int phi =
atoi((module_indices.substr(
found+1)).c_str());
163 module_indices.erase(
found);
164 found = module_indices.find_last_of(
"_");
167 int endcap_side = 2*posNegEndcap;
173 aStep->GetPreStepPoint()->GetGlobalTime(),
174 trHelp.GenerateParticleLink(),