1 #ifndef GAUDISVC_THISTSVC_ICC
2 #define GAUDISVC_THISTSVC_ICC
4 #ifndef GAUDIKERNEL_MSGSTREAM_H
26 <<
"Must not end with a /" <<
endmsg;
42 m_log <<
MSG::ERROR <<
"already registered an object with identifier \""
52 m_log <<
MSG::DEBUG <<
"Historgram with id \"" << idr <<
"\" is temporary"
57 TObject *to =
nullptr;
65 <<
"\" with non zero pointer!" <<
endmsg;
72 to =
dynamic_cast<TObject*
>(hist);
75 }
else if (hist == 0) {
82 to =
dynamic_cast<TObject*
>(hist);
92 <<
"\" with identifier \"" << oitr->second.id <<
"\"" <<
endmsg;
99 if ( dynamic_cast<TTree*>(hist) ) {
100 dynamic_cast<TTree*
>(hist)->SetDirectory(dir);
101 }
else if ( dynamic_cast<TH1*>(hist) ) {
102 dynamic_cast<TH1*
>(hist)->SetDirectory(dir);
103 }
else if ( dynamic_cast<TGraph*>(hist) ) {
107 <<
"\" is not a TH, TTree, or TGraph. Attaching it to current dir."
118 fname = f->GetName();
123 <<
" title: \"" << hist->GetTitle()
124 <<
"\" id: \"" << uid <<
"\" dir: "
127 <<
" file: " << fname
140 template <
typename T>
150 if (idr.
find(
"/") == 0) {
154 m_log <<
MSG::ERROR <<
"Could not locate Hist with id \"" << idr <<
"\""
163 hist =
dynamic_cast<T*
>(hid.
obj);
172 <<
"\" id: \"" << idr <<
"\"" <<
endmsg;
177 <<
"\" type: \"" << hid.
obj->IsA()->GetName() <<
"\""
191 if (mitr.first == mitr.second) {
192 m_log <<
MSG::ERROR <<
"Could not locate Hist with id \"" << idr <<
"\""
198 if (distance(mitr.first,mitr.second) == 1) {
199 THistID hid = mitr.first->second;
201 hist =
dynamic_cast<T*
>(hid.
obj);
208 <<
"\" id: \"" << idr <<
"\"" <<
endmsg;
213 << hid.
obj->IsA()->GetName() <<
"\""
222 <<
" Further specifications required."
240 template <
typename T>
266 while ( (dir=
dirname(fdir)) !=
"" ) {
267 if (! gDirectory->GetKey(dir.
c_str())) {
268 m_log <<
MSG::ERROR <<
"Directory \"" << fdir2 <<
"\" doesnt exist in "
269 << file->GetName() <<
endmsg;
272 gDirectory->cd(dir.
c_str());
276 gDirectory->GetObject(fdir.
c_str(), to);
280 << gDirectory->GetPath() <<
endmsg;
286 hist =
dynamic_cast<T*
>(to);
290 << to->IsA()->GetName()
298 << hist->GetName() <<
"\" from file "
299 << file->GetName() <<
endmsg;
MSG::Level level()
Retrieve output level.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
bool findStream(const std::string &name, std::string &root, std::string &rem, TFile *&file) const
TDirectory * changeDir(const THistSvc::THistID &hid) const
bool isFailure() const
Test for a status code of FAILURE.
std::string dirname(std::string &dir) const
This class is used for returning status codes from appropriate routines.
std::map< std::string, std::pair< TFile *, Mode > > m_files
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
StatusCode regHist_i(T *hist, const std::string &name)
StatusCode readHist_i(const std::string &name, T *&hist) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
void removeDoubleSlash(std::string &) const