41 G4Exception(
"CSCSensitiveDetector::ProcessHits",
"CSCHitCollectionMissing", FatalException,
42 "Hit collection not initialized; did SetupEvent run?");
46 G4Track* currentTrack = aStep->GetTrack();
49 auto trackDef = currentTrack->GetDefinition();
50 if (trackDef->GetPDGCharge() == 0.0) {
51 if (trackDef != G4Geantino::GeantinoDefinition())
return true;
52 else if (trackDef == G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
55 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
56 G4ThreeVector startPos=aStep->GetPreStepPoint()->GetPosition();
57 G4ThreeVector endPos=aStep->GetPostStepPoint()->GetPosition();
58 double kinEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
62 std::string stationName=
"";
72 double globalTime = -1;
73 double energyDeposit= -1;
79 bool isAssembly =
false;
80 for (
int i = touchHist->GetHistoryDepth(); i>=0; --i) {
81 std::string::size_type npos;
82 std::string volName = touchHist->GetVolume(i)->GetName();
88 if ((npos = volName.find(
"av_")) != std::string::npos &&
89 (npos = volName.find(
"impr_")) != std::string::npos) isAssembly =
true;
91 if ((npos = volName.find(
"station")) != std::string::npos && (!isAssembly)) {
94 volName.resize(npos-2);
95 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
96 stationName = volName;
100 stationEta = (volCopyNo%1000)/100;
101 stationPhi = abs(volCopyNo%100);
103 }
else if ((npos = volName.find(
"CSC")) != std::string::npos && isAssembly ) {
121 std::string::size_type loc1,loc2;
122 if ((loc1 = volName.find(
"Muon::")) != std::string::npos) {
123 stationName = volName.substr(loc1+6,3);
127 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
128 int copyNrBase = int(volCopyNo/100000);
129 int sideC = int(copyNrBase/10000);
130 int zi = int((copyNrBase%1000)/100);
132 int fi = int(copyNrBase%100);
133 if (sideC == 1) zi = -zi;
139 if ((loc1 = volName.find(
'[')) != std::string::npos) {
140 if ((loc2 = volName.find(
']', loc1+1)) != std::string::npos) {
141 std::istringstream istrvar(volName.substr(loc1+1,loc2-loc1-1));
147 }
else if ((npos = volName.find(
"component")) != std::string::npos && (!isAssembly)) {
150 multiLayer = touchHist->GetVolume(i)->GetCopyNo();
151 if(multiLayer==3) multiLayer=2;
152 }
else if ((npos = volName.find(
"CscArCO2")) != std::string::npos) {
155 wireLayer=touchHist->GetVolume(i)->GetCopyNo();
157 if(wireLayer==4) wireLayer=1;
158 else if(wireLayer==3) wireLayer=2;
159 else if(wireLayer==2) wireLayer=3;
160 else if(wireLayer==1) wireLayer=4;
164 G4String particle=aStep->GetTrack()->GetDefinition()->GetParticleName();
166 if (particle==
"gamma") lundcode=1;
167 else if (particle==
"e+") lundcode=2;
168 else if (particle==
"e-") lundcode=3;
169 else if (particle==
"mu+") lundcode=5;
170 else if (particle==
"mu-") lundcode=6;
171 else if (particle==
"pi+") lundcode=8;
172 else if (particle==
"pi-") lundcode=9;
173 else if (particle==
"kaon+") lundcode=11;
174 else if (particle==
"kaon-") lundcode=12;
175 else if (particle==
"proton") lundcode=14;
176 else if (particle==
"anti_proton") lundcode=15;
177 else if (particle==
"sigma+") lundcode=19;
178 else if (particle==
"sigma-") lundcode=21;
179 else if (particle==
"anti_sigma-") lundcode=27;
180 else if (particle==
"anti_sigma+") lundcode=29;
181 else if (particle==
"deuteron") lundcode=45;
186 G4cout <<
"WP CSCSensitiveDetector.cxx have exceptional particlue out of selection:: "
187 << particle<< G4endl;
193 globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
196 energyDeposit = aStep->GetTotalEnergyDeposit();
199 const G4AffineTransform transform = touchHist->GetHistory()->GetTopTransform();
215 stationEta, multiLayer, wireLayer);
218 HitStart, HitEnd, lundcode,