9 #include "G4ParticleDefinition.hh"
11 #include "G4StepPoint.hh"
12 #include "G4TouchableHistory.hh"
13 #include "G4ThreeVector.hh"
23 : G4VSensitiveDetector(
name ),
24 m_HitCollection(hitCollectionName),
25 m_ODHitCollection(ODhitCollectionName)
64 const G4StepPoint *pPreStepPoint(pStep->GetPreStepPoint());
65 const G4StepPoint *pPostStepPoint(pStep->GetPostStepPoint());
67 const double kineticEnergy(pPreStepPoint->GetKineticEnergy());
69 const G4ThreeVector preStepPoint(pPreStepPoint->GetPosition());
70 const G4ThreeVector postStepPoint(pPostStepPoint->GetPosition());
73 const G4String vol_name(pPreStepPoint->GetTouchableHandle()->GetVolume()->GetName());
75 const double preStepX(preStepPoint.x());
76 const double preStepY(preStepPoint.y());
77 const double preStepZ(preStepPoint.z());
79 const double postStepX(postStepPoint.x());
80 const double postStepY(postStepPoint.y());
81 const double postStepZ(postStepPoint.z());
90 const G4Track *pTrack(pStep->GetTrack());
91 const int particleEncoding(pTrack->GetDefinition()->GetPDGEncoding());
93 const double globalTime(pTrack->GetGlobalTime());
94 const int trackID(pTrack->GetTrackID());
96 std::string vol_test_str = vol_name.substr(0,7);
100 if(vol_name.find(
"GVS") != std::string::npos)
103 if(vol_name.find(
"B7L1") != std::string::npos) n_station=0;
104 else if(vol_name.find(
"A7L1") != std::string::npos) n_station=1;
105 else if(vol_name.find(
"A7R1") != std::string::npos) n_station=2;
106 else if(vol_name.find(
"B7R1") != std::string::npos) n_station=3;
111 (
float)
energyDeposit,(
float) preStepX, (
float) preStepY, (
float) preStepZ,
112 (
float) postStepX, (
float) postStepY, (
float) postStepZ,(
float) globalTime,
113 -1, 100, -1, (
int) n_station);
120 G4Exception(
"ALFA_SensitiveDetector",
"InvalidHitColl1", FatalException,
description);
125 if (vol_test_str.compare(
"ALFA_Fi") == 0)
127 if (std::abs(
energyDeposit)<std::numeric_limits<double>::epsilon()) {
return true; }
129 std::string substring (vol_name);
130 std::string num_string (vol_name);
135 std::string test_str (
"A");
136 test_str = substring.substr(
m_pos2,1);
138 if (test_str.compare(
"U") == 0)
144 if (test_str.compare(
"V") == 0)
151 for (
int k = 0;
k < 3;
k++ )
153 substring = substring.substr(
m_pos2+1);
161 std::istringstream is(num_string);
166 n_station =
m_num[0];
177 (
float) kineticEnergy,
179 (
float) preStepX, (
float) preStepY, (
float) preStepZ,
180 (
float) postStepX, (
float) postStepY, (
float) postStepZ,
182 (
int) sign_fiber, (
int) n_plate, (
int) n_fiber, (
int) n_station
190 G4Exception(
"ALFA_SensitiveDetector",
"InvalidHitColl2", FatalException,
description);
195 if (vol_test_str.compare(
"ODFiber") == 0)
197 if (std::abs(
energyDeposit)<std::numeric_limits<double>::epsilon()) {
return true; }
199 std::string substring (vol_name);
200 std::string num_string (vol_name);
205 std::string test_str = substring.substr(
m_pos2,1);
207 if (test_str.compare(
"U") == 0)
213 if (test_str.compare(
"V") == 0)
219 std::string test_str_side (
"A");
220 test_str_side = substring.substr(
m_pos2+1,1);
224 if (test_str_side.compare(
"0") == 0)
230 if (test_str_side.compare(
"1") == 0)
236 for (
int k = 0;
k < 3;
k++ )
238 substring = substring.substr(
m_pos2+1);
246 std::istringstream is(num_string);
251 n_station =
m_num[0];
261 (
float) kineticEnergy,
263 (
float) preStepX, (
float) preStepY, (
float) preStepZ,
264 (
float) postStepX, (
float) postStepY, (
float) postStepZ,
266 (
int) sign_fiber, (
int) OD_side, (
int) n_plate, (
int) n_fiber, (
int) n_station
274 G4Exception(
"ALFA_SensitiveDetector",
"InvalidHitColl3", FatalException,
description);
286 G4cout <<
" Total number of hits in MD: " <<
m_numberOfHits << G4endl;
288 G4cout <<
"*************************************************************" << G4endl;