Go to the documentation of this file.
11 #ifndef GAUDISVC_THISTSVC_H
12 #define GAUDISVC_THISTSVC_H
30 #include <TEfficiency.h>
41 class THistSvc :
public extends<Service, ITHistSvc, IIncidentListener, IIoComponent> {
176 StatusCode getTHists( TDirectory* td, TList& tl,
bool recurse =
false,
bool reg =
false )
override;
181 StatusCode getTTrees( TDirectory* td, TList& tl,
bool recurse =
false,
bool reg =
false )
override;
259 ost <<
"id: " << hid.
id <<
" t: " << hid.
temp <<
" s: " << hid.
shared <<
" M: " << hid.
mode <<
" m: " << hid.
mutex
260 <<
" o: " << hid.
obj <<
" T: " <<
static_cast<int>( hid.
type ) <<
" " << hid.
obj->IsA()->GetName();
308 template <
typename T>
310 template <
typename T>
312 template <
typename T>
314 template <
typename T>
317 template <
typename T>
319 template <
typename T>
327 template <
typename T>
374 "maximum file size in MB. if exceeded,"
375 " will cause an abort. -1 to never check." };
378 <<
"\"CompressionLevel\" Property has been deprecated. "
379 <<
"Set it via the \"CL=\" parameter in the \"Output\" Property"
404 #endif // GAUDISVC_THISTSVC_H
T * readHist_i(const std::string &name) const
StatusCode getEfficiency(const std::string &name, TEfficiency *&) const override
Return TEfficiency with given name.
Gaudi::Property< int > m_autoFlush
LockedHandle< T > regShared_i(const std::string &id, std::unique_ptr< T > hist)
StatusCode merge(const std::string &id) override
Merge all clones for object with a given id.
std::vector< std::string > getEfficiencies() const override
StatusCode regShared(const std::string &name, std::unique_ptr< TH1 >, LockedHandle< TH1 > &) override
Register shared object of type TH1 and return LockedHandle for that object.
std::vector< std::string > getTrees() const override
std::lock_guard< THistSvcMutex_t > m_lock
void copyFileLayout(TDirectory *, TDirectory *)
helper function to recursively copy the layout of a TFile into a new TFile
StatusCode getTEfficiencies(TDirectory *td, TList &, bool recurse=false) const override
StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const override
GlobalDirectoryRestore(THistSvcMutex_t &mut)
StatusCode writeObjectsToFile()
bool existsEfficiency(const std::string &name) const override
Check if TEfficiency with given name is managed by THistSvcMT.
StatusCode getGraph(const std::string &name, TGraph *&) const override
Return TGraph with given name.
bool existsGraph(const std::string &name) const override
Check if graph with given name is managed by THistSvcMT.
StatusCode initialize() override
StatusCode deReg(const std::string &name) override
Deregister object with given name and give up ownership (without deletion!)
void setupInputFile()
call-back method to handle input stream property
Gaudi::Property< int > m_autoSave
THistID(std::string &i, bool &t, TObject *o, TFile *f)
StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const override
THistID(std::string &i, bool &t, TObject *o, TFile *f, Mode m)
StatusCode getShared(const std::string &name, LockedHandle< TH1 > &) const override
Retrieve shared object with given name as TH1 through LockedHandle.
Gaudi::Property< std::vector< std::string > > m_inputfile
T * readHist(const std::string &name) const
StatusCode rootOpenAction(FILEMGR_CALLBACK_ARGS)
void setupOutputFile()
call-back method to handle output stream property
Gaudi::Property< bool > m_print
std::unordered_map< TObject *, std::pair< vhid_t *, size_t > > objMap_t
std::string stripDirectoryName(std::string &dir) const
std::vector< THistID > vhid_t
std::vector< std::string > getHists() const override
LockedHandle< T > getShared_i(const std::string &name) const
THistSvc(const std::string &name, ISvcLocator *svcloc)
StatusCode rootOpenErrAction(FILEMGR_CALLBACK_ARGS)
const std::string & name() const override
Retrieve name of the service
void parseString(const std::string &id, std::string &root, std::string &rem) const
std::vector< std::string > m_Rstream
THistID & operator=(const THistID &rhs)=default
bool existsTree(const std::string &name) const override
Check if tree with given name is managed by THistSvcMT.
void handle(const Incident &) override
StatusCode finalize() override
Gaudi::Property< int > m_maxFileSize
bool findStream(const std::string &name, std::string &root, std::string &rem, TFile *&file) const
std::recursive_mutex THistSvcMutex_t
Mode
Enumerating all possible file access modes.
StatusCode getHist(const std::string &name, TH1 *&, size_t index=0) const override
Return histogram with given name as TH1*, THistSvcMT still owns object.
static Mode charToMode(const char typ)
Convert a char to a Mode enum.
Gaudi::Property< std::vector< std::string > > m_outputfile
StatusCode regEfficiency(const std::string &name) override
Register a new TEfficiency with a given name.
TDirectory * changeDir(const THistSvc::THistID &hid) const
std::unordered_multimap< std::string, vhid_t * > idMap_t
std::vector< std::string > m_Wstream
std::multimap< std::string, std::string > streamMap
friend std::ostream & operator<<(std::ostream &ost, const THistID &hid)
StatusCode regHist(const std::string &name) override
Register a new ROOT histogram TH*X with a name.
void removeDoubleSlash(std::string &) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Base class used to extend a class implementing other interfaces.
ObjectType
Possible TObject types.
Helper class that manages ROOts global directory and file.
~GlobalDirectoryRestore()
T * getHist_i(const std::string &name, const size_t &ind=0, bool quiet=false) const
Gaudi::Property< int > m_compressionLevel
StatusCode reinitialize() override
StatusCode getTree(const std::string &name, TTree *&) const override
Return TTree with given name.
std::set< std::string > m_alreadyConnectedOutFiles
list of already connected files.
ServiceHandle< IIncidentSvc > p_incSvc
StatusCode regTree(const std::string &name) override
Register a new TTree with a given name.
StatusCode regHist_i(std::unique_ptr< T > hist, const std::string &name, bool shared)
std::map< std::string, std::pair< TFile *, Mode > > m_files
ServiceHandle< IFileMgr > p_fileMgr
StatusCode connect(const std::string &)
bool existsHist(const std::string &name) const override
Check if histogram with given name is managed by THistSvcMT.
#define FILEMGR_CALLBACK_ARGS
bool operator<(THistID const &rhs) const
bool exists(const std::string &name) const override
Check if object with given name is managed by THistSvcMT exists calls existsHist and only works for T...
std::list< vhid_t * > hlist_t
TTree * readTree(const std::string &name) const
THistID(const THistID &rhs)=default
TDirectory * m_gDirectory
std::set< std::string > m_alreadyConnectedInFiles
list of already connected files.
void updateFiles()
Handle case where TTree grows beyond TTree::fgMaxTreeSize.
StatusCode io_reinit() override
callback method to reinitialize the internal state of the component for I/O purposes (e....
size_t findHistID(const std::string &id, const THistID *&hid, const size_t &index=0) const
StatusCode regGraph(const std::string &name) override
Register a new TGraph with a given name.
std::vector< std::string > getGraphs() const override
Helper struct that bundles the histogram ID with a mutex, TFile and TObject*.
std::unordered_map< std::string, vhid_t * > uidMap_t
std::map< std::string, std::string > m_sharedFiles
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...
void MergeRootFile(TDirectory *, TDirectory *)