#include <AthHistogramAlgorithm.h>
Inherits AthAlgorithm, and AthHistogramming.
Inherited by AFPHitAnalysis, ALFAHitAnalysis, ActsTrk::ActsMuonTrackingGeometryTest, ActsTrk::MaterialTrackWriter, ActsTrk::ReadoutGeoDumpAlg, AthAnalysisAlgorithm, BCM_RDOAnalysis, CP::MuonScaleFactorTestAlg, CP::TestIsolationCloseByCorrAlg, CaloHitAnalysis, EFTrackingSmearMonAlg, EFTrackingSmearingAlg, EL::AnaAlgorithm, EventInfoRDOAnalysis, HGTD_RDOAnalysis, ITk::PixelRDOAnalysis, InDet::InDetTrackBiasingToolTester, InDet::InDetTrackSmearingToolTester, InDetGNNHardScatterSelection::VertexDecoratorAlg, L1CaloDumpRampData, LArRDOAnalysis, LucidHitAnalysis, MDTHitAnalysis, MMHitAnalysis, MSVtxValidationAlg, Muon::MdtCalibJsonDumpAlg, MuonCalib::MuonSegmentReader, MuonGM::GeoModelCscTest, MuonGM::GeoModelMdtTest, MuonGM::GeoModelMmTest, MuonGM::GeoModelRpcTest, MuonGM::GeoModelTgcTest, MuonGM::GeoModelsTgcTest, MuonGM::NSWGeoPlottingAlg, MuonGMR4::GeoModelMdtTest, MuonGMR4::GeoModelMmTest, MuonGMR4::GeoModelRpcTest, MuonGMR4::GeoModelTgcTest, MuonGMR4::GeoModelsTgcTest, MuonGMR4::NswGeoPlottingAlg, MuonHoughDataNtuple, MuonR4::BucketDumperAlg, MuonR4::CaloCellsDumperAlg, MuonR4::MlHitDumperAlg, MuonR4::SPIdDumperAlg, MuonR4::SegmentDumperAlg, MuonR4::TruthMuonVertexDumperAlg, MuonVal::HitValAlg, MuonVal::MdtRDOAnalysis, MuonVal::MuonSDOAnalysis, MuonVal::MuonTester::TreeTestAlg, MuonVal::RpcRDOAnalysis, MuonVal::TgcRDOAnalysis, MuonValR4::MdtCalibDbAlgTest, MuonValR4::MsTrackTester, MuonValR4::MuonFastRecoTester, MuonValR4::MuonHitTesterAlg, MuonValR4::MuonHoughTransformTester, MuonValR4::MuonRecoChainTester, MuonValR4::MuonSPCalibrationTest, MuonValR4::SegmentRefitTest, MuonValR4::xMuonHitAnalysis, NswOccupancyAlg, RPCHitAnalysis, SiHitAnalysis, TGCHitAnalysis, TRTHitAnalysis, TrackRecordAnalysis, TruthHitAnalysis, ZDCHitAnalysis, and sTGCHitAnalysis.
|
| void | renounceArray (SG::VarHandleKeyArray &handlesArray) |
| | remove all handles from I/O resolution
|
| std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > | renounce (T &h) |
| void | extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps) |
| | Add StoreName to extra input/output deps as needed.
|
| 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.
|
| TH1 * | bookGetPointer (const TH1 &hist, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| TH1 * | bookGetPointer (TH1 *hist, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| TH1 * | bookGetPointer (TH1 &histRef, std::string tDir="", std::string stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| TTree * | bookGetPointer (const TTree &treeRef, std::string tDir="", std::string stream="") |
| | Simplify the booking and registering (into THistSvc) of TTrees.
|
| TGraph * | bookGetPointer (const TGraph &graphRef, std::string tDir="", std::string stream="") |
| | Simplify the booking and registering (into THistSvc) of TGraphs.
|
| TEfficiency * | bookGetPointer (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| TEfficiency * | bookGetPointer (TEfficiency *eff, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| TEfficiency * | bookGetPointer (TEfficiency &effRef, std::string tDir="", std::string stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| StatusCode | book (const TH1 &hist, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| StatusCode | book (TH1 *hist, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| StatusCode | book (TH1 &histRef, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of histograms.
|
| StatusCode | book (const TTree &treeRef, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TTrees.
|
| StatusCode | book (const TGraph &graphRef, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TGraphs.
|
| StatusCode | book (const TEfficiency &eff, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| StatusCode | book (TEfficiency *eff, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| StatusCode | book (TEfficiency &effRef, const std::string &tDir="", const std::string &stream="") |
| | Simplify the booking and registering (into THistSvc) of TEfficiency.
|
| TH1 * | hist (const std::string &histName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered histograms of any type.
|
| TH2 * | hist2d (const std::string &histName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered 2-d histograms.
|
| TH3 * | hist3d (const std::string &histName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered 3-d histograms.
|
| TTree * | tree (const std::string &treeName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered TTrees.
|
| TGraph * | graph (const std::string &graphName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered TGraphs.
|
| TEfficiency * | efficiency (const std::string &effName, const std::string &tDir="", const std::string &stream="") |
| | Simplify the retrieval of registered TEfficiency.
|
|
| Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| | specialization for handling Gaudi::Property<SG::VarHandleKey>
|
| void | buildBookingString (std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false) |
| | Method to build individual booking string.
|
| void | myReplace (std::string &str, const std::string &oldStr, const std::string &newStr) |
| | Helper method to replace sub-string.
|
| hash_t | hash (const std::string &histName) const |
| | Method to calculate a 32-bit hash from a string.
|
Definition at line 29 of file AthHistogramAlgorithm.h.
◆ EffMap_t
◆ GraphMap_t
◆ hash_t
◆ HistMap_t
◆ StoreGateSvc_t
◆ TreeMap_t
◆ AthHistogramAlgorithm()
| AthHistogramAlgorithm::AthHistogramAlgorithm |
( |
const std::string & | name, |
|
|
ISvcLocator * | pSvcLocator ) |
Constructor with parameters:
Definition at line 31 of file AthHistogramAlgorithm.cxx.
32 :
36{
37
38
39
40
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
46
47 declareProperty(
"RootStreamName",
m_prefix =
"/ANALYSIS",
"Name of the output ROOT stream (file) that the THistSvc uses");
49 "Name of the ROOT directory inside the ROOT file where the histograms will go");
50
53
56}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_histNamePrefix
The prefix for the histogram THx name.
ServiceHandle< ITHistSvc > m_histSvc
Default constructor: AthHistogramAlgorithm();.
std::string m_prefix
Name of the ROOT output stream (file).
std::string m_histNamePostfix
The postfix for the histogram THx name.
std::string m_histTitlePostfix
The postfix for the histogram THx title.
std::string m_rootDir
Name of the ROOT directory.
std::string m_histTitlePrefix
The prefix for the histogram THx title.
AthHistogramming(const std::string &name)
Constructor with parameters:
◆ ~AthHistogramAlgorithm()
| AthHistogramAlgorithm::~AthHistogramAlgorithm |
( |
| ) |
|
|
virtual |
◆ book() [1/8]
| StatusCode AthHistogramming::book |
( |
const TEfficiency & | eff, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 337 of file AthHistogramming.h.
338{
339
340 TEfficiency* effClone =
dynamic_cast< TEfficiency*
>(
eff.Clone() );
341 if ( !effClone ) {
342 m_msg << MSG::ERROR <<
"Couldn't create a TEfficiency clone" <<
endmsg;
343 return StatusCode::FAILURE;
344 }
345 return this->
book( *effClone, tDir, stream );
346}
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
MsgStream m_msg
Cached Message Stream.
◆ book() [2/8]
| StatusCode AthHistogramming::book |
( |
const TGraph & | graphRef, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TGraphs.
◆ book() [3/8]
| StatusCode AthHistogramming::book |
( |
const TH1 & | hist, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 305 of file AthHistogramming.h.
306{
307
308 TH1* histClone =
dynamic_cast< TH1*
>(
hist.Clone() );
309 if ( !histClone ) {
310 m_msg << MSG::ERROR <<
"Couldn't create a TH1 clone" <<
endmsg;
311 return StatusCode::FAILURE;
312 }
313 return this->
book( *histClone, tDir, stream );
314}
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
◆ book() [4/8]
| StatusCode AthHistogramming::book |
( |
const TTree & | treeRef, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TTrees.
Definition at line 405 of file AthHistogramming.h.
406{
407
408 TTree* treePointer = this->
bookGetPointer( treeRef, tDir, stream );
409 if ( treePointer )
410 {
411 return StatusCode::SUCCESS;
412 }
413 else
414 {
415 return StatusCode::FAILURE;
416 }
417}
TH1 * bookGetPointer(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
◆ book() [5/8]
| StatusCode AthHistogramming::book |
( |
TEfficiency & | effRef, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 358 of file AthHistogramming.h.
359{
360
361 TEfficiency* effPointer = this->
bookGetPointer( effRef, tDir, stream );
362 if ( !effPointer ) {
363 m_msg << MSG::ERROR <<
"Couldn't book a TEfficiency" <<
endmsg;
364 return StatusCode::FAILURE;
365 }
366 return StatusCode::SUCCESS;
367}
◆ book() [6/8]
| StatusCode AthHistogramming::book |
( |
TEfficiency * | eff, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 348 of file AthHistogramming.h.
349{
350 if ( !eff ) {
351 m_msg << MSG::ERROR <<
"Got a zero pointer to a TEfficiency" <<
endmsg;
352 return StatusCode::FAILURE;
353 }
354 return this->
book( *eff, tDir, stream );
355}
◆ book() [7/8]
| StatusCode AthHistogramming::book |
( |
TH1 & | histRef, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 326 of file AthHistogramming.h.
327{
328
330 if ( !histPointer ) {
331 m_msg << MSG::ERROR <<
"Couldn't book a TH1" <<
endmsg;
332 return StatusCode::FAILURE;
333 }
334 return StatusCode::SUCCESS;
335}
◆ book() [8/8]
| StatusCode AthHistogramming::book |
( |
TH1 * | hist, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 316 of file AthHistogramming.h.
317{
319 m_msg << MSG::ERROR <<
"Got a zero pointer to a TH1" <<
endmsg;
320 return StatusCode::FAILURE;
321 }
322 return this->
book( *
hist, tDir, stream );
323}
◆ bookGetPointer() [1/8]
| TEfficiency * AthHistogramming::bookGetPointer |
( |
const TEfficiency & | eff, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 283 of file AthHistogramming.h.
284{
285
286 TEfficiency* histClone =
dynamic_cast< TEfficiency*
>(
hist.Clone() );
287 if ( !histClone ) {
288 m_msg << MSG::ERROR <<
"Couldn't create a TEfficiency clone in bookGetPointer" <<
endmsg;
289 return 0;
290 }
292
293}
◆ bookGetPointer() [2/8]
| TGraph * AthHistogramming::bookGetPointer |
( |
const TGraph & | graphRef, |
|
|
std::string | tDir = "", |
|
|
std::string | stream = "" ) |
|
protectedinherited |
Simplify the booking and registering (into THistSvc) of TGraphs.
Definition at line 412 of file AthHistogramming.cxx.
413{
414
415 const TGraph* graphPointer = &graphRef;
416
417
418 if ( !graphPointer )
419 {
420 m_msg << MSG::WARNING
421 <<
"We got an invalid TGraph pointer in the BookGetPointer(TGraph*) method of the class" <<
m_name
423 return NULL;
424 }
425
426
427 std::string graphName = graphPointer->GetName();
428 const std::string graphTitle = graphPointer->GetTitle();
429
430
431 const hash_t graphHash = this->
hash(graphName);
432 GraphMap_t::const_iterator
it =
m_graphMap.find( graphHash );
434 {
435 m_msg << MSG::WARNING
436 << "Detected a hash collision. The hash for the TGraph with name=" << graphName
437 <<
" already exists and points to a TGraph with name=" <<
it->second->GetName()
438 <<
" NOT going to book the new histogram and returning a NULL pointer!" <<
endmsg;
439 return NULL;
440 }
441
442
444 if( !graphClone )
445 {
446 m_msg << MSG::WARNING
447 <<
"We couldn't clone the TGraph in the BookGetPointer(TGraph&) method of the class" <<
m_name
449 return NULL;
450 }
452
453
454 std::string bookingString("");
456
457
458 if ( !((
histSvc()->regGraph(bookingString, graphClone)).isSuccess()) )
459 {
460 m_msg << MSG::WARNING
461 << "Problem registering TGraph with name " << graphName
462 << ", title " << graphTitle
464 return NULL;
465 }
466
467
468 m_graphMap.insert(
m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphClone ) );
469
470 return graphClone;
471}
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
std::string m_histNamePostfix
The postfix for the histogram THx name.
hash_t hash(const std::string &histName) const
Method to calculate a 32-bit hash from a string.
uint32_t hash_t
typedef for the internal hash
std::string m_histTitlePostfix
The postfix for the histogram THx title.
std::string m_histTitlePrefix
The prefix for the histogram THx title.
std::string m_name
Instance name.
void buildBookingString(std::string &bookingString, std::string &histName, std::string &tDir, std::string &stream, bool usePrefixPostfix=false)
Method to build individual booking string.
std::string m_histNamePrefix
The prefix for the histogram THx name.
GraphMap_t m_graphMap
The map of TGraph names to their pointers.
◆ bookGetPointer() [3/8]
| TH1 * AthHistogramming::bookGetPointer |
( |
const TH1 & | hist, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 262 of file AthHistogramming.h.
263{
264
265 TH1* histClone =
dynamic_cast< TH1*
>(
hist.Clone() );
266 if ( !histClone ) {
267 m_msg << MSG::ERROR <<
"Couldn't create a TH1 clone in bookGetPointer" <<
endmsg;
268 return 0;
269 }
271
272}
◆ bookGetPointer() [4/8]
| TTree * AthHistogramming::bookGetPointer |
( |
const TTree & | treeRef, |
|
|
std::string | tDir = "", |
|
|
std::string | stream = "" ) |
|
protectedinherited |
Simplify the booking and registering (into THistSvc) of TTrees.
Definition at line 297 of file AthHistogramming.cxx.
298{
299
300 const TTree* treePointer = &treeRef;
301
302
303 if ( !treePointer )
304 {
305 m_msg << MSG::WARNING
306 <<
"We got an invalid TTree pointer in the BookGetPointer(TTree*) method of the class" <<
m_name
308 return NULL;
309 }
310
311
312 std::string
treeName = treePointer->GetName();
313 const std::string treeTitle = treePointer->GetTitle();
314
315
317 TreeMap_t::const_iterator
it =
m_treeMap.find( treeHash );
319 {
320 m_msg << MSG::WARNING
321 <<
"Detected a hash collision. The hash for the TTree with name=" <<
treeName
322 <<
" already exists and points to a TTree with name=" <<
it->second->GetName()
323 <<
" NOT going to book the new histogram and returning a NULL pointer!" <<
endmsg;
324 return NULL;
325 }
326
327
328 TTree* treeClone =
dynamic_cast< TTree*
>( treePointer->Clone(
treeName.c_str()) );
329 if( !treeClone )
330 {
331 m_msg << MSG::WARNING
332 <<
"We couldn't clone the TTree in the BookGetPointer(TTree&) method of the class" <<
m_name
334 return NULL;
335 }
336 treeClone->SetTitle (treeTitle.c_str());
337
338
339 std::string bookingString("");
341
342
343 if ( !((
histSvc()->regTree(bookingString, treeClone)).isSuccess()) )
344 {
345 m_msg << MSG::WARNING
346 <<
"Problem registering TTree with name " <<
treeName
347 << ", title " << treeTitle
349 return NULL;
350 }
351
352
353 m_treeMap.insert(
m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treeClone ) );
354
355 return treeClone;
356}
TreeMap_t m_treeMap
The map of TTree names to their pointers.
◆ bookGetPointer() [5/8]
| TEfficiency * AthHistogramming::bookGetPointer |
( |
TEfficiency & | effRef, |
|
|
std::string | tDir = "", |
|
|
std::string | stream = "" ) |
|
protectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 131 of file AthHistogramming.cxx.
132{
133
134 std::string effName(effRef.GetName());
135 const std::string effTitle(effRef.GetTitle());
136 std::string bookingString("");
137
140 effRef.SetName(effName.c_str());
141
142
144 EffMap_t::const_iterator
it =
m_effMap.find( effHash );
146 {
147 m_msg << MSG::WARNING
148 << "Detected a hash collision. The hash for the TEfficiency with name=" << effName
149 <<
" already exists and points to a TEfficiency with name=" <<
it->second->GetName()
150 <<
" NOT going to book the new TEfficiency and returning a NULL pointer!" <<
endmsg;
151 return NULL;
152 }
153
154
155
156
157
158
159
160 if ( !((
histSvc()->regEfficiency(bookingString, &effRef)).isSuccess()) )
161 {
162 m_msg << MSG::WARNING
163 << "Problem registering TEfficiency with name " << effName
165 << ", title " << effTitle
169 return NULL;
170 }
171
172
173 m_effMap.insert(
m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, &effRef ) );
174
175 return &effRef;
176}
EffMap_t m_effMap
The map of histogram names to their pointers.
◆ bookGetPointer() [6/8]
| TEfficiency * AthHistogramming::bookGetPointer |
( |
TEfficiency * | eff, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of TEfficiency.
Definition at line 295 of file AthHistogramming.h.
296{
298 m_msg << MSG::ERROR <<
"Got a zero pointer to a TEfficiency in bookGetPointer" <<
endmsg;
299 return 0;
300 }
302}
◆ bookGetPointer() [7/8]
| TH1 * AthHistogramming::bookGetPointer |
( |
TH1 & | histRef, |
|
|
std::string | tDir = "", |
|
|
std::string | stream = "" ) |
|
protectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 83 of file AthHistogramming.cxx.
84{
85
86 std::string
histName(histRef.GetName());
87 const std::string histTitle(histRef.GetTitle());
88 std::string bookingString("");
89
93
94
96 HistMap_t::const_iterator
it =
m_histMap.find( histHash );
98 {
100 <<
"Detected a hash collision. The hash for the histogram with name=" <<
histName
101 <<
" already exists and points to a histogram with name=" <<
it->second->GetName()
102 <<
" NOT going to book the new histogram and returning a NULL pointer!" <<
endmsg;
103 return NULL;
104 }
105
106
107
108
109
110
111
112 if ( !((
histSvc()->regHist(bookingString, &histRef)).isSuccess()) )
113 {
114 m_msg << MSG::WARNING
115 <<
"Problem registering histogram with name " <<
histName
117 << ", title " << histTitle
121 return NULL;
122 }
123
124
125 m_histMap.insert(
m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, &histRef ) );
126
127 return &histRef;
128}
HistMap_t m_histMap
The map of histogram names to their pointers.
◆ bookGetPointer() [8/8]
| TH1 * AthHistogramming::bookGetPointer |
( |
TH1 * | hist, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the booking and registering (into THistSvc) of histograms.
Definition at line 274 of file AthHistogramming.h.
275{
277 m_msg << MSG::ERROR <<
"Got a zero pointer to a TH1 in bookGetPointer" <<
endmsg;
278 return 0;
279 }
281}
◆ buildBookingString()
| void AthHistogramming::buildBookingString |
( |
std::string & | bookingString, |
|
|
std::string & | histName, |
|
|
std::string & | tDir, |
|
|
std::string & | stream, |
|
|
bool | usePrefixPostfix = false ) |
|
privateinherited |
Method to build individual booking string.
Definition at line 545 of file AthHistogramming.cxx.
550{
551
554 if(pos != std::string::npos){
555 tDir+='/';
556 tDir.append(histName, 0,pos);
558 };
560
561 if(usePrefixPostfix){
563 } else {
565 }
566 while(bookingString.find("//") != std::string::npos){
568 }
569
570 return;
571}
std::string m_rootDir
Name of the ROOT directory.
std::string m_streamName
Name of the ROOT output stream (file).
void myReplace(std::string &str, const std::string &oldStr, const std::string &newStr)
Helper method to replace sub-string.
◆ configAthHistogramming()
| StatusCode AthHistogramming::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 ) |
|
protectedinherited |
To be called by the derived classes to fill the internal configuration.
Definition at line 51 of file AthHistogramming.cxx.
55{
63
64 return StatusCode::SUCCESS;
65}
ServiceHandle< ITHistSvc > m_histSvc
Pointer to the THistSvc (event store by default).
◆ declareGaudiProperty()
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
158 {
161 hndl.documentation());
162
163 }
◆ declareProperty()
Definition at line 145 of file AthCommonDataStore.h.
145 {
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
◆ detStore()
◆ efficiency()
| TEfficiency * AthHistogramming::efficiency |
( |
const std::string & | effName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
protectedinherited |
Simplify the retrieval of registered TEfficiency.
Definition at line 235 of file AthHistogramming.cxx.
236{
237
239
240
241 EffMap_t::const_iterator
it =
m_effMap.find( effHash );
243 {
244
245
246 std::string effNameCopy = effName;
247 std::string tDirCopy = tDir;
248 std::string streamCopy =
stream;
249
250
251 std::string bookingString("");
253
254 TEfficiency* effPointer(NULL);
256 {
257
258 std::string bookingString("");
260
262 {
263 m_msg << MSG::WARNING
264 << "Problem retrieving the TEfficiency with name (including pre- and post-fixes) "
266 << " or with name " << effNameCopy
267 <<
" in " <<
m_name <<
"... it doesn't exist, neither in the cached map nor in the THistSvc!"
268 <<
" Will return an NULL pointer... you have to handle it correctly!" <<
endmsg;
269 return NULL;
270 }
271
272
273 m_effMap.insert(
m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
274 return effPointer;
275 }
276
277
278 m_effMap.insert(
m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
279 return effPointer;
280 }
281
282
284}
std::pair< StatusCode, TEfficiency * > getEfficiency(ITHistSvc &svc, const std::string &name)
◆ evtStore()
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ extraOutputDeps()
| const DataObjIDColl & AthAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 50 of file AthAlgorithm.cxx.
51{
52
53
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects
◆ graph()
| TGraph * AthHistogramming::graph |
( |
const std::string & | graphName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
protectedinherited |
Simplify the retrieval of registered TGraphs.
Definition at line 477 of file AthHistogramming.cxx.
478{
479
480 const hash_t graphHash = this->
hash(graphName);
481
482
483 GraphMap_t::const_iterator
it =
m_graphMap.find( graphHash );
485 {
486
487
488 std::string graphNameCopy = graphName;
489 std::string tDirCopy = tDir;
490 std::string streamCopy =
stream;
491
492
493 std::string bookingString("");
495
496 TGraph* graphPointer(NULL);
497 if ( !((
histSvc()->
getGraph(bookingString, graphPointer)).isSuccess()) )
498 {
499
500 std::string bookingString("");
501 this->
buildBookingString( bookingString, graphNameCopy, tDirCopy, streamCopy,
false );
502
503 if ( !((
histSvc()->
getGraph(bookingString, graphPointer)).isSuccess()) )
504 {
505 m_msg << MSG::WARNING
506 << "Problem retrieving the TGraph with name (including pre- and post-fixes) "
508 << " or with name " << graphNameCopy
509 <<
" in " <<
m_name <<
"... it doesn't exist, neither in the cached map nor in the THistSvc!"
510 <<
" Will return an NULL pointer... you have to handle it correctly!" <<
endmsg;
511 return NULL;
512 }
513
514
515 m_graphMap.insert(
m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
516 return graphPointer;
517 }
518
519
520 m_graphMap.insert(
m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
521 return graphPointer;
522 }
523
524
525
527}
std::pair< StatusCode, TGraph * > getGraph(ITHistSvc &svc, const std::string &name)
◆ hash()
Method to calculate a 32-bit hash from a string.
Definition at line 430 of file AthHistogramming.h.
431{
434}
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
◆ hist()
| TH1 * AthHistogramming::hist |
( |
const std::string & | histName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
protectedinherited |
Simplify the retrieval of registered histograms of any type.
Definition at line 183 of file AthHistogramming.cxx.
184{
185
187
188
189 HistMap_t::const_iterator
it =
m_histMap.find( histHash );
191 {
192
193
194 std::string histNameCopy =
histName;
195 std::string tDirCopy = tDir;
196 std::string streamCopy =
stream;
197
198
199 std::string bookingString("");
201
202 TH1* histPointer(NULL);
203 if ( !((
histSvc()->
getHist(bookingString, histPointer)).isSuccess()) )
204 {
205
206 std::string bookingString("");
208
209 if ( !((
histSvc()->
getHist(bookingString, histPointer)).isSuccess()) )
210 {
211 m_msg << MSG::WARNING
212 << "Problem retrieving the histogram with name (including pre- and post-fixes) "
214 << " or with name " << histNameCopy
215 <<
" in " <<
m_name <<
"... it doesn't exist, neither in the cached map nor in the THistSvc!"
216 <<
" Will return an NULL pointer... you have to handle it correctly!" <<
endmsg;
217 return NULL;
218 }
219
220
221 m_histMap.insert(
m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, histPointer ) );
222 return histPointer;
223 }
224
225
226 m_histMap.insert(
m_histMap.end(), std::pair< const hash_t, TH1* >( histHash, histPointer ) );
227 return histPointer;
228 }
229
230
231
233}
std::pair< StatusCode, TH1 * > getHist(ITHistSvc &svc, const std::string &name, size_t index=0)
◆ hist2d()
| TH2 * AthHistogramming::hist2d |
( |
const std::string & | histName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the retrieval of registered 2-d histograms.
Definition at line 371 of file AthHistogramming.h.
372{
373
374 TH1* th1Pointer = this->
hist(histName, tDir, stream);
375 if ( !th1Pointer )
376 {
378 <<
"Cannot get a 2-d histogram with name " <<
histName
379 <<
"... will probably seg-fault!" <<
endmsg;
380 return NULL;
381 }
382
383 return dynamic_cast<TH2*>( th1Pointer );
384}
◆ hist3d()
| TH3 * AthHistogramming::hist3d |
( |
const std::string & | histName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
inlineprotectedinherited |
Simplify the retrieval of registered 3-d histograms.
Definition at line 388 of file AthHistogramming.h.
389{
390
391 TH1* th1Pointer = this->
hist(histName, tDir, stream);
392 if ( !th1Pointer )
393 {
395 <<
"Cannot get a 3-d histogram with name " <<
histName
396 <<
"... will probably seg-fault!" <<
endmsg;
397 return NULL;
398 }
399
400 return dynamic_cast<TH3*>( th1Pointer );
401}
◆ histSvc()
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a pointer to the THistSvc.
Definition at line 113 of file AthHistogramAlgorithm.h.
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ msg()
◆ msgLvl()
◆ myReplace()
| void AthHistogramming::myReplace |
( |
std::string & | str, |
|
|
const std::string & | oldStr, |
|
|
const std::string & | newStr ) |
|
privateinherited |
Helper method to replace sub-string.
Definition at line 575 of file AthHistogramming.cxx.
578{
580 while((pos =
str.find(oldStr, pos)) != std::string::npos)
581 {
582 str.replace(pos, oldStr.length(), newStr);
583 pos += newStr.length();
584 }
585}
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
Definition at line 380 of file AthCommonDataStore.h.
381 {
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
◆ renounceArray()
◆ sysInitialize()
| StatusCode AthHistogramAlgorithm::sysInitialize |
( |
| ) |
|
|
virtual |
Initialization method invoked by the framework.
This method is responsible for any bookkeeping of initialization required by the framework itself. It will in turn invoke the initialize() method of the derived algorithm, and of any sub-algorithms which it creates.
Reimplemented from AthAlgorithm.
Reimplemented in AthAnalysisAlgorithm.
Definition at line 75 of file AthHistogramAlgorithm.cxx.
76{
77
78
79
80 if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS;
81
82
83 bindPropertiesTo( serviceLocator()->getOptsSvc() );
84
85
86
87 if ( !isEnabled( ) ) return StatusCode::SUCCESS;
88
89
90
91
92
94
95
100
101
110
111
112
114}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode sysInitialize() override
Override sysInitialize.
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
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.
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ tree()
| TTree * AthHistogramming::tree |
( |
const std::string & | treeName, |
|
|
const std::string & | tDir = "", |
|
|
const std::string & | stream = "" ) |
|
protectedinherited |
Simplify the retrieval of registered TTrees.
Definition at line 363 of file AthHistogramming.cxx.
364{
365
367
368
369 TreeMap_t::const_iterator
it =
m_treeMap.find( treeHash );
371 {
372
373
374 std::string treeNameCopy =
treeName;
375 std::string tDirCopy = tDir;
376 std::string streamCopy =
stream;
377
378
379 std::string bookingString("");
381
382 TTree* treePointer(NULL);
383 if ( !((
histSvc()->
getTree(bookingString, treePointer)).isSuccess()) )
384 {
385 m_msg << MSG::WARNING
386 << "Problem retrieving the TTree with name " << treeNameCopy
387 <<
" in " <<
m_name <<
"... it doesn't exist, neither in the cached map nor in the THistSvc!"
388 <<
" Will return an NULL pointer... you have to handle it correctly!" <<
endmsg;
389 return NULL;
390 }
391
392
393 m_treeMap.insert(
m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treePointer ) );
394 return treePointer;
395 }
396
397
399}
std::pair< StatusCode, TTree * > getTree(ITHistSvc &svc, const std::string &name)
◆ updateVHKA()
Definition at line 308 of file AthCommonDataStore.h.
308 {
309
310
313 for (
auto k :
keys) {
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka
◆ m_detStore
◆ m_effMap
◆ m_evtStore
◆ m_extendedExtraObjects
| DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_graphMap
◆ m_histMap
◆ m_histNamePostfix
| std::string AthHistogramAlgorithm::m_histNamePostfix |
|
private |
◆ m_histNamePrefix
| std::string AthHistogramAlgorithm::m_histNamePrefix |
|
private |
◆ m_histSvc
◆ m_histTitlePostfix
| std::string AthHistogramAlgorithm::m_histTitlePostfix |
|
private |
◆ m_histTitlePrefix
| std::string AthHistogramAlgorithm::m_histTitlePrefix |
|
private |
◆ m_msg
| MsgStream AthHistogramming::m_msg |
|
privateinherited |
◆ m_name
| std::string AthHistogramming::m_name |
|
privateinherited |
◆ m_prefix
| std::string AthHistogramAlgorithm::m_prefix |
|
private |
◆ m_rootDir
| std::string AthHistogramAlgorithm::m_rootDir |
|
private |
◆ m_streamName
| std::string AthHistogramming::m_streamName |
|
privateinherited |
◆ m_treeMap
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files: