22 #include <boost/tokenizer.hpp> 23 #include <boost/regex.hpp> 27 #include <TEfficiency.h> 62 std::set<std::string> *
myList,
71 using VPSet = std::vector<edm::ParameterSet>;
72 using vstring = std::vector<std::string>;
73 using elsc = boost::escaped_list_separator<char>;
91 using vstring = std::vector<std::string>;
92 boost::regex
metacharacters{
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"};
99 set<string> subDirSet;
101 for(
auto iSubDir = subDirs_.begin();
102 iSubDir != subDirs_.end(); ++iSubDir) {
105 if ( subDir[subDir.size()-1] ==
'/' ) subDir.erase(subDir.size()-1);
109 const string searchPath = subDir.substr(0, shiftPos);
110 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
113 findAllSubdirectories (ibooker, igetter, searchPath, &subDirSet, pattern);
117 subDirSet.insert(subDir);
121 for(
auto const &
subDir : subDirSet) {
122 for (
unsigned int iEff = 0; iEff != efficiency_.size(); ++iEff){
123 string eff = efficiency_[iEff];
128 if (!refEff)
continue;
132 for (
auto iTrigger = hltTriggers_.begin();
133 iTrigger != hltTriggers_.end(); ++iTrigger){
134 string trig = *iTrigger;
136 if (!trigEff)
continue;
137 TH1* hRef = refEff -> getTH1();
138 TH1* hTrig = trigEff -> getTH1();
139 TH1* hEff = (TH1*) hTrig->Clone( (
"eff_" + eff +
"_ref").c_str() );
140 hEff->SetTitle(
"Efficiency obtained with reference method");
141 TClass* myHistClass = hTrig->IsA();
142 TString histClassName = myHistClass->GetName();
144 if (histClassName ==
"TH1F"){
145 for (
int bin = 0;
bin < hEff->GetNbinsX(); ++
bin){
146 hEff->SetBinContent(
bin+1, hEff->GetBinContent(
bin+1)*hRef->GetBinContent(
bin+1));
147 hEff->SetBinError (
bin+1, hEff->GetBinContent(
bin+1)*hRef->GetBinError(
bin+1)+hEff->GetBinError(
bin+1)*hRef->GetBinContent(
bin+1));
150 ibooker.
book1D( hEff->GetName(), (TH1F*) hEff);
153 else if (histClassName ==
"TH2F"){
154 for (
int i = 0;
i < hRef->GetXaxis()->GetNbins(); ++
i){
155 for (
int j = 0; j < hRef->GetYaxis()->GetNbins(); ++j){
156 int bin = hEff->GetBin(
i+1,j+1);
157 hEff -> SetBinContent( bin, hRef->GetBinContent(
i+1,j+1) * hTrig->GetBinContent(
i+1) );
161 ibooker.
book2D( hEff->GetName(), (TH2F*) hEff);
164 LogInfo (
"HLTMuonRefMethod") <<
"Histo class type << " << histClassName <<
" not implemented";
186 const TString& _pattern = TString(
"")) {
191 LogError(
"DQMGenericClient") <<
" DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
195 if (pattern.Contains(nonPerlWildcard)) pattern.ReplaceAll(
"*",
".*");
198 vector <string> foundDirs = igetter.
getSubdirs();
199 for(
auto iDir = foundDirs.begin();
200 iDir != foundDirs.end(); ++iDir) {
201 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
202 if (dirName.Contains(regexp))
203 findAllSubdirectories (ibooker, igetter, *iDir, myList);
212 findAllSubdirectories (ibooker, igetter, dir, myList,
"*");
216 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
217 <<
" failed because " << dir <<
" does not exist";
std::vector< std::string > efficiency_
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
TPRegexp metacharacters("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]")
HLTMuonRefMethod(const edm::ParameterSet &set)
std::vector< std::string > subDirs_
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * book1D(Args &&...args)
void beginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * get(std::string const &path)
bin
set the eta bin as selection string.
MonitorElement * book2D(Args &&...args)
bool dirExists(std::string const &path)
std::vector< std::string > refEff_
std::vector< std::string > hltTriggers_
TPRegexp nonPerlWildcard("\\w\\*|^\\*")
std::vector< std::string > getSubdirs()
std::string outputFileName_
void findAllSubdirectories(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &dir, std::set< std::string > *myList, const TString &pattern)