ATLAS Offline Software
Loading...
Searching...
No Matches
dqi::HanInputRootFile Class Reference

#include <HanInputRootFile.h>

Inheritance diagram for dqi::HanInputRootFile:
Collaboration diagram for dqi::HanInputRootFile:

Public Member Functions

 HanInputRootFile (const std::string &rootFileName, const std::string &path="")
 ~HanInputRootFile ()
virtual void addListener (const boost::regex &regex, dqm_core::InputListener *listener) override
virtual void addListener (const std::vector< std::string > &names, dqm_core::InputListener *listener) override
virtual void addListener (const std::string &name, dqm_core::InputListener *listener) override
TFile * file () const
const TDirectory * getBasedir () const
TDirectory * getBasedir ()

Protected Attributes

TDirectory * m_basedir
std::vector< std::string > m_histNames
bool m_histNamesBuilt

Detailed Description

Definition at line 19 of file HanInputRootFile.h.

Constructor & Destructor Documentation

◆ HanInputRootFile()

dqi::HanInputRootFile::HanInputRootFile ( const std::string & rootFileName,
const std::string & path = "" )

Definition at line 27 of file HanInputRootFile.cxx.

29 : dqm_core::InputRootFile::InputRootFile(rootFileName)
30 , m_basedir(0)
31 , m_histNamesBuilt(false)
32{
33 if( path != "" ) {
34 std::cout << "Using path \"" << path << "\" in input file\n";
35 std::string pathForSearch = path;
36 pathForSearch += "/dummyName";
37 m_basedir = changeInputDir( m_file.get(), pathForSearch );
38 if( m_basedir == 0 ) {
39 std::cerr << "Cannot find \"" << path << "\" in input file\n";
40 }
41 }
42
43 if( m_basedir == 0 )
44 m_basedir = m_file.get();
45}
path
python interpreter configuration --------------------------------------—
Definition athena.py:128

◆ ~HanInputRootFile()

dqi::HanInputRootFile::~HanInputRootFile ( )

Definition at line 48 of file HanInputRootFile.cxx.

50{
51}

Member Function Documentation

◆ addListener() [1/3]

void dqi::HanInputRootFile::addListener ( const boost::regex & regex,
dqm_core::InputListener * listener )
overridevirtual

Definition at line 55 of file HanInputRootFile.cxx.

57{
58 // avoid building directory until actually demanded
59 if (! m_histNamesBuilt) {
61 m_histNamesBuilt = true;
62 }
63
64 for (std::vector<std::string>::const_iterator str = m_histNames.begin();
65 str != m_histNames.end();
66 ++str) {
67 try {
68 if (boost::regex_match(*str, regex)) {
69 // is this actually a histogram/graph?
70 TObject* temp = m_basedir->Get(str->c_str());
71 if (dynamic_cast<TH1*>(temp) || dynamic_cast<TGraph*>(temp) || dynamic_cast<TEfficiency*>(temp) ) {
72 std::cout << "Regular expression " << regex << " matches " << *str << std::endl;
73 addListener(*str, listener);
74 }
75 delete temp;
76 }
77 } catch (std::exception &ex) { // should be std::runtime_error, but Coverity is not happy with that
78 std::cout << "Warning: Matching of regular expression " << regex << " failed: " << ex.what() << std::endl;
79 }
80
81 }
82}
virtual void addListener(const boost::regex &regex, dqm_core::InputListener *listener) override
std::vector< std::string > m_histNames
void dolsr(const TDirectory *dir, std::vector< std::string > &hists, const TDirectory *topdir=nullptr)
Definition HanUtils.cxx:80

◆ addListener() [2/3]

void dqi::HanInputRootFile::addListener ( const std::string & name,
dqm_core::InputListener * listener )
overridevirtual

Definition at line 94 of file HanInputRootFile.cxx.

96{
97 // TKeys are owned by the TFile
98 TKey* key = getObjKeyFromTDir( m_basedir, name );
99 if( key == 0 ) {
100 // reduce verbosity
101 //std::cerr << "Warning: Histogram \"" << name << "\" was not found. Ignoring...\n";
102 return;
103 }
104 m_monObjects.push_back( MonBundle(name,key,listener) );
105}

◆ addListener() [3/3]

void dqi::HanInputRootFile::addListener ( const std::vector< std::string > & names,
dqm_core::InputListener * listener )
overridevirtual

Definition at line 86 of file HanInputRootFile.cxx.

88{
89 dqm_core::InputRootFile::addListener( names, listener );
90}

◆ file()

TFile * dqi::HanInputRootFile::file ( ) const
inline

Definition at line 31 of file HanInputRootFile.h.

31{ return m_file.get(); }

◆ getBasedir() [1/2]

TDirectory * dqi::HanInputRootFile::getBasedir ( )
inline

Definition at line 34 of file HanInputRootFile.h.

34{ return m_basedir; }

◆ getBasedir() [2/2]

const TDirectory * dqi::HanInputRootFile::getBasedir ( ) const
inline

Definition at line 33 of file HanInputRootFile.h.

33{ return m_basedir; }

Member Data Documentation

◆ m_basedir

TDirectory* dqi::HanInputRootFile::m_basedir
protected

Definition at line 38 of file HanInputRootFile.h.

◆ m_histNames

std::vector<std::string> dqi::HanInputRootFile::m_histNames
protected

Definition at line 40 of file HanInputRootFile.h.

◆ m_histNamesBuilt

bool dqi::HanInputRootFile::m_histNamesBuilt
protected

Definition at line 41 of file HanInputRootFile.h.


The documentation for this class was generated from the following files: