11 #include "G4Geantino.hh"
12 #include "G4ChargedGeantino.hh"
18 const std::string& hitCollectionName)
19 : G4VSensitiveDetector(
name )
20 , m_myCSCHitColl( hitCollectionName )
33 G4Track* currentTrack = aStep->GetTrack();
36 auto trackDef = currentTrack->GetDefinition();
37 if (trackDef->GetPDGCharge() == 0.0) {
38 if (trackDef != G4Geantino::GeantinoDefinition())
return true;
39 else if (trackDef == G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
42 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
43 G4ThreeVector startPos=aStep->GetPreStepPoint()->GetPosition();
44 G4ThreeVector endPos=aStep->GetPostStepPoint()->GetPosition();
45 double kinEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
59 double globalTime = -1;
66 bool isAssembly =
false;
67 for (
int i = touchHist->GetHistoryDepth();
i>=0; --
i) {
68 std::string::size_type npos;
69 std::string volName = touchHist->GetVolume(
i)->GetName();
75 if ((npos = volName.find(
"av_")) != std::string::npos &&
76 (npos = volName.find(
"impr_")) != std::string::npos) isAssembly =
true;
78 if ((npos = volName.find(
"station")) != std::string::npos && (!isAssembly)) {
81 volName.resize(npos-2);
82 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
90 }
else if ((npos = volName.find(
"CSC")) != std::string::npos && isAssembly ) {
109 if ((
loc1 = volName.find(
"Muon::")) != std::string::npos) {
114 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
115 int copyNrBase =
int(volCopyNo/100000);
117 int zi =
int((copyNrBase%1000)/100);
119 int fi =
int(copyNrBase%100);
120 if (
sideC == 1) zi = -zi;
126 if ((
loc1 = volName.find(
'[')) != std::string::npos) {
127 if ((
loc2 = volName.find(
']',
loc1+1)) != std::string::npos) {
128 std::istringstream istrvar(volName.substr(
loc1+1,
loc2-
loc1-1));
134 }
else if ((npos = volName.find(
"component")) != std::string::npos && (!isAssembly)) {
139 }
else if ((npos = volName.find(
"CscArCO2")) != std::string::npos) {
142 wireLayer=touchHist->GetVolume(
i)->GetCopyNo();
144 if(wireLayer==4) wireLayer=1;
145 else if(wireLayer==3) wireLayer=2;
146 else if(wireLayer==2) wireLayer=3;
147 else if(wireLayer==1) wireLayer=4;
151 G4String
particle=aStep->GetTrack()->GetDefinition()->GetParticleName();
154 else if (
particle==
"e+") lundcode=2;
155 else if (
particle==
"e-") lundcode=3;
156 else if (
particle==
"mu+") lundcode=5;
157 else if (
particle==
"mu-") lundcode=6;
158 else if (
particle==
"pi+") lundcode=8;
159 else if (
particle==
"pi-") lundcode=9;
160 else if (
particle==
"kaon+") lundcode=11;
161 else if (
particle==
"kaon-") lundcode=12;
162 else if (
particle==
"proton") lundcode=14;
163 else if (
particle==
"anti_proton") lundcode=15;
164 else if (
particle==
"sigma+") lundcode=19;
165 else if (
particle==
"sigma-") lundcode=21;
166 else if (
particle==
"anti_sigma-") lundcode=27;
167 else if (
particle==
"anti_sigma+") lundcode=29;
168 else if (
particle==
"deuteron") lundcode=45;
173 G4cout <<
"WP CSCSensitiveDetector.cxx have exceptional particlue out of selection:: "
180 globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
186 const G4AffineTransform
transform = touchHist->GetHistory()->GetTopTransform();
206 HitStart, HitEnd, lundcode,