72 using vstring = std::vector<std::string>;
73 boost::regex
metacharacters{
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"};
80 set<string> subDirSet;
82 for (
auto iSubDir =
subDirs_.begin(); iSubDir !=
subDirs_.end(); ++iSubDir) {
85 if (subDir[subDir.size() - 1] ==
'/')
86 subDir.erase(subDir.size() - 1);
90 const string searchPath = subDir.substr(0, shiftPos);
91 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
97 subDirSet.insert(subDir);
101 for (
auto const& subDir : subDirSet) {
102 for (
unsigned int iEff = 0; iEff !=
efficiency_.size(); ++iEff) {
113 string trig = *iTrigger;
114 MonitorElement* trigEff = igetter.get(subDir +
"/" + trig +
"/" + eff);
117 TH1* hRef = refEff->
getTH1();
118 TH1* hTrig = trigEff->
getTH1();
119 TH1* hEff = (TH1*)hTrig->Clone((
"eff_" + eff +
"_ref").c_str());
120 hEff->SetTitle(
"Efficiency obtained with reference method");
121 TClass* myHistClass = hTrig->IsA();
122 TString histClassName = myHistClass->GetName();
124 if (histClassName ==
"TH1F") {
125 for (
int bin = 0;
bin < hEff->GetNbinsX(); ++
bin) {
126 hEff->SetBinContent(
bin + 1, hEff->GetBinContent(
bin + 1) * hRef->GetBinContent(
bin + 1));
127 hEff->SetBinError(
bin + 1,
128 hEff->GetBinContent(
bin + 1) * hRef->GetBinError(
bin + 1) +
129 hEff->GetBinError(
bin + 1) * hRef->GetBinContent(
bin + 1));
131 ibooker.cd(subDir +
"/" + trig);
132 ibooker.book1D(hEff->GetName(), (TH1F*)hEff);
134 }
else if (histClassName ==
"TH2F") {
135 for (
int i = 0;
i < hRef->GetXaxis()->GetNbins(); ++
i) {
136 for (
int j = 0;
j < hRef->GetYaxis()->GetNbins(); ++
j) {
137 int bin = hEff->GetBin(
i + 1,
j + 1);
138 hEff->SetBinContent(bin, hRef->GetBinContent(
i + 1,
j + 1) * hTrig->GetBinContent(
i + 1));
141 ibooker.cd(subDir +
"/" + trig);
142 ibooker.book2D(hEff->GetName(), (TH2F*)hEff);
144 LogInfo(
"HLTMuonRefMethod") <<
"Histo class type << " << histClassName <<
" not implemented";
std::vector< std::string > efficiency_
TPRegexp metacharacters("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]")
std::vector< std::string > subDirs_
std::vector< std::string > refEff_
std::vector< std::string > hltTriggers_
virtual TH1 * getTH1() const
void findAllSubdirectories(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &dir, std::set< std::string > *myList, const TString &pattern)