8 #include "G4Geantino.hh"
9 #include "G4ChargedGeantino.hh"
17 : G4VSensitiveDetector(
name )
18 , m_myTGCHitColl( hitCollectionName )
31 G4Track*
track = aStep->GetTrack();
33 if (
track->GetDefinition()->GetPDGCharge() == 0.0) {
34 if (
track->GetDefinition()!=G4Geantino::GeantinoDefinition())
return true;
35 else if (
track->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
37 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
38 G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();
39 const G4AffineTransform trans =
track->GetTouchable()->GetHistory()->GetTopTransform();
48 double globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
50 G4ThreeVector direcos = aStep->GetPreStepPoint()->GetMomentumDirection();
55 bool isAssembly =
false;
56 for (
int i=touchHist->GetHistoryDepth();
i>=0;
i--) {
58 std::string::size_type npos;
59 std::string::size_type nposStat;
60 std::string volName = touchHist->GetVolume(
i)->GetName();
63 if ((npos = volName.find(
"av_")) != std::string::npos &&
64 (npos = volName.find(
"impr_")) != std::string::npos) isAssembly =
true;
67 if ((npos = volName.find(
"station")) != std::string::npos && (!isAssembly)) {
70 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
79 if (abs(volCopyNo/100) > 3) {
93 stationPhi = (abs(volCopyNo%100)-1)*3+abs(volCopyNo/100);
95 if (abs(volCopyNo%100) < 4) {
100 }
else if(abs(volCopyNo%100) < 7) {
108 stationPhi = (abs(volCopyNo%100)-1)*6+abs(volCopyNo/100);
116 }
else if ((nposStat = volName.find(
"impr_")) != std::string::npos &&
117 (npos = volName.find(
"TGC")) != std::string::npos && isAssembly ) {
136 if ((
loc1 = volName.find(
"Muon::")) != std::string::npos) {
140 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
141 int copyNrBase =
int(volCopyNo/100000);
143 int zi =
int((copyNrBase%1000)/100);
144 if (
sideC == 1) zi = -zi;
153 if (abs(copyNrBase/100) > 3) {
167 stationPhi = (abs(copyNrBase%100)-1)*3+abs(copyNrBase/100);
169 if (abs(copyNrBase%100) < 4) {
174 }
else if(abs(copyNrBase%100) < 7) {
181 stationPhi = (abs(copyNrBase%100)-1)*6+abs(copyNrBase/100);
192 if ((
loc1 = volName.find(
'[')) != std::string::npos) {
193 if ((
loc2 = volName.find(
']',
loc1+1)) != std::string::npos) {
194 std::istringstream istrvar(volName.substr(
loc1+1,
loc2-
loc1-1));
203 }
else if ((npos = volName.find(
"tgccomponent")) != std::string::npos && (!isAssembly)) {
204 int volCopyNo = abs(touchHist->GetVolume(
i)->GetCopyNo());
206 if (volCopyNo > 1000) {
210 }
else if ((npos = volName.find(
"Gas Volume Layer")) != std::string::npos) {
211 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
215 gasGap = 3-(volCopyNo-3)/4;
217 gasGap = 2-(volCopyNo-3)/4;
220 gasGap = (volCopyNo-3)/4+1;
224 }
else if ((npos = volName.find(
"TGCGas")) != std::string::npos) {
226 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
248 aStep->GetTotalEnergyDeposit(),
249 aStep->GetStepLength(),
250 track->GetDefinition()->GetPDGEncoding(),
251 aStep->GetPreStepPoint()->GetKineticEnergy());