22 #include <TDirectory.h>
23 #include <TEfficiency.h>
30 #include <boost/tokenizer.hpp>
87 const bool makeProfile =
false);
110 bool ascending =
true);
144 std::set<std::string>*
myList,
145 const TString& pattern);
156 const bool oldAddDir = TH1::AddDirectoryStatus();
157 TH1::AddDirectory(
true);
160 TF1 fgaus(
"fgaus",
"gaus", h->GetYaxis()->GetXmin(), h->GetYaxis()->GetXmax(), TF1::EAddToList::kNo);
161 h->FitSlicesY(&fgaus, 0, -1, 0,
"QNR SERIAL");
162 string name(h->GetName());
163 h0 = (TH1*)gDirectory->Get((
name +
"_0").c_str());
164 h1 = (TH1*)gDirectory->Get((
name +
"_1").c_str());
165 h2 = (TH1*)gDirectory->Get((
name +
"_2").c_str());
166 h3 = (TH1*)gDirectory->Get((
name +
"_chi2").c_str());
167 TH1::AddDirectory(oldAddDir);
180 throw cms::Exception(
"FitSlicesYTool") <<
"Pointer =0 : h1=" << h1 <<
" me=" <<
me;
181 if (h1->GetNbinsX() == me->getNbinsX()) {
182 for (
int bin = 0;
bin != h1->GetNbinsX();
bin++) {
183 me->setBinContent(
bin + 1, h1->GetBinContent(
bin + 1));
187 throw cms::Exception(
"FitSlicesYTool") <<
"Different number of bins!";
193 throw cms::Exception(
"FitSlicesYTool") <<
"Pointer =0 : h1=" << h1 <<
" me=" <<
me;
194 if (h2->GetNbinsX() == me->getNbinsX()) {
195 for (
int bin = 0;
bin != h2->GetNbinsX();
bin++) {
196 me->setBinContent(
bin + 1, h2->GetBinContent(
bin + 1));
200 throw cms::Exception(
"FitSlicesYTool") <<
"Different number of bins!";
206 throw cms::Exception(
"FitSlicesYTool") <<
"Pointer =0 : h1=" << h1 <<
" me=" <<
me;
207 if (h1->GetNbinsX() == me->getNbinsX()) {
208 for (
int bin = 0;
bin != h1->GetNbinsX();
bin++) {
209 me->setBinContent(
bin + 1, h1->GetBinContent(
bin + 1));
211 me->setBinError(
bin + 1, h1->GetBinError(
bin + 1));
214 throw cms::Exception(
"FitSlicesYTool") <<
"Different number of bins!";
220 throw cms::Exception(
"FitSlicesYTool") <<
"Pointer =0 : h1=" << h1 <<
" me=" <<
me;
221 if (h2->GetNbinsX() == me->getNbinsX()) {
222 for (
int bin = 0;
bin != h2->GetNbinsX();
bin++) {
223 me->setBinContent(
bin + 1, h2->GetBinContent(
bin + 1));
225 me->setBinError(
bin + 1, h2->GetBinError(
bin + 1));
228 throw cms::Exception(
"FitSlicesYTool") <<
"Different number of bins!";
242 : metacharacters_(
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"), nonPerlWildcard_(
"\\w\\*|^\\*") {
243 typedef std::vector<edm::ParameterSet>
VPSet;
244 typedef std::vector<std::string>
vstring;
245 typedef boost::escaped_list_separator<char> elsc;
247 elsc commonEscapes(
"\\",
" \t",
"\'");
255 vstring effCmds = pset.
getParameter<vstring>(
"efficiency");
256 for (vstring::const_iterator effCmd = effCmds.begin(); effCmd != effCmds.end(); ++effCmd) {
260 boost::tokenizer<elsc> tokens(*effCmd, commonEscapes);
263 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
266 args.push_back(*iToken);
269 if (args.size() < 4) {
270 LogInfo(
"DQMGenericClient") <<
"Wrong input to effCmds\n";
281 const string typeName = args.size() == 4 ?
"eff" : args[4];
282 if (typeName ==
"eff")
284 else if (typeName ==
"fake")
286 else if (typeName ==
"simpleratio")
297 opt.
name =
efficSet->getUntrackedParameter<
string>(
"name");
298 opt.
title =
efficSet->getUntrackedParameter<
string>(
"title");
303 const string typeName =
efficSet->getUntrackedParameter<
string>(
"typeName",
"eff");
304 if (typeName ==
"eff")
306 else if (typeName ==
"fake")
308 else if (typeName ==
"simpleratio")
318 for (vstring::const_iterator effProfileCmd = effProfileCmds.begin(); effProfileCmd != effProfileCmds.end();
320 if (effProfileCmd->empty())
323 boost::tokenizer<elsc> tokens(*effProfileCmd, commonEscapes);
326 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
329 args.push_back(*iToken);
332 if (args.size() < 4) {
333 LogInfo(
"DQMGenericClient") <<
"Wrong input to effProfileCmds\n";
344 const string typeName = args.size() == 4 ?
"eff" : args[4];
345 if (typeName ==
"eff")
347 else if (typeName ==
"fake")
349 else if (typeName ==
"simpleratio")
358 for (VPSet::const_iterator effProfileSet = effProfileSets.begin(); effProfileSet != effProfileSets.end();
361 opt.
name = effProfileSet->getUntrackedParameter<
string>(
"name");
362 opt.
title = effProfileSet->getUntrackedParameter<
string>(
"title");
363 opt.
numerator = effProfileSet->getUntrackedParameter<
string>(
"numerator");
364 opt.
denominator = effProfileSet->getUntrackedParameter<
string>(
"denominator");
367 const string typeName = effProfileSet->getUntrackedParameter<
string>(
"typeName",
"eff");
368 if (typeName ==
"eff")
370 else if (typeName ==
"fake")
372 else if (typeName ==
"simpleratio")
381 vstring resCmds = pset.
getParameter<vstring>(
"resolution");
382 for (vstring::const_iterator resCmd = resCmds.begin(); resCmd != resCmds.end(); ++resCmd) {
385 boost::tokenizer<elsc> tokens(*resCmd, commonEscapes);
388 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
391 args.push_back(*iToken);
394 if (args.size() != 3) {
395 LogInfo(
"DQMGenericClient") <<
"Wrong input to resCmds\n";
408 for (VPSet::const_iterator resolSet = resolSets.begin(); resolSet != resolSets.end(); ++resolSet) {
410 opt.
namePrefix = resolSet->getUntrackedParameter<
string>(
"namePrefix");
411 opt.
titlePrefix = resolSet->getUntrackedParameter<
string>(
"titlePrefix");
412 opt.
srcName = resolSet->getUntrackedParameter<
string>(
"srcName");
419 for (
const auto& profileCmd : profileCmds) {
420 boost::tokenizer<elsc> tokens(profileCmd, commonEscapes);
423 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
426 args.push_back(*iToken);
429 if (args.size() != 3) {
430 LogInfo(
"DQMGenericClient") <<
"Wrong input to profileCmds\n";
443 for (
const auto& profileSet : profileSets) {
445 opt.
name = profileSet.getUntrackedParameter<
string>(
"name");
446 opt.
title = profileSet.getUntrackedParameter<
string>(
"title");
447 opt.
srcName = profileSet.getUntrackedParameter<
string>(
"srcName");
454 for (vstring::const_iterator normCmd = normCmds.begin(); normCmd != normCmds.end(); ++normCmd) {
455 if (normCmd->empty())
457 boost::tokenizer<elsc> tokens(*normCmd, commonEscapes);
460 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
463 args.push_back(*iToken);
466 if (args.empty()
or args.size() > 2) {
467 LogInfo(
"DQMGenericClient") <<
"Wrong input to normCmds\n";
473 opt.
normHistName = args.size() == 2 ? args[1] : args[0];
479 for (VPSet::const_iterator normSet = normSets.begin(); normSet != normSets.end(); ++normSet) {
481 opt.
name = normSet->getUntrackedParameter<
string>(
"name");
482 opt.
normHistName = normSet->getUntrackedParameter<
string>(
"normalizedTo", opt.
name);
489 for (vstring::const_iterator cdCmd = cdCmds.begin(); cdCmd != cdCmds.end(); ++cdCmd) {
492 boost::tokenizer<elsc> tokens(*cdCmd, commonEscapes);
495 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
498 args.push_back(*iToken);
501 if (args.empty() || args.size() > 2) {
502 LogInfo(
"DQMGenericClient") <<
"Wrong input to cdCmds\n";
508 opt.
ascending = args.size() == 2 ? (args[1] !=
"descending") :
true;
514 for (VPSet::const_iterator cdSet = cdSets.begin(); cdSet != cdSets.end(); ++cdSet) {
516 opt.
name = cdSet->getUntrackedParameter<
string>(
"name");
517 opt.
ascending = cdSet->getUntrackedParameter<
bool>(
"ascending",
true);
524 for (vstring::const_iterator noFlowCmd = noFlowCmds.begin(); noFlowCmd != noFlowCmds.end(); ++noFlowCmd) {
525 if (noFlowCmd->empty())
527 boost::tokenizer<elsc> tokens(*noFlowCmd, commonEscapes);
530 for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
533 args.push_back(*iToken);
536 if (args.empty() || args.size() > 2) {
537 LogInfo(
"DQMGenericClient") <<
"Wrong input to noFlowCmds\n";
548 for (VPSet::const_iterator noFlowSet = noFlowSets.begin(); noFlowSet != noFlowSets.end(); ++noFlowSet) {
550 opt.
name = noFlowSet->getUntrackedParameter<
string>(
"name");
600 typedef vector<string>
vstring;
603 set<string> subDirSet;
605 for (vstring::const_iterator iSubDir =
subDirs_.begin(); iSubDir !=
subDirs_.end(); ++iSubDir) {
606 string subDir = *iSubDir;
608 if (subDir[subDir.size() - 1] ==
'/')
609 subDir.erase(subDir.size() - 1);
615 const string searchPath = subDir.substr(0, shiftPos);
616 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
622 subDirSet.insert(subDir);
626 for (set<string>::const_iterator iSubDir = subDirSet.begin(); iSubDir != subDirSet.end(); ++iSubDir) {
627 const string&
dirName = *iSubDir;
634 normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
637 for (vector<NoFlowOption>::const_iterator noFlowOption =
noFlowOptions_.begin();
643 for (vector<CDOption>::const_iterator cdOption =
cdOptions_.begin(); cdOption !=
cdOptions_.end(); ++cdOption) {
654 efficOption->numerator,
655 efficOption->denominator,
657 efficOption->isProfile);
663 ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
667 computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
674 const string& startDir,
675 const string& efficMEName,
676 const string& efficMETitle,
677 const string& recoMEName,
678 const string& simMEName,
680 const bool makeProfile) {
683 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
684 <<
"Cannot find sub-directory " << startDir << endl;
691 ME* simME = igetter.
get(startDir +
"/" + simMEName);
692 ME* recoME = igetter.
get(startDir +
"/" + recoMEName);
696 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
697 <<
"No sim-ME '" << simMEName <<
"' found\n";
704 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
705 <<
"No reco-ME '" << recoMEName <<
"' found\n";
712 TH1* hSim = simME->getTH1();
713 TH1* hReco = recoME->getTH1();
715 if (!hSim || !hReco) {
717 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
718 <<
"Cannot create TH1 from ME\n";
723 string efficDir = startDir;
724 string newEfficMEName = efficMEName;
726 if (string::npos != (shiftPos = efficMEName.rfind(
'/'))) {
727 efficDir +=
"/" + efficMEName.substr(0, shiftPos);
728 newEfficMEName.erase(0, shiftPos + 1);
733 TProfile* efficHist = (hReco->GetXaxis()->GetXbins()->GetSize() == 0)
734 ?
new TProfile(newEfficMEName.c_str(),
735 efficMETitle.c_str(),
736 hReco->GetXaxis()->GetNbins(),
737 hReco->GetXaxis()->GetXmin(),
738 hReco->GetXaxis()->GetXmax())
739 :
new TProfile(newEfficMEName.c_str(),
740 efficMETitle.c_str(),
741 hReco->GetXaxis()->GetNbins(),
742 hReco->GetXaxis()->GetXbins()->GetArray());
744 efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
745 efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
747 for (
int i = 1;
i <= hReco->GetNbinsX();
i++) {
748 const double nReco = hReco->GetBinContent(
i);
749 const double nSim = hSim->GetBinContent(
i);
752 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
754 if (nSim == 0
or nReco < 0 or nReco > nSim)
756 const double effVal = nReco / nSim;
757 const double errLo = TEfficiency::ClopperPearson(nSim, nReco, 0.683,
false);
758 const double errUp = TEfficiency::ClopperPearson(nSim, nReco, 0.683,
true);
759 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
760 efficHist->SetBinContent(
i, effVal);
761 efficHist->SetBinEntries(
i, 1);
762 efficHist->SetBinError(
i, std::hypot(effVal, errVal));
769 TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
770 efficHist->SetTitle(efficMETitle.c_str());
775 ME* efficME =
nullptr;
779 TClass* myHistClass = efficHist->IsA();
780 TString histClassName = myHistClass->GetName();
782 if (histClassName ==
"TH1F") {
783 efficME = ibooker.
book1D(newEfficMEName, (TH1F*)efficHist);
784 }
else if (histClassName ==
"TH2F") {
785 efficME = ibooker.
book2D(newEfficMEName, (TH2F*)efficHist);
786 }
else if (histClassName ==
"TH3F") {
787 efficME = ibooker.
book3D(newEfficMEName, (TH3F*)efficHist);
793 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
794 <<
"Cannot book effic-ME from the DQM\n";
815 efficME->setEntries(simME->getEntries());
820 ME* globalEfficME = igetter.
get(efficDir +
"/globalEfficiencies");
822 globalEfficME = ibooker.
book1D(
"globalEfficiencies",
"Global efficiencies", 1, 0, 1);
823 if (!globalEfficME) {
824 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
825 <<
"Cannot book globalEffic-ME from the DQM\n";
828 globalEfficME->setEfficiencyFlag();
829 TH1F* hGlobalEffic = globalEfficME->getTH1F();
831 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
832 <<
"Cannot create TH1F from ME, globalEfficME\n";
836 const float nSimAll = hSim->GetEntries();
837 const float nRecoAll = hReco->GetEntries();
840 efficAll = nSimAll ? nRecoAll / nSimAll : 0;
842 efficAll = nSimAll ? 1 - nRecoAll / nSimAll : 0;
846 const float x = nRecoAll / nSimAll;
847 errorAll =
std::sqrt(1.
f / nSimAll * x * (1 + x));
850 errorAll = nSimAll && efficAll < 1 ?
sqrt(efficAll * (1 - efficAll) / nSimAll) : 0;
852 const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
853 hGlobalEffic->SetBinContent(iBin, efficAll);
854 hGlobalEffic->SetBinError(iBin, errorAll);
860 const string& startDir,
861 const string& namePrefix,
862 const string& titlePrefix,
866 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
867 <<
"Cannot find sub-directory " << startDir << endl;
874 ME* srcME = igetter.
get(startDir +
"/" + srcName);
877 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
878 <<
"No source ME '" << srcName <<
"' found\n";
883 TH2F* hSrc = srcME->getTH2F();
886 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
887 <<
"Cannot create TH2F from source-ME\n";
892 const int nBin = hSrc->GetNbinsX();
894 string newDir = startDir;
895 string newPrefix = namePrefix;
897 if (string::npos != (shiftPos = namePrefix.rfind(
'/'))) {
898 newDir +=
"/" + namePrefix.substr(0, shiftPos);
899 newPrefix.erase(0, shiftPos + 1);
904 float* lowedgesfloats =
new float[nBin + 1];
907 if (hSrc->GetXaxis()->GetXbins()->GetSize()) {
908 for (
int j = 0;
j < nBin + 1; ++
j)
909 lowedgesfloats[
j] = (
float)hSrc->GetXaxis()->GetXbins()->GetAt(
j);
910 meanME = ibooker.
book1D(newPrefix +
"_Mean", titlePrefix +
" Mean", nBin, lowedgesfloats);
911 sigmaME = ibooker.
book1D(newPrefix +
"_Sigma", titlePrefix +
" Sigma", nBin, lowedgesfloats);
914 newPrefix +
"_Mean", titlePrefix +
" Mean", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
916 newPrefix +
"_Sigma", titlePrefix +
" Sigma", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
919 if (meanME && sigmaME) {
920 meanME->setEfficiencyFlag();
921 sigmaME->setEfficiencyFlag();
932 delete[] lowedgesfloats;
943 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
944 <<
"Cannot find sub-directory " << startDir << endl;
951 ME* srcME = igetter.
get(startDir +
"/" + srcMEName);
954 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
955 <<
"No source ME '" << srcMEName <<
"' found\n";
960 TH2F* hSrc = srcME->getTH2F();
963 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
964 <<
"Cannot create TH2F from source-ME\n";
969 string profileDir = startDir;
970 string newProfileMEName = profileMEName;
972 if (string::npos != (shiftPos = profileMEName.rfind(
'/'))) {
973 profileDir +=
"/" + profileMEName.substr(0, shiftPos);
974 newProfileMEName.erase(0, shiftPos + 1);
978 std::unique_ptr<TProfile> profile(hSrc->ProfileX());
979 profile->SetTitle(profileMETitle.c_str());
990 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
991 <<
"Cannot find sub-directory " << startDir << endl;
998 ME* element = igetter.
get(startDir +
"/" + histName);
999 ME* normME = igetter.
get(startDir +
"/" + normHistName);
1003 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
1004 <<
"No such element '" << histName <<
"' found\n";
1011 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
1012 <<
"No such element '" << normHistName <<
"' found\n";
1017 TH1F*
hist = element->getTH1F();
1020 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
1021 <<
"Cannot create TH1F from ME\n";
1026 TH1F* normHist = normME->getTH1F();
1029 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
1030 <<
"Cannot create TH1F from ME\n";
1035 const double entries = normHist->GetEntries();
1037 hist->Scale(1. / entries);
1039 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
1040 <<
"Zero entries in histogram\n";
1053 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
1054 <<
"Cannot find sub-directory " << startDir << endl;
1061 ME* element_cd = igetter.
get(startDir +
"/" + cdName);
1065 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
1066 <<
"No such element '" << cdName <<
"' found\n";
1071 TH1F*
cd = element_cd->getTH1F();
1075 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
1076 <<
"Cannot create TH1F from ME\n";
1081 int n_bins = cd->GetNbinsX() + 1;
1084 for (
int i = 1;
i <= n_bins;
i++) {
1085 cd->SetBinContent(
i, cd->GetBinContent(
i) + cd->GetBinContent(
i - 1));
1088 for (
int i = n_bins - 1;
i >= 0;
i--) {
1089 cd->SetBinContent(
i, cd->GetBinContent(
i) + cd->GetBinContent(
i + 1));
1102 LogInfo(
"DQMGenericClient") <<
"makeNoFlowDist() : "
1103 <<
"Cannot find sub-directory " << startDir << endl;
1110 ME* element_noFlow = igetter.
get(startDir +
"/" + noFlowName);
1112 if (!element_noFlow) {
1114 LogInfo(
"DQMGenericClient") <<
"makeNoFlowDist() : "
1115 <<
"No such element '" << noFlowName <<
"' found\n";
1120 TH1F* noFlow = element_noFlow->getTH1F();
1124 LogInfo(
"DQMGenericClient") <<
"makeNoFlowDist() : "
1125 <<
"Cannot create TH1F from ME\n";
1130 noFlow->AddBinContent(1, noFlow->GetBinContent(0));
1131 noFlow->SetBinContent(0, 0.);
1133 const auto lastBin = noFlow->GetNbinsX();
1134 noFlow->AddBinContent(lastBin, noFlow->GetBinContent(lastBin + 1));
1135 noFlow->SetBinContent(lastBin + 1, 0.);
1145 double cont_min = 100;
1146 Int_t binx = histo->GetXaxis()->GetNbins();
1148 for (
int i = 1; i <= binx; i++) {
1150 TH1* histoY = histo->ProjectionY(
" ", i, i);
1151 double cont = histoY->GetEntries();
1153 if (cont >= cont_min) {
1154 float minfit = histoY->GetMean() - histoY->GetRMS();
1155 float maxfit = histoY->GetMean() + histoY->GetRMS();
1157 TF1* fitFcn =
new TF1(TString(
"g") + histo->GetName() + iString,
"gaus", minfit, maxfit);
1159 fitFcn->GetRange(x1, x2);
1161 fitFcn->SetParameters(histoY->Integral(), histoY->GetMean(), histoY->GetRMS());
1163 histoY->Fit(fitFcn,
"QR0 SERIAL",
"", x1, x2);
1166 double* par = fitFcn->GetParameters();
1167 const double*
err = fitFcn->GetParErrors();
1196 std::set<std::string>*
myList,
1197 const TString& _pattern = TString(
"")) {
1198 TString pattern = _pattern;
1200 LogError(
"DQMGenericClient") <<
" DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
1203 if (pattern !=
"") {
1205 pattern.ReplaceAll(
"*",
".*");
1206 TPRegexp regexp(pattern);
1208 vector<string> foundDirs = igetter.
getSubdirs();
1209 for (vector<string>::const_iterator iDir = foundDirs.begin(); iDir != foundDirs.end(); ++iDir) {
1210 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
1211 if (dirName.Contains(regexp))
1218 myList->insert(dir);
1225 LogInfo(
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir <<
" failed because " << dir
1226 <<
" does not exist";
1232 for (
int iBinX = 1; iBinX < denom->GetNbinsX() + 1; iBinX++) {
1233 for (
int iBinY = 1; iBinY < denom->GetNbinsY() + 1; iBinY++) {
1234 for (
int iBinZ = 1; iBinZ < denom->GetNbinsZ() + 1; iBinZ++) {
1235 int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
1237 float numerVal = numer->GetBinContent(globalBinNum);
1238 float denomVal = denom->GetBinContent(globalBinNum);
1244 effVal = denomVal ? (1 - numerVal / denomVal) : 0;
1246 effVal = denomVal ? numerVal / denomVal : 0;
1252 float numerErr = numer->GetBinError(globalBinNum);
1253 float denomErr = denom->GetBinError(globalBinNum);
1254 float denomsq = denomVal * denomVal;
1255 errVal = denomVal ?
sqrt(
pow(1.
f / denomVal * numerErr, 2.0) +
pow(numerVal / denomsq * denomErr, 2)) : 0;
1257 errVal = (denomVal && (effVal <= 1)) ?
sqrt(effVal * (1 - effVal) / denomVal) : 0;
1260 LogDebug(
"DQMGenericClient") <<
"(iBinX, iBinY, iBinZ) = " << iBinX <<
", " << iBinY <<
", " << iBinZ
1261 <<
"), global bin = " << globalBinNum <<
"eff = " << numerVal <<
" / "
1262 << denomVal <<
" = " << effVal <<
" ... setting the error for that bin ... "
1267 efficiencyHist->
setBinError(globalBinNum, errVal);
std::vector< EfficOption > efficOptions_
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual TH2F * getTH2F() const
const edm::EventSetup & c
std::vector< ProfileOption > profileOptions_
tuple cont
load Luminosity info ##
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
#define DEFINE_FWK_MODULE(type)
virtual bool dirExists(std::string const &path) const
void makeCumulativeDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName, bool ascending=true)
Log< level::Error, false > LogError
TPRegexp nonPerlWildcard_
std::vector< ResolOption > resolOptions_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
std::vector< std::string > subDirs_
void makeAllPlots(DQMStore::IBooker &, DQMStore::IGetter &)
virtual MonitorElement * get(std::string const &fullpath) const
void normalizeToEntries(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &histName, const std::string &normHistName)
void computeResolution(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &fitMEPrefix, const std::string &fitMETitlePrefix, const std::string &srcMEName)
void makeNoFlowDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName)
std::string outputFileName_
Log< level::Info, false > LogInfo
void findAllSubdirectories(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string dir, std::set< std::string > *myList, const TString &pattern)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
dqm::legacy::MonitorElement MonitorElement
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
std::vector< CDOption > cdOptions_
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
void computeEfficiency(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &efficMEName, const std::string &efficMETitle, const std::string &recoMEName, const std::string &simMEName, const EfficType type=EfficType::efficiency, const bool makeProfile=false)
dqm::harvesting::MonitorElement ME
std::vector< NoFlowOption > noFlowOptions_
~DQMGenericClient() override
DQMGenericClient(const edm::ParameterSet &pset)
void computeProfile(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &profileMEName, const std::string &profileMETitle, const std::string &srcMEName)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Power< A, B >::type pow(const A &a, const B &b)
void limitedFit(MonitorElement *srcME, MonitorElement *meanME, MonitorElement *sigmaME)
void generic_eff(TH1 *denom, TH1 *numer, MonitorElement *efficiencyHist, const EfficType type=EfficType::efficiency)
std::vector< NormOption > normOptions_