10 #include "TDirectoryFile.h"
11 #include "TEfficiency.h"
13 #include "dqm_core/exceptions.h"
20 TKey* getObjKeyFromTDir( TDirectory*
dir,
const std::string&
path );
21 TDirectory* changeInputDir( TDirectory*
dir,
const std::string&
path );
29 :
dqm_core::InputRootFile::InputRootFile(rootFileName)
31 , m_histNamesBuilt(false)
34 std::cout <<
"Using path \"" <<
path <<
"\" in input file\n";
35 std::string pathForSearch =
path;
36 pathForSearch +=
"/dummyName";
39 std::cerr <<
"Cannot find \"" <<
path <<
"\" in input file\n";
64 for (std::vector<std::string>::const_iterator
str =
m_histNames.begin();
68 if (boost::regex_match(*
str,
regex)) {
71 if (
dynamic_cast<TH1*
>(temp) ||
dynamic_cast<TGraph*
>(temp) ||
dynamic_cast<TEfficiency*
>(temp) ) {
72 std::cout <<
"Regular expression " <<
regex <<
" matches " << *
str << std::endl;
78 std::cout <<
"Warning: Matching of regular expression " <<
regex <<
" failed: " << ex.what() << std::endl;
87 addListener(
const std::vector<std::string>&
names, dqm_core::InputListener* listener )
89 dqm_core::InputRootFile::addListener(
names, listener );
104 m_monObjects.push_back( MonBundle(
name,
key,listener) );
113 TKey* getObjKeyFromTDir( TDirectory*
dir,
const std::string&
path ) {
117 std::string::size_type
i =
path.find_first_of(
'/');
118 if(
i != std::string::npos ) {
119 std::string dName(
path, 0,
i );
120 std::string pName(
path,
i+1, std::string::npos );
122 TDirectory* subDir =
dir->GetDirectory(dName.c_str());
124 return getObjKeyFromTDir( subDir, pName );
136 return getObjKeyFromTDir(
dir, pName );
139 return dir->FindKey(
path.c_str() );
143 TDirectory* changeInputDir( TDirectory*
dir,
const std::string&
path )
148 std::string::size_type
i =
path.find_first_of(
'/');
149 if(
i != std::string::npos ) {
150 std::string dName(
path, 0,
i );
151 std::string pName(
path,
i+1, std::string::npos );
153 TDirectory* subDir =
dir->GetDirectory(dName.c_str());
155 return changeInputDir( subDir, pName );
168 return changeInputDir(
dir, pName );