11 #include "G4AffineTransform.hh"
12 #include "G4TouchableHistory.hh"
13 #include "G4ThreeVector.hh"
14 #include "G4VSolid.hh"
28 m_evtStore(
"StoreGateSvc/StoreGateSvc",
"TestActionShowerLib"),
29 m_current_calculator(
"",
"TestActionShowerLib"),
30 m_current_solid(nullptr),
31 m_current_transform(nullptr),
32 m_calculator_EMECIW(
"EMECPosInnerWheelCalculator",
"TestActionShowerLib"),
33 m_calculator_EMECOW(
"EMECPosOuterWheelCalculator",
"TestActionShowerLib"),
34 m_calculator_FCAL1(
"FCAL1Calculator",
"TestActionShowerLib"),
35 m_calculator_FCAL2(
"FCAL2Calculator",
"TestActionShowerLib"),
36 m_calculator_FCAL3(
"FCAL3Calculator",
"TestActionShowerLib"),
37 m_calculator_EMB(
"EMBCalculator",
"TestActionShowerLib"),
41 G4cout <<
"#########################################" << G4endl
42 <<
"## TestActionShowerLib - Constructor ##" << G4endl
43 <<
"#########################################" << G4endl;
56 G4cout <<
"#########################################" << G4endl
57 <<
"## TestActionShowerLib - BeginOfEvent ##" << G4endl
58 <<
"#########################################" << G4endl;
65 G4cout <<
"#########################################" << G4endl
66 <<
"## TestActionShowerLib - EndOfEvent ##" << G4endl
68 <<
"#########################################" << G4endl;
76 const double dsame = 1.;
79 G4cout <<
"TestActionShowerLib::EndOfEventAction: Before initial cleanup, N="
89 if ( (i1 != i2) && ((*i1)->diff2(**i2) < dsame)) {
101 G4cout <<
"TestActionShowerLib::EndOfEventAction: After initial cleanup, N="
108 std::string location(
"EventSteps");
110 if(
sc.isFailure() ) {
111 G4cout <<
"TestActionShowerLib::EndOfEventAction Error: Couldn't store "
112 <<
"EventSteps object in event store at location: " << location << G4endl;
115 G4cout <<
"TestActionShowerLib::EndOfEventAction: Stored EventSteps "
117 <<
" in event store at location: " << location << G4endl;
125 G4cout <<
"#########################################" << G4endl
126 <<
"## TestActionShowerLib - BeginOfRun ##" << G4endl
127 <<
"#########################################" << G4endl;
131 G4cout<<
"Could not get ILArCalculatorSvc/InnerAbsorberWheel"<<G4endl;
135 G4cout<<
"Could not get ILArCalculatorSvc/OuterAbsorberWheel"<<G4endl;
139 G4cout<<
"Could not get ILArCalculatorSvc/FCAL1Calculator"<<G4endl;
143 G4cout<<
"Could not get ILArCalculatorSvc/FCAL2Calculator"<<G4endl;
147 G4cout<<
"Could not get ILArCalculatorSvc/FCAL3Calculator"<<G4endl;
151 G4cout<<
"Could not get ILArCalculatorSvc/BarrelCalculator"<<G4endl;
163 G4cout <<
"#########################################" << G4endl
164 <<
"## TestActionShowerLib - EndOfRun ##" << G4endl
165 <<
"#########################################" << G4endl;
175 G4ThreeVector
pos = aStep->GetPostStepPoint()->GetPosition();
176 const G4TouchableHistory* theTouchable =
static_cast<const G4TouchableHistory*
>(aStep->GetPostStepPoint()->GetTouchable());
177 int depth = theTouchable->GetHistoryDepth();
178 bool correct_volume =
false;
180 correct_volume =
true;
182 G4VPhysicalVolume* rootVol = theTouchable->GetVolume(
depth - 1);
187 G4VPhysicalVolume* cur_volume = theTouchable->GetVolume(curdepth);
188 G4LogicalVolume* cur_log_volume = cur_volume->GetLogicalVolume();
191 if ((cur_log_volume->GetName() ==
"LArMgr::LAr::FCAL::Module1::Absorber") ||
192 (cur_log_volume->GetName() ==
"LArMgr::LAr::FCAL::Module2::Absorber") ||
193 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Pos::OuterWheel") ||
194 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Neg::OuterWheel") ||
195 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Pos::InnerWheel") ||
196 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Neg::InnerWheel") ||
197 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMB::STAC")) {
198 correct_volume =
true;
200 if (!correct_volume) {
204 cur_volume = theTouchable->GetVolume(curdepth);
205 cur_log_volume = cur_volume->GetLogicalVolume();
207 }
while ((!correct_volume) && (cur_volume != rootVol) && (curdepth < (
depth-1)));
211 if (cur_log_volume->GetName() ==
"LArMgr::LAr::FCAL::Module1::Absorber") {
215 }
else if (cur_log_volume->GetName() ==
"LArMgr::LAr::FCAL::Module2::Absorber") {
219 }
else if ((cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Pos::InnerWheel") ||
220 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Neg::InnerWheel")) {
224 }
else if ((cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Pos::OuterWheel") ||
225 (cur_log_volume->GetName() ==
"LArMgr::LAr::EMEC::Neg::OuterWheel")) {
229 }
else if (cur_log_volume->GetName() ==
"LArMgr::LAr::EMB::STAC") {
240 if (aStep->GetTotalEnergyDeposit()>0) {
249 G4ThreeVector pos1=aStep->GetPreStepPoint()->GetPosition();
250 G4ThreeVector pos2=aStep->GetPostStepPoint()->GetPosition();
253 G4ThreeVector
pos = 0.5*(pos1+pos2);
255 G4ThreeVector prepos = pos1;
262 G4VPhysicalVolume* pCurrentVolume = aStep->GetPreStepPoint()->GetPhysicalVolume();
263 if (!pCurrentVolume->GetLogicalVolume()->GetSensitiveDetector()){
268 std::vector<LArHitData>
results;
271 for (
const auto& larhit:
results)
278 G4cout <<
"Error: Hit not processed by calculator!" << G4endl;
292 G4cout<<
" TAGINFO: "<<
et <<
" "<<aStep->GetTotalEnergyDeposit()<< G4endl;
295 theInfo->
setTime(aStep->GetPreStepPoint()->GetGlobalTime());
303 G4cout <<
"DEBUG: step " << aStep->GetTotalEnergyDeposit() << G4endl;