ATLAS Offline Software
Loading...
Searching...
No Matches
G4UA::StepHistogramTool Class Reference

Tool which manages the StepHistogram action. More...

#include <StepHistogramTool.h>

Inheritance diagram for G4UA::StepHistogramTool:
Collaboration diagram for G4UA::StepHistogramTool:

Public Member Functions

 StepHistogramTool (const std::string &type, const std::string &name, const IInterface *parent)
 standard tool ctor
virtual StatusCode initialize () override
 return the event action
virtual StatusCode finalize () override
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists.
StatusCode BeginOfAthenaEvent (HitCollectionMap &) override
 Calls BeginOfAthenaEvent.
StatusCode EndOfAthenaEvent (HitCollectionMap &) override
 Calls EndOfAthenaEvent.

Protected Member Functions

virtual std::unique_ptr< StepHistogrammakeAndFillAction (G4AtlasUserActions &) override final
 Create action for this thread.

Protected Attributes

ThreadSpecificUserAction< StepHistogramm_actions
 Thread-specific storage of the user action.

Private Member Functions

void BookHistograms (StepHistogram::HistoMapMap_t &hMap, const char *suffix, const char *subfolder="")

Private Attributes

StepHistogram::Config m_config
ServiceHandle< ITHistSvc > m_histSvc

Detailed Description

Tool which manages the StepHistogram action.

Create the StepHistogram for each worker thread

Author
Miha Muskinja

Definition at line 23 of file StepHistogramTool.h.

Constructor & Destructor Documentation

◆ StepHistogramTool()

G4UA::StepHistogramTool::StepHistogramTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

standard tool ctor

Definition at line 9 of file StepHistogramTool.cxx.

11 :
12 UserActionToolBase<StepHistogram>(type, name, parent),
13 m_config(),
14 m_histSvc("THistSvc", name){
15
16 declareProperty("do2DHistograms", m_config.do2DHistograms);
17 declareProperty("doGeneralHistograms", m_config.doGeneralHistograms);
18 }
StepHistogram::Config m_config
ServiceHandle< ITHistSvc > m_histSvc
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< StepHistogram >::BeginOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls BeginOfAthenaEvent.

Definition at line 59 of file UserActionToolBase.h.

59{return StatusCode::SUCCESS;};
abstract template utility base-class for G4 user-action tools.

◆ BookHistograms()

void G4UA::StepHistogramTool::BookHistograms ( StepHistogram::HistoMapMap_t & hMap,
const char * suffix,
const char * subfolder = "" )
private

Definition at line 36 of file StepHistogramTool.cxx.

