11 #include "G4Geantino.hh"
12 #include "G4ChargedGeantino.hh"
21 : G4VSensitiveDetector(
name )
26 , m_myCSCHitColl( hitCollectionName )
43 G4Track* currentTrack = aStep->GetTrack();
46 auto trackDef = currentTrack->GetDefinition();
47 if (trackDef->GetPDGCharge() == 0.0) {
48 if (trackDef != G4Geantino::GeantinoDefinition())
return true;
49 else if (trackDef == G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
52 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
53 G4ThreeVector startPos=aStep->GetPreStepPoint()->GetPosition();
54 G4ThreeVector endPos=aStep->GetPostStepPoint()->GetPosition();
55 double kinEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
69 double globalTime = -1;
80 const double dist = globVrtx.mag();
81 const double lightspeed = 299.792458;
82 const double tOrigin = dist / lightspeed;
98 const double globalDist = sqrt((
m_globH[0] - globVrtx[0])*(
m_globH[0] - globVrtx[0]) +
101 double tof = globalDist / lightspeed;
106 bool isAssembly =
false;
107 for (
int i = touchHist->GetHistoryDepth();
i>=0; --
i) {
108 std::string::size_type npos;
109 std::string volName = touchHist->GetVolume(
i)->GetName();
112 if ((npos = volName.find(
"av_")) != std::string::npos &&
113 (npos = volName.find(
"impr_")) != std::string::npos) isAssembly =
true;
115 if ((npos = volName.find(
"station")) != std::string::npos && (!isAssembly)) {
118 volName.resize(npos-2);
119 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
127 }
else if ((npos = volName.find(
"CSC")) != std::string::npos && isAssembly ) {
146 if ((
loc1 = volName.find(
"Muon::")) != std::string::npos) {
151 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
152 int copyNrBase =
int(volCopyNo/100000);
154 int zi =
int((copyNrBase%1000)/100);
156 int fi =
int(copyNrBase%100);
157 if (
sideC == 1) zi = -zi;
163 if ((
loc1 = volName.find(
'[')) != std::string::npos) {
164 if ((
loc2 = volName.find(
']',
loc1+1)) != std::string::npos) {
165 std::istringstream istrvar(volName.substr(
loc1+1,
loc2-
loc1-1));
171 }
else if ((npos = volName.find(
"component")) != std::string::npos && (!isAssembly)) {
177 }
else if ((npos = volName.find(
"CscArCO2")) != std::string::npos) {
180 wireLayer=touchHist->GetVolume(
i)->GetCopyNo();
182 if(wireLayer==4) wireLayer=1;
183 else if(wireLayer==3) wireLayer=2;
184 else if(wireLayer==2) wireLayer=3;
185 else if(wireLayer==1) wireLayer=4;
189 G4String
particle=aStep->GetTrack()->GetDefinition()->GetParticleName();
192 else if (
particle==
"e+") lundcode=2;
193 else if (
particle==
"e-") lundcode=3;
194 else if (
particle==
"mu+") lundcode=5;
195 else if (
particle==
"mu-") lundcode=6;
196 else if (
particle==
"pi+") lundcode=8;
197 else if (
particle==
"pi-") lundcode=9;
198 else if (
particle==
"kaon+") lundcode=11;
199 else if (
particle==
"kaon-") lundcode=12;
200 else if (
particle==
"proton") lundcode=14;
201 else if (
particle==
"anti_proton") lundcode=15;
202 else if (
particle==
"sigma+") lundcode=19;
203 else if (
particle==
"sigma-") lundcode=21;
204 else if (
particle==
"anti_sigma-") lundcode=27;
205 else if (
particle==
"anti_sigma+") lundcode=29;
206 else if (
particle==
"deuteron") lundcode=45;
207 else if (
particle==
"geantino") lundcode=999;
211 globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
217 const G4AffineTransform
transform = touchHist->GetHistory()->GetTopTransform();
232 (((
m_vertex.mag() < 100) || ((fabs(globalTime - tOrigin)) < 0.1) ) ? (
m_globalTime = globalTime)
246 HitStart, HitEnd, lundcode,