The Gaudi Framework  master (37c0b60a)
ITHistSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_ITHISTSVC_H
12 #define GAUDIKERNEL_ITHISTSVC_H
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #ifndef GAUDIKERNEL_ISERVICE_H
19 # include <GaudiKernel/IService.h>
20 #endif
21 
23 
24 class TObject;
25 class TH1;
26 class TH2;
27 class TH3;
28 class TTree;
29 class TList;
30 class TDirectory;
31 class TGraph;
32 class TEfficiency;
33 
34 class GAUDI_API ITHistSvc : virtual public IService {
35 public:
38 
41 
43  virtual StatusCode regHist( const std::string& name ) = 0;
50  virtual StatusCode regHist( const std::string& name, TH1* ) = 0;
52  virtual StatusCode getHist( const std::string& name, TH1*&, size_t index = 0 ) const = 0;
54  virtual StatusCode getHist( const std::string& name, TH2*&, size_t index = 0 ) const = 0;
56  virtual StatusCode getHist( const std::string& name, TH3*&, size_t index = 0 ) const = 0;
57 
59 
62 
64  virtual StatusCode regTree( const std::string& name ) = 0;
69  virtual StatusCode regTree( const std::string& name, TTree* ) = 0;
71  virtual StatusCode getTree( const std::string& name, TTree*& ) const = 0;
72 
74 
77 
79  virtual StatusCode regGraph( const std::string& name ) = 0;
84  virtual StatusCode regGraph( const std::string& name, TGraph* ) = 0;
86  virtual StatusCode getGraph( const std::string& name, TGraph*& ) const = 0;
87 
89 
92 
94  virtual StatusCode regEfficiency( const std::string& name ) = 0;
99  virtual StatusCode regEfficiency( const std::string& name, TEfficiency* ) = 0;
101  virtual StatusCode getEfficiency( const std::string& name, TEfficiency*& ) const = 0;
102 
104 
107 
119  virtual StatusCode getShared( const std::string& name, LockedHandle<TH1>& ) const = 0;
121  virtual StatusCode getShared( const std::string& name, LockedHandle<TH2>& ) const = 0;
123  virtual StatusCode getShared( const std::string& name, LockedHandle<TH3>& ) const = 0;
128 
130 
133 
135  virtual StatusCode deReg( const std::string& name ) = 0;
137  virtual StatusCode deReg( TObject* obj ) = 0;
138 
140  virtual StatusCode merge( const std::string& id ) = 0;
142  virtual StatusCode merge( TObject* ) = 0;
143 
146  virtual bool exists( const std::string& name ) const = 0;
148  virtual bool existsHist( const std::string& name ) const = 0;
150  virtual bool existsTree( const std::string& name ) const = 0;
152  virtual bool existsGraph( const std::string& name ) const = 0;
154  virtual bool existsEfficiency( const std::string& name ) const = 0;
155 
157 
160 
161  virtual std::vector<std::string> getHists() const = 0;
162  virtual std::vector<std::string> getTrees() const = 0;
163  virtual std::vector<std::string> getGraphs() const = 0;
165 
166  virtual StatusCode getTHists( TDirectory* td, TList&, bool recurse = false ) const = 0;
167  virtual StatusCode getTHists( const std::string& name, TList&, bool recurse = false ) const = 0;
168  virtual StatusCode getTHists( TDirectory* td, TList&, bool recurse = false, bool reg = false ) = 0;
169  virtual StatusCode getTHists( const std::string& name, TList&, bool recurse = false, bool reg = false ) = 0;
170 
171  virtual StatusCode getTTrees( TDirectory* td, TList&, bool recurse = false ) const = 0;
172  virtual StatusCode getTTrees( const std::string& name, TList&, bool recurse = false ) const = 0;
173  virtual StatusCode getTTrees( TDirectory* td, TList&, bool recurse = false, bool reg = false ) = 0;
174  virtual StatusCode getTTrees( const std::string& name, TList&, bool recurse = false, bool reg = false ) = 0;
175 
176  virtual StatusCode getTEfficiencies( TDirectory* td, TList&, bool recurse = false ) const = 0;
177  virtual StatusCode getTEfficiencies( const std::string& name, TList&, bool recurse = false ) const = 0;
178  virtual StatusCode getTEfficiencies( TDirectory* td, TList&, bool recurse = false, bool reg = false ) = 0;
179  virtual StatusCode getTEfficiencies( const std::string& name, TList&, bool recurse = false, bool reg = false ) = 0;
181 
183  virtual ~ITHistSvc() = default;
184 };
185 
186 #endif // GAUDIKERNEL_ITHISTSVC_H
IService
Definition: IService.h:28
ITHistSvc::deReg
virtual StatusCode deReg(const std::string &name)=0
Deregister object with given name and give up ownership (without deletion!)
ITHistSvc::~ITHistSvc
virtual ~ITHistSvc()=default
virtual destructor
IService.h
std::string
STL class.
ITHistSvc::existsHist
virtual bool existsHist(const std::string &name) const =0
Check if histogram with given name is managed by THistSvcMT.
ITHistSvc::exists
virtual bool exists(const std::string &name) const =0
Check if histogram with given name is managed by THistSvcMT exists calls existsHist and only works fo...
ITHistSvc::getTEfficiencies
virtual StatusCode getTEfficiencies(TDirectory *td, TList &, bool recurse=false, bool reg=false)=0
ITHistSvc::regShared
virtual StatusCode regShared(const std::string &name, std::unique_ptr< TH2 >, LockedHandle< TH2 > &)=0
Register shared object of type TH2 and return LockedHandle for that object.
ITHistSvc::existsTree
virtual bool existsTree(const std::string &name) const =0
Check if tree with given name is managed by THistSvcMT.
ITHistSvc::getHists
virtual std::vector< std::string > getHists() const =0
ITHistSvc::getHist
virtual StatusCode getHist(const std::string &name, TH3 *&, size_t index=0) const =0
Return histogram with given name as TH3*, THistSvcMT still owns object.
ITHistSvc::getTTrees
virtual StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const =0
ITHistSvc::getTTrees
virtual StatusCode getTTrees(const std::string &name, TList &, bool recurse=false, bool reg=false)=0
std::vector< std::string >
ITHistSvc::getTHists
virtual StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const =0
ITHistSvc::regTree
virtual StatusCode regTree(const std::string &name)=0
Register a new TTree with a given name.
ITHistSvc::regEfficiency
virtual StatusCode regEfficiency(const std::string &name, std::unique_ptr< TEfficiency >)=0
Register an existing TEfficiency with a given name and moved unique_ptr.
ITHistSvc::regShared
virtual StatusCode regShared(const std::string &name, std::unique_ptr< TEfficiency >, LockedHandle< TEfficiency > &)=0
Register shared object of type TEfficiency and return LockedHandle for that object.
ITHistSvc::getShared
virtual StatusCode getShared(const std::string &name, LockedHandle< TGraph > &) const =0
Retrieve shared object with given name as TGraph through LockedHandle.
ITHistSvc::getTEfficiencies
virtual StatusCode getTEfficiencies(const std::string &name, TList &, bool recurse=false) const =0
ITHistSvc::regGraph
virtual StatusCode regGraph(const std::string &name, std::unique_ptr< TGraph >)=0
Register an existing TGraph with a given name and moved unique_ptr.
ITHistSvc::regTree
virtual StatusCode regTree(const std::string &name, std::unique_ptr< TTree >)=0
Register an existing TTree with a given name and moved unique_ptr.
ITHistSvc::getGraphs
virtual std::vector< std::string > getGraphs() const =0
ITHistSvc::getTTrees
virtual StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false, bool reg=false)=0
ITHistSvc::merge
virtual StatusCode merge(TObject *)=0
Merge all clones for given TObject*.
ITHistSvc::DeclareInterfaceID
DeclareInterfaceID(ITHistSvc, 3, 0)
InterfaceID.
ITHistSvc::getTrees
virtual std::vector< std::string > getTrees() const =0
ITHistSvc::regEfficiency
virtual StatusCode regEfficiency(const std::string &name, TEfficiency *)=0
ITHistSvc::getShared
virtual StatusCode getShared(const std::string &name, LockedHandle< TEfficiency > &) const =0
Retrieve shared object with given name as TEfficiency through LockedHandle.
ITHistSvc::regTree
virtual StatusCode regTree(const std::string &name, TTree *)=0
ITHistSvc::regGraph
virtual StatusCode regGraph(const std::string &name, TGraph *)=0
StatusCode
Definition: StatusCode.h:65
LockedHandle.h
ITHistSvc::regHist
virtual StatusCode regHist(const std::string &name)=0
Register a new ROOT histogram TH*X with a name.
ITHistSvc::getHist
virtual StatusCode getHist(const std::string &name, TH1 *&, size_t index=0) const =0
Return histogram with given name as TH1*, THistSvcMT still owns object.
ITHistSvc::getTHists
virtual StatusCode getTHists(const std::string &name, TList &, bool recurse=false) const =0
ITHistSvc::getEfficiency
virtual StatusCode getEfficiency(const std::string &name, TEfficiency *&) const =0
Return TGraph with given name.
ITHistSvc::existsEfficiency
virtual bool existsEfficiency(const std::string &name) const =0
Check if TEfficiency with given name is managed by THistSvcMT.
ITHistSvc::getShared
virtual StatusCode getShared(const std::string &name, LockedHandle< TH2 > &) const =0
Retrieve shared object with given name as TH2 through LockedHandle.
ITHistSvc::getEfficiencies
virtual std::vector< std::string > getEfficiencies() const =0
ITHistSvc::getGraph
virtual StatusCode getGraph(const std::string &name, TGraph *&) const =0
Return TGraph with given name.
ITHistSvc::getTEfficiencies
virtual StatusCode getTEfficiencies(TDirectory *td, TList &, bool recurse=false) const =0
ITHistSvc::getTTrees
virtual StatusCode getTTrees(const std::string &name, TList &, bool recurse=false) const =0
ITHistSvc
Definition: ITHistSvc.h:34
ITHistSvc::getHist
virtual StatusCode getHist(const std::string &name, TH2 *&, size_t index=0) const =0
Return histogram with given name as TH2*, THistSvcMT still owns object.
ITHistSvc::regShared
virtual StatusCode regShared(const std::string &name, std::unique_ptr< TGraph >, LockedHandle< TGraph > &)=0
Register shared object of type TGraph and return LockedHandle for that object.
ITHistSvc::getTHists
virtual StatusCode getTHists(TDirectory *td, TList &, bool recurse=false, bool reg=false)=0
ITHistSvc::getTHists
virtual StatusCode getTHists(const std::string &name, TList &, bool recurse=false, bool reg=false)=0
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
ITHistSvc::getTEfficiencies
virtual StatusCode getTEfficiencies(const std::string &name, TList &, bool recurse=false, bool reg=false)=0
ITHistSvc::regShared
virtual StatusCode regShared(const std::string &name, std::unique_ptr< TH1 >, LockedHandle< TH1 > &)=0
Register shared object of type TH1 and return LockedHandle for that object.
ITHistSvc::deReg
virtual StatusCode deReg(TObject *obj)=0
Deregister obejct identified by TObject* and give up ownership (without deletion!)
ITHistSvc::regHist
virtual StatusCode regHist(const std::string &name, TH1 *)=0
ITHistSvc::existsGraph
virtual bool existsGraph(const std::string &name) const =0
Check if graph with given name is managed by THistSvcMT.
ITHistSvc::getShared
virtual StatusCode getShared(const std::string &name, LockedHandle< TH1 > &) const =0
Retrieve shared object with given name as TH1 through LockedHandle.
ITHistSvc::regGraph
virtual StatusCode regGraph(const std::string &name)=0
Register a new TGraph with a given name.
LockedHandle
Definition: LockedHandle.h:38
ITHistSvc::getShared
virtual StatusCode getShared(const std::string &name, LockedHandle< TH3 > &) const =0
Retrieve shared object with given name as TH3 through LockedHandle.
ITHistSvc::regShared
virtual StatusCode regShared(const std::string &name, std::unique_ptr< TH3 >, LockedHandle< TH3 > &)=0
Register shared object of type TH3 and return LockedHandle for that object.
std::unique_ptr
STL class.
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
ITHistSvc::getTree
virtual StatusCode getTree(const std::string &name, TTree *&) const =0
Return TTree with given name.
Gaudi::ParticleProperties::index
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Definition: IParticlePropertySvc.cpp:39
ITHistSvc::regEfficiency
virtual StatusCode regEfficiency(const std::string &name)=0
Register a new TEfficiency with a given name.
ITHistSvc::regHist
virtual StatusCode regHist(const std::string &name, std::unique_ptr< TH1 > hist)=0
Register an existing ROOT histogram TH*X with name and moved unique_ptr.
ITHistSvc::merge
virtual StatusCode merge(const std::string &id)=0
Merge all clones for object with a given id.