ATLAS Offline Software
StepHistogram.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef G4DEBUGGINGTOOLS_StepHistogram_H
6 #define G4DEBUGGINGTOOLS_StepHistogram_H
7 
8 //C++
9 #include <map>
10 #include <string>
11 
12 //ROOT
13 #include "TH1.h"
14 #include "TH2.h"
15 
16 //G4
17 #include "G4UserEventAction.hh"
18 #include "G4UserSteppingAction.hh"
19 #include "G4UserRunAction.hh"
20 #include "G4String.hh"
21 
22 //Athena
25 
26 namespace G4UA{
27 
28  class StepHistogram : public AthMessaging,
29  public G4UserEventAction,
30  public G4UserRunAction,
31  public G4UserSteppingAction
32  {
33  public:
35  virtual void UserSteppingAction(const G4Step*) override;
36 
37  // maps to hold info per volume/process/material per particle type
38  typedef std::map<G4String, TH1*> HistoMap_t;
39  typedef std::map<G4String, HistoMap_t> HistoMapMap_t;
40 
42  struct Report
43  {
44  // distributions per volume per particle type
56 
57  // distributions per material per particle type
69 
70  // distributions per process per particle type
82 
83  // all atlas
90 
91  // 2D maps
97 
98  // rather complicated function that merges two maps
99  void mergeMaps(HistoMapMap_t &selfMap, const HistoMapMap_t& refMap);
100 
101  // function needed by ActionToolBaseReport base class
102  void merge(const Report & rep);
103  };
104 
105  // configurable properties
106  struct Config
107  {
108  bool do2DHistograms = false;
109  bool doGeneralHistograms = false;
110  };
111 
113  StepHistogram(const Config&);
114 
115  const Report& getReport() const { return m_report; }
116 
117  private:
118  // report
120 
123 
124  // initialize and fill histogram in a map
125  void InitializeFillHistogram2D(HistoMapMap_t &hMapMap, const char* suffix,
126  const G4String& pdgId, const G4String& vol,
127  int nbinsx, double xmin, double xmax,
128  int nbinsy, double ymin, double ymax,
129  double valuex, double valuey, double weight);
130 
131  void InitializeFillHistogram(HistoMapMap_t &hMapMap, const char* suffix,
132  const G4String& pdgId, const G4String& vol,
133  int nbins, double xmin, double xmax, double value, double weight);
134 
135  void InitializeFillHistogram(HistoMapMap_t &hMapMap, const char* suffix,
136  const G4String& pdgId, const G4String& vol,
137  int nbins, double *edges, double value, double weight);
138 
140  G4String m_initialVolume;
143  int m_trackID = 0;
144 
145  }; // class StepHistogram
146 
147 } // namespace G4UA
148 
149 #endif // G4DEBUGGINGTOOLS_StepHistogram_H
G4UA::StepHistogram::Report::histoMapMap_mat_stepSize
HistoMapMap_t histoMapMap_mat_stepSize
Definition: StepHistogram.h:58
G4UA::StepHistogram::Report::histoMapMap_mat_stepKineticEnergy
HistoMapMap_t histoMapMap_mat_stepKineticEnergy
Definition: StepHistogram.h:59
G4UA::StepHistogram::HistoMap_t
std::map< G4String, TH1 * > HistoMap_t
Definition: StepHistogram.h:38
G4UA::StepHistogram::Report
this holds all the data from individual threads that needs to be merged at EoR
Definition: StepHistogram.h:43
G4UA::StepHistogram::Report::histoMapMap_prc_numberOfStepsPerInitialE
HistoMapMap_t histoMapMap_prc_numberOfStepsPerInitialE
Definition: StepHistogram.h:79
ymin
double ymin
Definition: listroot.cxx:63
G4UA::StepHistogram::Report::histoMapMap_trackLengthPerInitialE
HistoMapMap_t histoMapMap_trackLengthPerInitialE
Definition: StepHistogram.h:86
G4UA::StepHistogram::Report::histoMapMap_prc_numberOfSteps
HistoMapMap_t histoMapMap_prc_numberOfSteps
Definition: StepHistogram.h:78
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
G4DebuggingHelper.h
G4UA::StepHistogram::m_initialMaterial
G4String m_initialMaterial
Definition: StepHistogram.h:141
G4UA::StepHistogram::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
the hooks for G4 UA handling
Definition: StepHistogram.cxx:35
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::StepHistogram::HistoMapMap_t
std::map< G4String, HistoMap_t > HistoMapMap_t
Definition: StepHistogram.h:39
G4UA::StepHistogram
Definition: StepHistogram.h:32
G4UA::StepHistogram::m_config
Config m_config
configuration data
Definition: StepHistogram.h:122
G4UA::StepHistogram::Report::histoMapMap_mat_numberOfSteps
HistoMapMap_t histoMapMap_mat_numberOfSteps
Definition: StepHistogram.h:65
make_hlt_rep.rep
rep
Definition: make_hlt_rep.py:32
G4UA::StepHistogram::Report::histoMapMap_mat_stepEnergyDeposit
HistoMapMap_t histoMapMap_mat_stepEnergyDeposit
Definition: StepHistogram.h:62
G4UA::StepHistogram::Report::histoMapMap_stepKinetic
HistoMapMap_t histoMapMap_stepKinetic
Definition: StepHistogram.h:88
G4UA::StepHistogram::Config::do2DHistograms
bool do2DHistograms
Definition: StepHistogram.h:108
G4UA::StepHistogram::Report::merge
void merge(const Report &rep)
Definition: StepHistogram.cxx:286
athena.value
value
Definition: athena.py:122
G4UA::StepHistogram::Report::histoMapMap_mat_numberOfStepsPerInitialE
HistoMapMap_t histoMapMap_mat_numberOfStepsPerInitialE
Definition: StepHistogram.h:66
G4UA::StepHistogram::m_trackID
int m_trackID
Definition: StepHistogram.h:143
G4UA::StepHistogram::Report::histoMapMap_vol_InitialE
HistoMapMap_t histoMapMap_vol_InitialE
Definition: StepHistogram.h:55
G4UA::StepHistogram::Report::histoMapMap_vol_postStepKineticEnergy
HistoMapMap_t histoMapMap_vol_postStepKineticEnergy
Definition: StepHistogram.h:47
G4UA::StepHistogram::StepHistogram
StepHistogram(const Config &)
ctor
Definition: StepHistogram.cxx:26
PowhegPy8EG_H2a.pdgId
dictionary pdgId
Definition: PowhegPy8EG_H2a.py:128
G4UA::StepHistogram::Report::histoMapMap_prc_trackLengthPerInitialE
HistoMapMap_t histoMapMap_prc_trackLengthPerInitialE
Definition: StepHistogram.h:80
G4UA::StepHistogram::Report::histoMapMap_vol_stepKineticEnergy
HistoMapMap_t histoMapMap_vol_stepKineticEnergy
Definition: StepHistogram.h:46
G4UA::StepHistogram::Report::histoMapMap_prc_stepEnergyDeposit
HistoMapMap_t histoMapMap_prc_stepEnergyDeposit
Definition: StepHistogram.h:75
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
G4UA::StepHistogram::Report::histoMapMap_vol_numberOfStepsPerInitialE
HistoMapMap_t histoMapMap_vol_numberOfStepsPerInitialE
Definition: StepHistogram.h:53
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
G4UA::StepHistogram::Report::histoMapMap_prc_postStepKineticEnergy
HistoMapMap_t histoMapMap_prc_postStepKineticEnergy
Definition: StepHistogram.h:73
G4UA::StepHistogram::Report::histoMapMap_vol_stepSecondaryKinetic
HistoMapMap_t histoMapMap_vol_stepSecondaryKinetic
Definition: StepHistogram.h:51
G4UA::StepHistogram::Report::histoMapMap_vol_stepEnergyDeposit
HistoMapMap_t histoMapMap_vol_stepEnergyDeposit
Definition: StepHistogram.h:49
G4UA::StepHistogram::Report::histoMapMap_vol_stepPseudorapidity
HistoMapMap_t histoMapMap_vol_stepPseudorapidity
Definition: StepHistogram.h:48
G4UA::StepHistogram::Report::histoMapMap_mat_InitialE
HistoMapMap_t histoMapMap_mat_InitialE
Definition: StepHistogram.h:68
xmin
double xmin
Definition: listroot.cxx:60
G4UA::StepHistogram::Report::histoMapMap_mat_trackLengthPerInitialE
HistoMapMap_t histoMapMap_mat_trackLengthPerInitialE
Definition: StepHistogram.h:67
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
G4UA::StepHistogram::Report::histoMapMap_postStepKinetic
HistoMapMap_t histoMapMap_postStepKinetic
Definition: StepHistogram.h:89
G4UA::StepHistogram::Report::histoMapMap2D_mat_RZ
HistoMapMap_t histoMapMap2D_mat_RZ
Definition: StepHistogram.h:93
G4UA::StepHistogram::Report::histoMapMap_vol_trackLengthPerInitialE
HistoMapMap_t histoMapMap_vol_trackLengthPerInitialE
Definition: StepHistogram.h:54
G4UA::StepHistogram::Config
Definition: StepHistogram.h:107
G4UA::StepHistogram::Report::histoMapMap2D_mat_RZ_E
HistoMapMap_t histoMapMap2D_mat_RZ_E
Definition: StepHistogram.h:96
G4UA::StepHistogram::Report::histoMapMap_prc_stepSecondaryKinetic
HistoMapMap_t histoMapMap_prc_stepSecondaryKinetic
Definition: StepHistogram.h:77
G4UA::StepHistogram::Report::histoMapMap_vol_stepEnergyNonIonDeposit
HistoMapMap_t histoMapMap_vol_stepEnergyNonIonDeposit
Definition: StepHistogram.h:50
G4UA::StepHistogram::Report::histoMapMap_mat_stepPseudorapidity
HistoMapMap_t histoMapMap_mat_stepPseudorapidity
Definition: StepHistogram.h:61
G4UA::StepHistogram::getReport
const Report & getReport() const
Definition: StepHistogram.h:115
G4UA::StepHistogram::Report::histoMapMap_prc_stepSize
HistoMapMap_t histoMapMap_prc_stepSize
Definition: StepHistogram.h:71
G4UA::StepHistogram::Report::histoMapMap_numberOfStepsPerInitialE
HistoMapMap_t histoMapMap_numberOfStepsPerInitialE
Definition: StepHistogram.h:85
G4UA::StepHistogram::Report::histoMapMap_prc_InitialE
HistoMapMap_t histoMapMap_prc_InitialE
Definition: StepHistogram.h:81
G4UA::StepHistogram::Report::mergeMaps
void mergeMaps(HistoMapMap_t &selfMap, const HistoMapMap_t &refMap)
Definition: StepHistogram.cxx:267
G4UA::StepHistogram::Report::histoMapMap_prc_stepKineticEnergy
HistoMapMap_t histoMapMap_prc_stepKineticEnergy
Definition: StepHistogram.h:72
G4UA::StepHistogram::Report::histoMapMap_vol_numberOfSteps
HistoMapMap_t histoMapMap_vol_numberOfSteps
Definition: StepHistogram.h:52
G4UA::StepHistogram::InitializeFillHistogram2D
void InitializeFillHistogram2D(HistoMapMap_t &hMapMap, const char *suffix, const G4String &pdgId, const G4String &vol, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double valuex, double valuey, double weight)
Definition: StepHistogram.cxx:220
G4UA::StepHistogram::Config::doGeneralHistograms
bool doGeneralHistograms
Definition: StepHistogram.h:109
AthMessaging.h
xmax
double xmax
Definition: listroot.cxx:61
G4UA::StepHistogram::m_initialVolume
G4String m_initialVolume
Definition: StepHistogram.h:140
G4UA::StepHistogram::Report::histoMapMap_numberOfSteps
HistoMapMap_t histoMapMap_numberOfSteps
Definition: StepHistogram.h:84
G4UA::StepHistogram::Report::histoMapMap2D_vol_RZ_E
HistoMapMap_t histoMapMap2D_vol_RZ_E
Definition: StepHistogram.h:95
G4UA::StepHistogram::m_report
Report m_report
Definition: StepHistogram.h:119
G4UA::StepHistogram::Report::histoMapMap2D_prc_RZ
HistoMapMap_t histoMapMap2D_prc_RZ
Definition: StepHistogram.h:94
G4UA::StepHistogram::Report::histoMapMap_vol_stepSize
HistoMapMap_t histoMapMap_vol_stepSize
Definition: StepHistogram.h:45
G4UA::StepHistogram::InitializeFillHistogram
void InitializeFillHistogram(HistoMapMap_t &hMapMap, const char *suffix, const G4String &pdgId, const G4String &vol, int nbins, double xmin, double xmax, double value, double weight)
Definition: StepHistogram.cxx:237
G4UA::StepHistogram::Report::histoMapMap_InitialE
HistoMapMap_t histoMapMap_InitialE
Definition: StepHistogram.h:87
G4UA::StepHistogram::Report::histoMapMap2D_vol_RZ
HistoMapMap_t histoMapMap2D_vol_RZ
Definition: StepHistogram.h:92
G4UA::StepHistogram::m_initialKineticEnergyOfStep
float m_initialKineticEnergyOfStep
Definition: StepHistogram.h:139
G4UA::StepHistogram::Report::histoMapMap_mat_stepEnergyNonIonDeposit
HistoMapMap_t histoMapMap_mat_stepEnergyNonIonDeposit
Definition: StepHistogram.h:63
G4UA::StepHistogram::Report::histoMapMap_prc_stepEnergyNonIonDeposit
HistoMapMap_t histoMapMap_prc_stepEnergyNonIonDeposit
Definition: StepHistogram.h:76
ymax
double ymax
Definition: listroot.cxx:64
G4UA::StepHistogram::m_initialProcess
G4String m_initialProcess
Definition: StepHistogram.h:142
G4UA::StepHistogram::Report::histoMapMap_prc_stepPseudorapidity
HistoMapMap_t histoMapMap_prc_stepPseudorapidity
Definition: StepHistogram.h:74
G4UA::StepHistogram::Report::histoMapMap_mat_stepSecondaryKinetic
HistoMapMap_t histoMapMap_mat_stepSecondaryKinetic
Definition: StepHistogram.h:64
G4UA::StepHistogram::Report::histoMapMap_mat_postStepKineticEnergy
HistoMapMap_t histoMapMap_mat_postStepKineticEnergy
Definition: StepHistogram.h:60