ATLAS Offline Software
HistoGroupBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <algorithm>
7 
8 #include "TH1.h"
9 
10 HistoGroupBase::HistoGroupBase(const std::string& n) : asg::AsgTool(n)
11  , m_histoDir("")
12  , m_monIntervalType(8) // corresponds to "all"
13  , m_prefixedHistoName(false)
14  , m_interval(-1)
15 {
16  declareInterface<HistoGroupBase>(this);
17 
18  declareProperty("MonitoringIntervalType", m_monIntervalType);
19  declareProperty("HistoDir", m_histoDir);
20  declareProperty("PrefixedHistoName", m_prefixedHistoName);
21  declareProperty("IntervalType", m_interval);
22 }
23 
25  return StatusCode::SUCCESS;
26 }
27 
28 
30  return 0;
31 }
32 
34  return 0;
35 }
36 
38  return 0;
39 }
40 
41 void HistoGroupBase::prefixHistoDir(const std::string & preDir){
42  m_histoDir = preDir + m_histoDir;
43 }
44 
45 const std::vector<HistoGroupBase::HistData> & HistoGroupBase::bookedHistograms(){
46  return m_vBookedHistograms;
47 }
48 
49 
50 void HistoGroupBase::renameAndRegister(TH1* h, const std::string & subD, Interval_t ityp){
51 
52  if( h == nullptr ) return;
53 
54  if( ityp == useToolInterval) ityp = (Interval_t) m_interval;
55 
56  std::string path = m_histoDir+subD;
57  std::string prefix="";
58  if( m_prefixedHistoName) {
59  prefix = path;
60  std::replace( prefix.begin(), prefix.end(), '/', '_');
61  }
62  h->SetName( (prefix+h->GetName()).c_str() );
63 
64  m_vBookedHistograms.push_back( {h, path, ityp} );
65 }
HistoGroupBase::finalizeHistos
virtual int finalizeHistos()
Definition: HistoGroupBase.cxx:37
HistoGroupBase::buildHistos
virtual int buildHistos()
Definition: HistoGroupBase.cxx:29
HistoGroupBase::m_prefixedHistoName
bool m_prefixedHistoName
true if the histo name should contain the full hierarchy path
Definition: HistoGroupBase.h:99
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
asg
Definition: DataHandleTestTool.h:28
HistoGroupBase::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: HistoGroupBase.cxx:24
HistoGroupBase::m_interval
int m_interval
Definition: HistoGroupBase.h:101
HistoGroupBase::useToolInterval
@ useToolInterval
Definition: HistoGroupBase.h:41
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HistoGroupBase::m_monIntervalType
int m_monIntervalType
when used in Athena monitoring context, the histos of this group will have this type of interval
Definition: HistoGroupBase.h:96
extractSporadic.h
list h
Definition: extractSporadic.py:97
HistoGroupBase::prefixHistoDir
virtual void prefixHistoDir(const std::string &preDir)
allows a higher level tool to put the histos in this group as a sub-dir of 'preDir'
Definition: HistoGroupBase.cxx:41
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
HistoGroupBase.h
HistoGroupBase::m_histoDir
std::string m_histoDir
The path where histos in this group leave.
Definition: HistoGroupBase.h:93
HistoGroupBase::Interval_t
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
Definition: HistoGroupBase.h:37
h
TH1
Definition: rootspy.cxx:268
HistoGroupBase::bookedHistograms
const std::vector< HistData > & bookedHistograms()
return all the histos in this group
Definition: HistoGroupBase.cxx:45
HistoGroupBase::HistoGroupBase
HistoGroupBase(const std::string &t)
Definition: HistoGroupBase.cxx:10
HistoGroupBase::renameAndRegister
virtual void renameAndRegister(TH1 *h, const std::string &subD="", Interval_t ityp=useToolInterval)
Rename an histo according to the tool's path.
Definition: HistoGroupBase.cxx:50
HistoGroupBase::fillHistos
virtual int fillHistos()
Definition: HistoGroupBase.cxx:33
HistoGroupBase::m_vBookedHistograms
std::vector< HistData > m_vBookedHistograms
The list of histos in this group.
Definition: HistoGroupBase.h:90