24 #include <boost/tokenizer.hpp>
31 TPRegexp
metacharacters(
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]");
36 typedef std::vector<edm::ParameterSet> VPSet;
37 typedef std::vector<std::string>
vstring;
38 typedef boost::escaped_list_separator<char> elsc;
40 elsc commonEscapes(
"\\",
" \t",
"\'");
45 vstring effCmds = pset.
getParameter<vstring>(
"efficiency");
46 for ( vstring::const_iterator effCmd = effCmds.begin();
47 effCmd != effCmds.end(); ++effCmd )
49 if ( effCmd->empty() )
continue;
51 boost::tokenizer<elsc> tokens(*effCmd, commonEscapes);
54 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
55 iToken != tokens.end(); ++iToken) {
56 if ( iToken->empty() )
continue;
57 args.push_back(*iToken);
60 if ( args.size() < 4 ) {
61 LogInfo(
"DQMGenericClient") <<
"Wrong input to effCmds\n";
72 const string typeName = args.size() == 4 ?
"eff" : args[4];
73 if ( typeName ==
"eff" ) opt.
type = 1;
74 else if ( typeName ==
"fake" ) opt.
type = 2;
77 efficOptions_.push_back(opt);
81 for ( VPSet::const_iterator
efficSet = efficSets.begin();
85 opt.
name =
efficSet->getUntrackedParameter<
string>(
"name");
91 const string typeName =
efficSet->getUntrackedParameter<
string>(
"typeName",
"eff");
92 if ( typeName ==
"eff" ) opt.
type = 1;
93 else if ( typeName ==
"fake" ) opt.
type = 2;
96 efficOptions_.push_back(opt);
101 for ( vstring::const_iterator effProfileCmd = effProfileCmds.begin();
102 effProfileCmd != effProfileCmds.end(); ++effProfileCmd )
104 if ( effProfileCmd->empty() )
continue;
106 boost::tokenizer<elsc> tokens(*effProfileCmd, commonEscapes);
109 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
110 iToken != tokens.end(); ++iToken) {
111 if ( iToken->empty() )
continue;
112 args.push_back(*iToken);
115 if ( args.size() < 4 ) {
116 LogInfo(
"DQMGenericClient") <<
"Wrong input to effProfileCmds\n";
127 const string typeName = args.size() == 4 ?
"eff" : args[4];
128 if ( typeName ==
"eff" ) opt.
type = 1;
129 else if ( typeName ==
"fake" ) opt.
type = 2;
132 efficOptions_.push_back(opt);
136 for ( VPSet::const_iterator effProfileSet = effProfileSets.begin();
137 effProfileSet != effProfileSets.end(); ++effProfileSet )
140 opt.
name = effProfileSet->getUntrackedParameter<
string>(
"name");
141 opt.
title = effProfileSet->getUntrackedParameter<
string>(
"title");
142 opt.
numerator = effProfileSet->getUntrackedParameter<
string>(
"numerator");
143 opt.
denominator = effProfileSet->getUntrackedParameter<
string>(
"denominator");
146 const string typeName = effProfileSet->getUntrackedParameter<
string>(
"typeName",
"eff");
147 if ( typeName ==
"eff" ) opt.
type = 1;
148 else if ( typeName ==
"fake" ) opt.
type = 2;
151 efficOptions_.push_back(opt);
155 vstring resCmds = pset.
getParameter<vstring>(
"resolution");
156 for ( vstring::const_iterator resCmd = resCmds.begin();
157 resCmd != resCmds.end(); ++resCmd )
159 if ( resCmd->empty() )
continue;
160 boost::tokenizer<elsc> tokens(*resCmd, commonEscapes);
163 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
164 iToken != tokens.end(); ++iToken) {
165 if ( iToken->empty() )
continue;
166 args.push_back(*iToken);
169 if ( args.size() != 3 ) {
170 LogInfo(
"DQMGenericClient") <<
"Wrong input to resCmds\n";
179 resolOptions_.push_back(opt);
183 for ( VPSet::const_iterator resolSet = resolSets.begin();
184 resolSet != resolSets.end(); ++resolSet )
187 opt.
namePrefix = resolSet->getUntrackedParameter<
string>(
"namePrefix");
188 opt.
titlePrefix = resolSet->getUntrackedParameter<
string>(
"titlePrefix");
189 opt.
srcName = resolSet->getUntrackedParameter<
string>(
"srcName");
191 resolOptions_.push_back(opt);
196 for(
const auto& profileCmd: profileCmds) {
197 boost::tokenizer<elsc> tokens(profileCmd, commonEscapes);
200 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
201 iToken != tokens.end(); ++iToken) {
202 if ( iToken->empty() )
continue;
203 args.push_back(*iToken);
206 if ( args.size() != 3 ) {
207 LogInfo(
"DQMGenericClient") <<
"Wrong input to profileCmds\n";
216 profileOptions_.push_back(opt);
220 for(
const auto& profileSet: profileSets) {
222 opt.
name = profileSet.getUntrackedParameter<
string>(
"name");
223 opt.
title = profileSet.getUntrackedParameter<
string>(
"title");
224 opt.
srcName = profileSet.getUntrackedParameter<
string>(
"srcName");
226 profileOptions_.push_back(opt);
231 for ( vstring::const_iterator normCmd = normCmds.begin();
232 normCmd != normCmds.end(); ++normCmd )
234 if ( normCmd->empty() )
continue;
235 boost::tokenizer<elsc> tokens(*normCmd, commonEscapes);
238 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
239 iToken != tokens.end(); ++iToken) {
240 if ( iToken->empty() )
continue;
241 args.push_back(*iToken);
244 if ( args.empty()
or args.size() > 2 ) {
245 LogInfo(
"DQMGenericClient") <<
"Wrong input to normCmds\n";
251 opt.
normHistName = args.size() == 2 ? args[1] : args[0];
253 normOptions_.push_back(opt);
257 for ( VPSet::const_iterator normSet = normSets.begin();
258 normSet != normSets.end(); ++normSet )
261 opt.
name = normSet->getUntrackedParameter<
string>(
"name");
262 opt.
normHistName = normSet->getUntrackedParameter<
string>(
"normalizedTo", opt.
name);
264 normOptions_.push_back(opt);
269 for ( vstring::const_iterator cdCmd = cdCmds.begin();
270 cdCmd != cdCmds.end(); ++cdCmd )
272 if ( cdCmd->empty() )
continue;
273 boost::tokenizer<elsc> tokens(*cdCmd, commonEscapes);
276 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
277 iToken != tokens.end(); ++iToken) {
278 if ( iToken->empty() )
continue;
279 args.push_back(*iToken);
282 if ( args.size() != 1 ) {
283 LogInfo(
"DQMGenericClient") <<
"Wrong input to cdCmds\n";
290 cdOptions_.push_back(opt);
294 for ( VPSet::const_iterator cdSet = cdSets.begin();
295 cdSet != cdSets.end(); ++cdSet )
298 opt.
name = cdSet->getUntrackedParameter<
string>(
"name");
300 cdOptions_.push_back(opt);
307 isWildcardUsed_ =
false;
312 typedef vector<string>
vstring;
333 set<string> subDirSet;
335 for(vstring::const_iterator iSubDir = subDirs_.begin();
336 iSubDir != subDirs_.end(); ++iSubDir) {
337 string subDir = *iSubDir;
339 if ( subDir[subDir.size()-1] ==
'/' ) subDir.erase(subDir.size()-1);
342 isWildcardUsed_ =
true;
345 const string searchPath = subDir.substr(0, shiftPos);
346 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
349 findAllSubdirectories (ibooker, igetter, searchPath, &subDirSet, pattern);
353 subDirSet.insert(subDir);
357 for(set<string>::const_iterator iSubDir = subDirSet.begin();
358 iSubDir != subDirSet.end(); ++iSubDir) {
359 const string&
dirName = *iSubDir;
361 for ( vector<EfficOption>::const_iterator efficOption = efficOptions_.begin();
362 efficOption != efficOptions_.end(); ++efficOption )
364 computeEfficiency(ibooker, igetter, dirName, efficOption->name, efficOption->title,
365 efficOption->numerator, efficOption->denominator,
366 efficOption->type, efficOption->isProfile);
369 for ( vector<ResolOption>::const_iterator resolOption = resolOptions_.begin();
370 resolOption != resolOptions_.end(); ++resolOption )
372 computeResolution(ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
375 for(
const auto& profileOption: profileOptions_) {
376 computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
379 for ( vector<NormOption>::const_iterator normOption = normOptions_.begin();
380 normOption != normOptions_.end(); ++normOption )
382 normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
385 for ( vector<CDOption>::const_iterator cdOption = cdOptions_.begin();
386 cdOption != cdOptions_.end(); ++cdOption )
388 makeCumulativeDist(ibooker, igetter, dirName, cdOption->name);
392 if ( ! outputFileName_.empty() ) theDQM->save(outputFileName_);
397 const string& efficMETitle,
const string& recoMEName,
const string& simMEName,
const int type,
const bool makeProfile)
400 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
401 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
402 <<
"Cannot find sub-directory " << startDir << endl;
409 ME* simME = igetter.
get(startDir+
"/"+simMEName);
410 ME* recoME = igetter.
get(startDir+
"/"+recoMEName);
413 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
414 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
415 <<
"No sim-ME '" << simMEName <<
"' found\n";
421 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
422 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
423 <<
"No reco-ME '" << recoMEName <<
"' found\n";
430 TH1* hSim = simME ->getTH1();
431 TH1* hReco = recoME->getTH1();
433 if ( !hSim || !hReco ) {
434 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
435 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
436 <<
"Cannot create TH1 from ME\n";
441 string efficDir = startDir;
442 string newEfficMEName = efficMEName;
444 if ( string::npos != (shiftPos = efficMEName.rfind(
'/')) ) {
445 efficDir +=
"/"+efficMEName.substr(0, shiftPos);
446 newEfficMEName.erase(0, shiftPos+1);
451 TProfile * efficHist = (hReco->GetXaxis()->GetXbins()->GetSize()==0) ?
452 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
453 hReco->GetXaxis()->GetNbins(),
454 hReco->GetXaxis()->GetXmin(),
455 hReco->GetXaxis()->GetXmax()) :
456 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
457 hReco->GetXaxis()->GetNbins(),
458 hReco->GetXaxis()->GetXbins()->GetArray());
460 efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
461 efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
463 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
464 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
466 const double nReco = hReco->GetBinContent(
i);
467 const double nSim = hSim->GetBinContent(
i);
468 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
470 LogError(
"DQMGenericClient") <<
"computeEfficiency() : "
471 <<
"Overflow: bin content either too large or too small to be casted to int";
476 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
478 if ( nSim == 0 || nReco > nSim )
continue;
479 const double effVal = nReco/nSim;
481 const double errLo = TEfficiency::ClopperPearson((
int)nSim,
484 const double errUp = TEfficiency::ClopperPearson((
int)nSim,
487 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
488 efficHist->SetBinContent(
i, effVal);
489 efficHist->SetBinEntries(
i, 1);
490 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
493 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
495 const double nReco = hReco->GetBinContent(
i);
496 const double nSim = hSim->GetBinContent(
i);
497 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
499 LogError(
"DQMGenericClient") <<
"computeEfficiency() : "
500 <<
"Overflow: bin content either too large or too small to be casted to int";
504 TGraphAsymmErrorsWrapper asymm;
505 std::pair<double, double> efficiencyWithError;
506 efficiencyWithError = asymm.efficiency((
int)nReco,
508 double effVal = efficiencyWithError.first;
509 double errVal = efficiencyWithError.second;
511 efficHist->SetBinContent(
i, effVal);
512 efficHist->SetBinEntries(
i, 1);
513 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
516 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
519 ibooker.
bookProfile(newEfficMEName.c_str(),efficHist);
525 TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
526 efficHist->SetTitle(efficMETitle.c_str());
535 TClass * myHistClass = efficHist->IsA();
536 TString histClassName = myHistClass->GetName();
538 if (histClassName ==
"TH1F"){
539 efficME = ibooker.
book1D(newEfficMEName, (TH1F*)efficHist);
540 }
else if (histClassName ==
"TH2F"){
541 efficME = ibooker.
book2D(newEfficMEName, (TH2F*)efficHist);
542 }
else if (histClassName ==
"TH3F"){
543 efficME = ibooker.
book3D(newEfficMEName, (TH3F*)efficHist);
548 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
549 <<
"Cannot book effic-ME from the DQM\n";
557 generic_eff (hSim, hReco, efficME, type);
570 efficME->setEntries(simME->getEntries());
575 ME* globalEfficME = igetter.
get(efficDir+
"/globalEfficiencies");
576 if ( !globalEfficME ) globalEfficME = ibooker.
book1D(
"globalEfficiencies",
"Global efficiencies", 1, 0, 1);
577 if ( !globalEfficME ) {
578 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
579 <<
"Cannot book globalEffic-ME from the DQM\n";
582 TH1F* hGlobalEffic = globalEfficME->getTH1F();
583 if ( !hGlobalEffic ) {
584 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
585 <<
"Cannot create TH1F from ME, globalEfficME\n";
589 const float nSimAll = hSim->GetEntries();
590 const float nRecoAll = hReco->GetEntries();
592 if ( type == 1 ) efficAll = nSimAll ? nRecoAll/nSimAll : 0;
593 else if ( type == 2 ) efficAll = nSimAll ? 1-nRecoAll/nSimAll : 0;
594 const float errorAll = nSimAll && efficAll < 1 ?
sqrt(efficAll*(1-efficAll)/nSimAll) : 0;
596 const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
597 hGlobalEffic->SetBinContent(iBin, efficAll);
598 hGlobalEffic->SetBinError(iBin, errorAll);
605 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
606 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
607 <<
"Cannot find sub-directory " << startDir << endl;
614 ME* srcME = igetter.
get(startDir+
"/"+srcName);
616 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
617 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
618 <<
"No source ME '" << srcName <<
"' found\n";
623 TH2F* hSrc = srcME->getTH2F();
625 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
626 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
627 <<
"Cannot create TH2F from source-ME\n";
632 const int nBin = hSrc->GetNbinsX();
634 string newDir = startDir;
635 string newPrefix = namePrefix;
637 if ( string::npos != (shiftPos = namePrefix.rfind(
'/')) ) {
638 newDir +=
"/"+namePrefix.substr(0, shiftPos);
639 newPrefix.erase(0, shiftPos+1);
644 float * lowedgesfloats =
new float[nBin+1];
647 if (hSrc->GetXaxis()->GetXbins()->GetSize())
649 for (
int j=0;
j<nBin+1; ++
j)
650 lowedgesfloats[
j] = (
float)hSrc->GetXaxis()->GetXbins()->GetAt(
j);
651 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin, lowedgesfloats);
652 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin, lowedgesfloats);
656 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin,
657 hSrc->GetXaxis()->GetXmin(),
658 hSrc->GetXaxis()->GetXmax());
659 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin,
660 hSrc->GetXaxis()->GetXmin(),
661 hSrc->GetXaxis()->GetXmax());
664 if (meanME && sigmaME)
666 meanME->setEfficiencyFlag();
667 sigmaME->setEfficiencyFlag();
669 if (! resLimitedFit_ ) {
675 limitedFit(srcME,meanME,sigmaME);
678 delete[] lowedgesfloats;
683 if(verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
684 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
685 <<
"Cannot find sub-directory " << startDir << endl;
692 ME* srcME = igetter.
get(startDir+
"/"+srcMEName);
694 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
695 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
696 <<
"No source ME '" << srcMEName <<
"' found\n";
701 TH2F* hSrc = srcME->getTH2F();
703 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
704 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
705 <<
"Cannot create TH2F from source-ME\n";
710 string profileDir = startDir;
711 string newProfileMEName = profileMEName;
713 if ( string::npos != (shiftPos = profileMEName.rfind(
'/')) ) {
714 profileDir +=
"/"+profileMEName.substr(0, shiftPos);
715 newProfileMEName.erase(0, shiftPos+1);
719 std::unique_ptr<TProfile> profile(hSrc->ProfileX());
720 profile->SetTitle(profileMETitle.c_str());
729 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
730 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
731 <<
"Cannot find sub-directory " << startDir << endl;
738 ME* element = igetter.
get(startDir+
"/"+histName);
739 ME* normME = igetter.
get(startDir+
"/"+normHistName);
742 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
743 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
744 <<
"No such element '" << histName <<
"' found\n";
750 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
751 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
752 <<
"No such element '" << normHistName <<
"' found\n";
757 TH1F*
hist = element->getTH1F();
759 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
760 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
761 <<
"Cannot create TH1F from ME\n";
766 TH1F* normHist = normME->getTH1F();
768 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
769 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
770 <<
"Cannot create TH1F from ME\n";
775 const double entries = normHist->GetEntries();
776 if ( entries != 0 ) {
777 hist->Scale(1./entries);
780 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
781 <<
"Zero entries in histogram\n";
790 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
791 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
792 <<
"Cannot find sub-directory " << startDir << endl;
799 ME* element_cd = igetter.
get(startDir+
"/"+cdName);
802 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
803 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
804 <<
"No such element '" << cdName <<
"' found\n";
809 TH1F* cd = element_cd->getTH1F();
812 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
813 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
814 <<
"Cannot create TH1F from ME\n";
819 int n_bins = cd->GetNbinsX() + 1;
821 for (
int i = 1;
i <= n_bins;
i++) {
822 cd->SetBinContent(
i,cd->GetBinContent(
i) + cd->GetBinContent(
i-1));
836 double cont_min = 100;
837 Int_t binx = histo->GetXaxis()->GetNbins();
839 for (
int i = 1; i <= binx ; i++) {
841 TH1 *histoY = histo->ProjectionY(
" ", i, i);
842 double cont = histoY->GetEntries();
844 if (cont >= cont_min) {
845 float minfit = histoY->GetMean() - histoY->GetRMS();
846 float maxfit = histoY->GetMean() + histoY->GetRMS();
848 TF1 *fitFcn =
new TF1(TString(
"g")+histo->GetName()+iString,
"gaus",minfit,maxfit);
850 fitFcn->GetRange(x1,x2);
852 histoY->Fit(fitFcn,
"QR0",
"",x1,x2);
855 double *par = fitFcn->GetParameters();
856 double *err = fitFcn->GetParErrors();
868 if(fitFcn)
delete fitFcn;
869 if(histoY)
delete histoY;
872 if(histoY)
delete histoY;
881 const TString& _pattern = TString(
"")) {
884 LogError(
"DQMGenericClient") <<
" DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
889 TPRegexp regexp(pattern);
891 vector <string> foundDirs = igetter.
getSubdirs();
892 for(vector<string>::const_iterator iDir = foundDirs.begin();
893 iDir != foundDirs.end(); ++iDir) {
894 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
895 if (dirName.Contains(regexp))
896 findAllSubdirectories (ibooker, igetter, *iDir, myList);
905 findAllSubdirectories (ibooker, igetter, dir, myList,
"*");
909 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
910 <<
" failed because " << dir <<
" does not exist";
918 for (
int iBinX = 1; iBinX < denom->GetNbinsX()+1; iBinX++){
919 for (
int iBinY = 1; iBinY < denom->GetNbinsY()+1; iBinY++){
920 for (
int iBinZ = 1; iBinZ < denom->GetNbinsZ()+1; iBinZ++){
922 int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
924 float numerVal = numer->GetBinContent(globalBinNum);
925 float denomVal = denom->GetBinContent(globalBinNum);
931 effVal = denomVal ? (1 - numerVal / denomVal) : 0;
933 effVal = denomVal ? numerVal / denomVal : 0;
936 float errVal = (denomVal && (effVal <=1)) ?
sqrt(effVal*(1-effVal)/denomVal) : 0;
938 LogDebug (
"DQMGenericClient") <<
"(iBinX, iBinY, iBinZ) = "
941 << iBinZ <<
"), global bin = " << globalBinNum
942 <<
"eff = " << numerVal <<
" / " << denomVal
944 <<
" ... setting the error for that bin ... " << endl
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void setBinContent(int binx, double content)
set content of bin (1-D)
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
MonitorElement * bookProfile(Args &&...args)
MonitorElement * get(const std::string &path)
TPRegexp metacharacters("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]")
void normalizeToEntries(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &histName, const std::string &normHistName)
MonitorElement * book1D(Args &&...args)
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 setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
bool dirExists(const std::string &path)
void findAllSubdirectories(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string dir, std::set< std::string > *myList, const TString &pattern)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::vector< std::string > getSubdirs(void)
TPRegexp nonPerlWildcard("\\w\\*|^\\*")
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 int type=1, const bool makeProfile=false)
void makeCumulativeDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName)
void setEfficiencyFlag(void)
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)
TH2F * getTH2F(void) const
MonitorElement * book3D(Args &&...args)
void limitedFit(MonitorElement *srcME, MonitorElement *meanME, MonitorElement *sigmaME)
void generic_eff(TH1 *denom, TH1 *numer, MonitorElement *efficiencyHist, const int type=1)