ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaBaseComps
src
AthHistogramAlgorithm.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5
*/
6
11
12
// This class' header file
13
#include "
AthenaBaseComps/AthHistogramAlgorithm.h
"
14
15
// STL includes
16
#include <string>
17
#include <map>
18
19
// Framework includes
20
#include "Gaudi/Property.h"
21
#include "GaudiKernel/ITHistSvc.h"
22
23
24
26
// Public methods:
28
29
// Constructors
31
AthHistogramAlgorithm::AthHistogramAlgorithm
(
const
std::string& name,
32
ISvcLocator* pSvcLocator ) :
33
::
AthAlgorithm
( name, pSvcLocator ),
34
::
AthHistogramming
( name ),
35
m_histSvc
(
"THistSvc/THistSvc"
, name )
36
{
37
//
38
// Property declaration
39
//
40
// The histogram service
41
declareProperty
(
"THistSvc"
,
42
m_histSvc
=
ServiceHandle<ITHistSvc>
(
"THistSvc/THistSvc"
, name),
43
"Handle to a THistSvc instance: it will be used to write "
44
"ROOT objects to ROOT files"
);
45
// declareProperty("THistService", m_histSvc, "The THistSvc" );
46
47
declareProperty
(
"RootStreamName"
,
m_prefix
=
"/ANALYSIS"
,
"Name of the output ROOT stream (file) that the THistSvc uses"
);
48
declareProperty
(
"RootDirName"
,
m_rootDir
=
""
,
49
"Name of the ROOT directory inside the ROOT file where the histograms will go"
);
50
51
declareProperty
(
"HistNamePrefix"
,
m_histNamePrefix
=
""
,
"The prefix for the histogram THx name"
);
52
declareProperty
(
"HistNamePostfix"
,
m_histNamePostfix
=
""
,
"The postfix for the histogram THx name"
);
53
54
declareProperty
(
"HistTitlePrefix"
,
m_histTitlePrefix
=
""
,
"The prefix for the histogram THx title"
);
55
declareProperty
(
"HistTitlePostfix"
,
m_histTitlePostfix
=
""
,
"The postfix for the histogram THx title"
);
56
}
57
58
59
60
61
// Destructor
63
AthHistogramAlgorithm::~AthHistogramAlgorithm
()
64
{
65
ATH_MSG_DEBUG
(
"Calling destructor"
);
66
}
67
68
69
75
StatusCode
AthHistogramAlgorithm::sysInitialize
()
76
{
77
// ---- stolen from GaudiKernel/Algorithm::sysInitialize -------
78
// Bypass the initialization if the algorithm
79
// has already been initialized.
80
if
( Gaudi::StateMachine::INITIALIZED <= FSMState() )
return
StatusCode::SUCCESS;
81
82
// Set the Algorithm's properties
83
bindPropertiesTo( serviceLocator()->getOptsSvc() );
84
85
// Bypass the initialization if the algorithm is disabled.
86
// Need to do this after bindPropertiesTo.
87
if
( !isEnabled( ) )
return
StatusCode::SUCCESS;
88
89
// ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END ---
90
91
92
// Get the THistSvc
93
ATH_CHECK
(
histSvc
().retrieve() );
94
95
// Configure the underlying AthHistogramming helper
96
ATH_CHECK
(
AthHistogramming::configAthHistogramming
(
m_histSvc
,
97
m_prefix
,
m_rootDir
,
98
m_histNamePrefix
,
m_histNamePostfix
,
99
m_histTitlePrefix
,
m_histTitlePostfix
) );
100
101
// Print some setup information into the log file
102
ATH_MSG_DEBUG
(
"Initializing "
<< name() <<
"..."
);
103
ATH_MSG_DEBUG
(
" using THistService = "
<<
m_histSvc
);
104
ATH_MSG_DEBUG
(
" using RootStreamName = "
<<
m_prefix
);
105
ATH_MSG_DEBUG
(
" using RootDirName = "
<<
m_rootDir
);
106
ATH_MSG_DEBUG
(
" using HistNamePrefix = "
<<
m_histNamePrefix
);
107
ATH_MSG_DEBUG
(
" using HistNamePostfix = "
<<
m_histNamePostfix
);
108
ATH_MSG_DEBUG
(
" using HistTitlePrefix = "
<<
m_histTitlePrefix
);
109
ATH_MSG_DEBUG
(
" using HistTitlePostfix = "
<<
m_histTitlePostfix
);
110
111
112
// re-direct to base class...
113
return
AthAlgorithm::sysInitialize
();
114
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthHistogramAlgorithm.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize
virtual StatusCode sysInitialize() override
Definition
AthCommonAlgorithm.cxx:71
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthHistogramAlgorithm::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition
AthHistogramAlgorithm.h:113
AthHistogramAlgorithm::m_histNamePrefix
std::string m_histNamePrefix
The prefix for the histogram THx name.
Definition
AthHistogramAlgorithm.h:94
AthHistogramAlgorithm::sysInitialize
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Definition
AthHistogramAlgorithm.cxx:75
AthHistogramAlgorithm::~AthHistogramAlgorithm
virtual ~AthHistogramAlgorithm()
Destructor:
Definition
AthHistogramAlgorithm.cxx:63
AthHistogramAlgorithm::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Default constructor: AthHistogramAlgorithm();.
Definition
AthHistogramAlgorithm.h:83
AthHistogramAlgorithm::m_prefix
std::string m_prefix
Name of the ROOT output stream (file).
Definition
AthHistogramAlgorithm.h:88
AthHistogramAlgorithm::m_histNamePostfix
std::string m_histNamePostfix
The postfix for the histogram THx name.
Definition
AthHistogramAlgorithm.h:97
AthHistogramAlgorithm::m_histTitlePostfix
std::string m_histTitlePostfix
The postfix for the histogram THx title.
Definition
AthHistogramAlgorithm.h:103
AthHistogramAlgorithm::m_rootDir
std::string m_rootDir
Name of the ROOT directory.
Definition
AthHistogramAlgorithm.h:91
AthHistogramAlgorithm::m_histTitlePrefix
std::string m_histTitlePrefix
The prefix for the histogram THx title.
Definition
AthHistogramAlgorithm.h:100
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition
AthHistogramAlgorithm.cxx:31
AthHistogramming::AthHistogramming
AthHistogramming(const std::string &name)
Constructor with parameters:
Definition
AthHistogramming.cxx:26
AthHistogramming::configAthHistogramming
StatusCode configAthHistogramming(const ServiceHandle< ITHistSvc > &histSvc, const std::string &prefix, const std::string &rootDir, const std::string &histNamePrefix, const std::string &histNamePostfix, const std::string &histTitlePrefix, const std::string &histTitlePostfix)
To be called by the derived classes to fill the internal configuration.
Definition
AthHistogramming.cxx:51
ServiceHandle
Definition
ClusterMakerTool.h:36
Generated on
for ATLAS Offline Software by
1.17.0