37 {
38 for (auto const& x : hMap)
39 {
40 ATH_MSG_INFO("Currently in volume:\t" << x.first << " got histoMap " << x.second);
41 for (auto const& hm : x.second)
42 {
43 ATH_MSG_INFO("Registering histogram:\t" << hm.first);
44 std::ostringstream stringStream;
45 stringStream << "/stepHisto/" << subfolder << x.first << "/" << suffix << hm.first;
46 if ( m_histSvc->regHist(stringStream.str().c_str(), hm.second).isFailure() ) {
47 ATH_MSG_ERROR("Could not register histogram!");
48 }
49 }
50 }
51 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define x

◆ EndOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< StepHistogram >::EndOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls EndOfAthenaEvent.

Definition at line 61 of file UserActionToolBase.h.

61{return StatusCode::SUCCESS;};

◆ fillUserAction()

virtual StatusCode G4UA::UserActionToolBase< StepHistogram >::fillUserAction ( G4AtlasUserActions & actionLists)
inlinefinaloverridevirtualinherited

Fill the user action lists.

Definition at line 47 of file UserActionToolBase.h.

48 {
50 if(myAction == nullptr) {
51 ATH_MSG_ERROR( "Failed to construct user action in " << name() );
53 }
56 }
virtual std::unique_ptr< StepHistogram > makeAndFillAction(G4AtlasUserActions &actionLists)=0

◆ finalize()

StatusCode G4UA::StepHistogramTool::finalize ( )
overridevirtual

Definition at line 53 of file StepHistogramTool.cxx.

53 {
54 ATH_MSG_INFO("Preparing histograms...");
55
56 // Accumulate results across threads
57 StepHistogram::Report report;
58 m_actions.accumulate(report, &StepHistogram::getReport,
60
61 if (m_histSvc) {
62 BookHistograms(report.histoMapMap_vol_stepSize, "stepLength/", "volumes/");
63 BookHistograms(report.histoMapMap_vol_stepKineticEnergy, "stepKineticEnergy/", "volumes/");
64 BookHistograms(report.histoMapMap_vol_postStepKineticEnergy, "postStepKineticEnergy/", "volumes/");
65 BookHistograms(report.histoMapMap_vol_stepPseudorapidity, "stepPseudorapidity/", "volumes/");
66 BookHistograms(report.histoMapMap_vol_stepEnergyDeposit, "stepEnergyDeposit/", "volumes/");
67 BookHistograms(report.histoMapMap_vol_stepEnergyNonIonDeposit, "stepEnergyNonIonDeposit/", "volumes/");
68 BookHistograms(report.histoMapMap_vol_stepSecondaryKinetic, "stepSecondaryKinetic/", "volumes/");
69 BookHistograms(report.histoMapMap_vol_trackLengthPerInitialE, "trackLengthPerInitialE/", "volumes/");
70 BookHistograms(report.histoMapMap_vol_InitialE, "InitialE/", "volumes/");
71 BookHistograms(report.histoMapMap_vol_numberOfSteps, "numberOfSteps/", "volumes/");
72 BookHistograms(report.histoMapMap_vol_numberOfStepsPerInitialE, "numberOfStepsPerInitialE/", "volumes/");
73
74 BookHistograms(report.histoMapMap_mat_stepSize, "stepLength/", "materials/");
75 BookHistograms(report.histoMapMap_mat_stepKineticEnergy, "stepKineticEnergy/", "materials/");
76 BookHistograms(report.histoMapMap_mat_stepPseudorapidity, "stepPseudorapidity/", "materials/");
77 BookHistograms(report.histoMapMap_mat_postStepKineticEnergy, "postStepKineticEnergy/", "materials/");
78 BookHistograms(report.histoMapMap_mat_stepEnergyDeposit, "stepEnergyDeposit/", "materials/");
79 BookHistograms(report.histoMapMap_mat_stepEnergyNonIonDeposit, "stepEnergyNonIonDeposit/", "materials/");
80 BookHistograms(report.histoMapMap_mat_stepSecondaryKinetic, "stepSecondaryKinetic/", "materials/");
81 BookHistograms(report.histoMapMap_mat_trackLengthPerInitialE, "trackLengthPerInitialE/", "materials/");
82 BookHistograms(report.histoMapMap_mat_InitialE, "InitialE/", "materials/");
83 BookHistograms(report.histoMapMap_mat_numberOfSteps, "numberOfSteps/", "materials/");
84 BookHistograms(report.histoMapMap_mat_numberOfStepsPerInitialE, "numberOfStepsPerInitialE/", "materials/");
85
86 BookHistograms(report.histoMapMap_prc_stepSize, "stepLength/", "processes/");
87 BookHistograms(report.histoMapMap_prc_stepKineticEnergy, "stepKineticEnergy/", "processes/");
88 BookHistograms(report.histoMapMap_prc_stepPseudorapidity, "stepPseudorapidity/", "processes/");
89 BookHistograms(report.histoMapMap_prc_postStepKineticEnergy, "postStepKineticEnergy/", "processes/");
90 BookHistograms(report.histoMapMap_prc_stepEnergyDeposit, "stepEnergyDeposit/", "processes/");
91 BookHistograms(report.histoMapMap_prc_stepEnergyNonIonDeposit, "stepEnergyNonIonDeposit/", "processes/");
92 BookHistograms(report.histoMapMap_prc_stepSecondaryKinetic, "stepSecondaryKinetic/", "processes/");
93 BookHistograms(report.histoMapMap_prc_trackLengthPerInitialE, "trackLengthPerInitialE/", "processes/");
94 BookHistograms(report.histoMapMap_prc_InitialE, "InitialE/", "processes/");
95 BookHistograms(report.histoMapMap_prc_numberOfSteps, "numberOfSteps/", "processes/");
96 BookHistograms(report.histoMapMap_prc_numberOfStepsPerInitialE, "numberOfStepsPerInitialE/", "processes/");
97
98 if (m_config.doGeneralHistograms) {
99 BookHistograms(report.histoMapMap_numberOfSteps, "numberOfSteps/", "nSteps/");
100 BookHistograms(report.histoMapMap_numberOfStepsPerInitialE, "numberOfStepsPerInitialE/", "nSteps/");
101 BookHistograms(report.histoMapMap_trackLengthPerInitialE, "trackLengthPerInitialE/", "nSteps/");
102 BookHistograms(report.histoMapMap_InitialE, "InitialE/", "nSteps/");
103 BookHistograms(report.histoMapMap_stepKinetic, "stepKineticEnergy/", "nSteps/");
104 BookHistograms(report.histoMapMap_postStepKinetic, "postStepKineticEnergy/", "nSteps/");
105 }
106
107 if (m_config.do2DHistograms) {
108 BookHistograms(report.histoMapMap2D_vol_RZ, "2DMaps/", "volumes/");
109 BookHistograms(report.histoMapMap2D_mat_RZ, "2DMaps/", "materials/");
110 BookHistograms(report.histoMapMap2D_prc_RZ, "2DMaps/", "processes/");
111 BookHistograms(report.histoMapMap2D_vol_RZ_E, "2DMaps_E/", "volumes/");
112 BookHistograms(report.histoMapMap2D_mat_RZ_E, "2DMaps_E/", "materials/");
113 }
114 }
115 else {
116 ATH_MSG_WARNING("HistSvc not initialized...");
117 }
118
119 return StatusCode::SUCCESS;
120 }
#define ATH_MSG_WARNING(x)
void BookHistograms(StepHistogram::HistoMapMap_t &hMap, const char *suffix, const char *subfolder="")
const Report & getReport() const
ThreadSpecificUserAction< StepHistogram > m_actions
list report
Definition checkTP.py:125
void merge(const Report &rep)

◆ initialize()

StatusCode G4UA::StepHistogramTool::initialize ( )
overridevirtual

return the event action

Definition at line 31 of file StepHistogramTool.cxx.

31 {
32 ATH_CHECK(m_histSvc.retrieve());
33 return StatusCode::SUCCESS;
34 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ makeAndFillAction()

std::unique_ptr< StepHistogram > G4UA::StepHistogramTool::makeAndFillAction ( G4AtlasUserActions & actionList)
finaloverrideprotectedvirtual

Create action for this thread.

Implements G4UA::UserActionToolBase< StepHistogram >.

Definition at line 21 of file StepHistogramTool.cxx.

22 {
23 ATH_MSG_DEBUG("Constructing a TestActionTimer");
24 auto action = std::make_unique<StepHistogram>(m_config);
25 actionList.runActions.push_back( action.get() );
26 actionList.eventActions.push_back( action.get() );
27 actionList.steppingActions.push_back( action.get() );
28 return action;
29 }
#define ATH_MSG_DEBUG(x)

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 70 of file UserActionToolBase.h.

◆ m_config

StepHistogram::Config G4UA::StepHistogramTool::m_config
private

Definition at line 42 of file StepHistogramTool.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> G4UA::StepHistogramTool::m_histSvc
private

Definition at line 44 of file StepHistogramTool.h.


The documentation for this class was generated from the following files: