ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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 More...
 
virtual StatusCode initialize () override
 return the event action More...
 
virtual StatusCode finalize () override
 
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists. More...
 

Protected Member Functions

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

Protected Attributes

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

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  }

Member Function Documentation

◆ 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  }

◆ fillUserAction()

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

Fill the user action lists.

Definition at line 45 of file UserActionToolBase.h.

46  {
47  auto myAction = makeAndFillAction(actionLists);
48  if(myAction == nullptr) {
49  ATH_MSG_ERROR( "Failed to construct user action in " << name() );
50  return StatusCode::FAILURE;
51  }
52  m_actions.set( std::move(myAction) );
53  return StatusCode::SUCCESS;
54  }

◆ 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;
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 
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  }

◆ 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  }

◆ 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  }

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 63 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:
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4UA::ThreadSpecificUserAction::set
void set(std::unique_ptr< ActionType > action)
Assign the object of the current thread.
Definition: ThreadSpecificUserAction.h:61
G4UA::StepHistogram::Config::do2DHistograms
bool do2DHistograms
Definition: StepHistogram.h:108
checkTP.report
report
Definition: checkTP.py:127
G4UA::StepHistogram::Report::merge
void merge(const Report &rep)
Definition: StepHistogram.cxx:286
G4UA::ThreadSpecificUserAction::accumulate
void accumulate(ResultType &result, Mapper mapOp, Reducer reduceOp)
Accumulate results across user actions with specified operations.
Definition: ThreadSpecificUserAction.h:88
x
#define x
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
G4UA::UserActionToolBase< StepHistogram >::m_actions
ThreadSpecificUserAction< StepHistogram > m_actions
Thread-specific storage of the user action.
Definition: UserActionToolBase.h:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
G4UA::StepHistogramTool::m_config
StepHistogram::Config m_config
Definition: StepHistogramTool.h:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
G4UA::UserActionToolBase< StepHistogram >::makeAndFillAction
virtual std::unique_ptr< StepHistogram > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
G4UA::StepHistogram::getReport
const Report & getReport() const
Definition: StepHistogram.h:115
G4UA::StepHistogramTool::BookHistograms
void BookHistograms(StepHistogram::HistoMapMap_t &hMap, const char *suffix, const char *subfolder="")
Definition: StepHistogramTool.cxx:36
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
G4UA::StepHistogram::Config::doGeneralHistograms
bool doGeneralHistograms
Definition: StepHistogram.h:109
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
G4UA::StepHistogramTool::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: StepHistogramTool.h:44