10 #include "GaudiKernel/IDataProviderSvc.h"
11 #include "GaudiKernel/INTupleSvc.h"
12 #include "GaudiKernel/NTuple.h"
13 #include "GaudiKernel/SmartDataPtr.h"
14 #include "GaudiKernel/Bootstrap.h"
15 #include "GaudiKernel/ISvcLocator.h"
16 #include "GaudiKernel/IMessageSvc.h"
21 #include "G4StepPoint.hh"
22 #include "G4VProcess.hh"
31 AthMessaging(
Gaudi::svcLocator()->service<IMessageSvc>(
"MessageSvc"),
"StepHistogram"),
33 m_initialKineticEnergyOfStep(),
42 G4Track *tr = aStep->GetTrack();
45 G4StepPoint *PreStepPoint = aStep->GetPreStepPoint();
48 G4StepPoint *PostStepPoint = aStep->GetPostStepPoint();
51 double stepKinetic = PreStepPoint->GetKineticEnergy();
54 double postStepKinetic = PostStepPoint->GetKineticEnergy();
57 const G4ThreeVector& myPos = PreStepPoint->GetPosition();
61 if (!(tr->GetDefinition()->GetParticleType() ==
"nucleus"))
65 G4String volumeName = PreStepPoint->GetPhysicalVolume()->GetName();
69 G4String materialName = PreStepPoint->GetMaterial()->GetName();
73 G4String processName = PostStepPoint->GetProcessDefinedStep() ?
74 PostStepPoint->GetProcessDefinedStep()->GetProcessName() :
"Unknown";
77 const std::vector<const G4Track*>* secondaries = aStep->GetSecondaryInCurrentStep();
81 float DepositedE = aStep->GetTotalEnergyDeposit();
83 2000, -20000, 20000, 1000, 0, 5000, myPos.getZ(), myPos.perp(), 1.);
85 2000, -20000, 20000, 1000, 0, 5000, myPos.getZ(), myPos.perp(), 1.);
87 2000, -20000, 20000, 1000, 0, 5000, myPos.getZ(), myPos.perp(), 1.);
89 2000, -20000, 20000, 1000, 0, 5000, myPos.getZ(), myPos.perp(), DepositedE);
91 2000, -20000, 20000, 1000, 0, 5000, myPos.getZ(), myPos.perp(), DepositedE);
96 1000, -12, 4, std::log10(aStep->GetStepLength()), 1.);
98 1000, -12, 4, std::log10(aStep->GetStepLength()), 1.);
100 1000, -12, 4, std::log10(aStep->GetStepLength()), 1.);
104 200, -10, 10, myPos.eta(), 1.);
106 200, -10, 10, myPos.eta(), 1.);
108 200, -10, 10, myPos.eta(), 1.);
112 1000, -9, 7, std::log10(stepKinetic), 1.);
114 1000, -9, 7, std::log10(stepKinetic), 1.);
116 1000, -9, 7, std::log10(stepKinetic), 1.);
118 1000, -9, 7, std::log10(stepKinetic), 1.);
122 1000, -9, 7, std::log10(postStepKinetic), 1.);
124 1000, -9, 7, std::log10(postStepKinetic), 1.);
126 1000, -9, 7, std::log10(postStepKinetic), 1.);
128 1000, -9, 7, std::log10(postStepKinetic), 1.);
132 1000, -11, 3, std::log10(aStep->GetTotalEnergyDeposit()), 1.);
134 1000, -11, 3, std::log10(aStep->GetTotalEnergyDeposit()), 1.);
136 1000, -11, 3, std::log10(aStep->GetTotalEnergyDeposit()), 1.);
140 1000, -11, 1, std::log10(aStep->GetNonIonizingEnergyDeposit()), 1.);
142 1000, -11, 1, std::log10(aStep->GetNonIonizingEnergyDeposit()), 1.);
144 1000, -11, 1, std::log10(aStep->GetNonIonizingEnergyDeposit()), 1.);
147 for (
const auto &
track : *secondaries) {
150 1000, -7, 5, std::log10(
track->GetKineticEnergy()), 1.);
152 1000, -7, 5, std::log10(
track->GetKineticEnergy()), 1.);
154 1000, -7, 5, std::log10(
track->GetKineticEnergy()), 1.);
163 if (tr->GetCurrentStepNumber()==1) {
187 if ( tr->GetTrackStatus() == 2 ) {
189 if (not (tr->GetTrackID() ==
m_trackID)) {
190 ATH_MSG_ERROR(
"Track ID changed between the assumed first step and the last.");
194 int nSteps = tr->GetCurrentStepNumber() + 1;
196 10000, 0.5, 10000.5,
nSteps, 1.);
198 10000, 0.5, 10000.5,
nSteps, 1.);
200 10000, 0.5, 10000.5,
nSteps, 1.);
202 10000, 0.5, 10000.5,
nSteps, 1.);
214 1000, -9, 7, std::log10(tr->GetTrackLength()), 1.);
216 1000, -9, 7, std::log10(tr->GetTrackLength()), 1.);
218 1000, -9, 7, std::log10(tr->GetTrackLength()), 1.);
220 1000, -9, 7, std::log10(tr->GetTrackLength()), 1.);
226 int nbinsx,
double xmin,
double xmax,
227 int nbinsy,
double ymin,
double ymax,
228 double valuex,
double valuey,
double weight)
230 const auto& [pStringMapPair, inserted] = hMapMap.try_emplace(vol,
HistoMap_t());
234 std::ostringstream stringStream;
245 const auto& [pStringMapPair, inserted] = hMapMap.try_emplace(vol,
HistoMap_t());
249 std::ostringstream stringStream;
260 const auto& [pStringMapPair, inserted] = hMapMap.try_emplace(vol,
HistoMap_t());
264 std::ostringstream stringStream;
272 for (
auto const& [g4String, histoMap] : refMap){
273 const auto& [pStringMapPair, inserted] = selfMap.try_emplace(g4String, histoMap);
276 for (
auto const& hm : histoMap){
279 target.emplace(hm.first, hm.second);
283 target[hm.first]->Add(hm.second);
291 mergeMaps(histoMapMap_vol_stepSize,
rep.histoMapMap_vol_stepSize);
292 mergeMaps(histoMapMap_vol_stepKineticEnergy,
rep.histoMapMap_vol_stepKineticEnergy);
293 mergeMaps(histoMapMap_vol_postStepKineticEnergy,
rep.histoMapMap_vol_postStepKineticEnergy);
294 mergeMaps(histoMapMap_vol_stepPseudorapidity,
rep.histoMapMap_vol_stepPseudorapidity);
295 mergeMaps(histoMapMap_vol_stepEnergyDeposit,
rep.histoMapMap_vol_stepEnergyDeposit);
296 mergeMaps(histoMapMap_vol_stepEnergyNonIonDeposit,
rep.histoMapMap_vol_stepEnergyNonIonDeposit);
297 mergeMaps(histoMapMap_vol_stepSecondaryKinetic,
rep.histoMapMap_vol_stepSecondaryKinetic);
299 mergeMaps(histoMapMap_mat_stepSize,
rep.histoMapMap_mat_stepSize);
300 mergeMaps(histoMapMap_mat_stepKineticEnergy,
rep.histoMapMap_mat_stepKineticEnergy);
301 mergeMaps(histoMapMap_mat_postStepKineticEnergy,
rep.histoMapMap_mat_postStepKineticEnergy);
302 mergeMaps(histoMapMap_mat_stepPseudorapidity,
rep.histoMapMap_mat_stepPseudorapidity);
303 mergeMaps(histoMapMap_mat_stepEnergyDeposit,
rep.histoMapMap_mat_stepEnergyDeposit);
304 mergeMaps(histoMapMap_mat_stepEnergyNonIonDeposit,
rep.histoMapMap_mat_stepEnergyNonIonDeposit);
305 mergeMaps(histoMapMap_mat_stepSecondaryKinetic,
rep.histoMapMap_mat_stepSecondaryKinetic);
307 mergeMaps(histoMapMap_prc_stepSize,
rep.histoMapMap_prc_stepSize);
308 mergeMaps(histoMapMap_prc_stepKineticEnergy,
rep.histoMapMap_prc_stepKineticEnergy);
309 mergeMaps(histoMapMap_prc_postStepKineticEnergy,
rep.histoMapMap_prc_postStepKineticEnergy);
310 mergeMaps(histoMapMap_prc_stepPseudorapidity,
rep.histoMapMap_prc_stepPseudorapidity);
311 mergeMaps(histoMapMap_prc_stepEnergyDeposit,
rep.histoMapMap_prc_stepEnergyDeposit);
312 mergeMaps(histoMapMap_prc_stepEnergyNonIonDeposit,
rep.histoMapMap_prc_stepEnergyNonIonDeposit);
313 mergeMaps(histoMapMap_prc_stepSecondaryKinetic,
rep.histoMapMap_prc_stepSecondaryKinetic);
315 mergeMaps(histoMapMap_numberOfSteps,
rep.histoMapMap_numberOfSteps);
316 mergeMaps(histoMapMap_vol_numberOfSteps,
rep.histoMapMap_vol_numberOfSteps);
317 mergeMaps(histoMapMap_mat_numberOfSteps,
rep.histoMapMap_mat_numberOfSteps);
318 mergeMaps(histoMapMap_prc_numberOfSteps,
rep.histoMapMap_prc_numberOfSteps);
319 mergeMaps(histoMapMap_numberOfStepsPerInitialE,
rep.histoMapMap_numberOfStepsPerInitialE);
320 mergeMaps(histoMapMap_vol_numberOfStepsPerInitialE,
rep.histoMapMap_vol_numberOfStepsPerInitialE);
321 mergeMaps(histoMapMap_mat_numberOfStepsPerInitialE,
rep.histoMapMap_mat_numberOfStepsPerInitialE);
322 mergeMaps(histoMapMap_prc_numberOfStepsPerInitialE,
rep.histoMapMap_prc_numberOfStepsPerInitialE);
323 mergeMaps(histoMapMap_trackLengthPerInitialE,
rep.histoMapMap_trackLengthPerInitialE);
324 mergeMaps(histoMapMap_vol_trackLengthPerInitialE,
rep.histoMapMap_vol_trackLengthPerInitialE);
325 mergeMaps(histoMapMap_mat_trackLengthPerInitialE,
rep.histoMapMap_mat_trackLengthPerInitialE);
326 mergeMaps(histoMapMap_prc_trackLengthPerInitialE,
rep.histoMapMap_prc_trackLengthPerInitialE);
327 mergeMaps(histoMapMap_InitialE,
rep.histoMapMap_InitialE);
328 mergeMaps(histoMapMap_vol_InitialE,
rep.histoMapMap_vol_InitialE);
329 mergeMaps(histoMapMap_mat_InitialE,
rep.histoMapMap_mat_InitialE);
330 mergeMaps(histoMapMap_prc_InitialE,
rep.histoMapMap_prc_InitialE);
331 mergeMaps(histoMapMap_stepKinetic,
rep.histoMapMap_stepKinetic);
332 mergeMaps(histoMapMap_postStepKinetic,
rep.histoMapMap_postStepKinetic);
334 mergeMaps(histoMapMap2D_vol_RZ,
rep.histoMapMap2D_vol_RZ);
335 mergeMaps(histoMapMap2D_mat_RZ,
rep.histoMapMap2D_mat_RZ);
336 mergeMaps(histoMapMap2D_prc_RZ,
rep.histoMapMap2D_prc_RZ);
337 mergeMaps(histoMapMap2D_vol_RZ_E,
rep.histoMapMap2D_vol_RZ_E);
338 mergeMaps(histoMapMap2D_mat_RZ_E,
rep.histoMapMap2D_mat_RZ_E);