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];
74 else if ( typeName ==
"fake" ) opt.
type = EfficType::fakerate;
75 else if ( typeName ==
"simpleratio" ) opt.
type = EfficType::simpleratio;
78 efficOptions_.push_back(opt);
82 for ( VPSet::const_iterator
efficSet = efficSets.begin();
86 opt.
name =
efficSet->getUntrackedParameter<
string>(
"name");
92 const string typeName =
efficSet->getUntrackedParameter<
string>(
"typeName",
"eff");
94 else if ( typeName ==
"fake" ) opt.
type = EfficType::fakerate;
95 else if ( typeName ==
"simpleratio" ) opt.
type = EfficType::simpleratio;
98 efficOptions_.push_back(opt);
103 for ( vstring::const_iterator effProfileCmd = effProfileCmds.begin();
104 effProfileCmd != effProfileCmds.end(); ++effProfileCmd )
106 if ( effProfileCmd->empty() )
continue;
108 boost::tokenizer<elsc> tokens(*effProfileCmd, commonEscapes);
111 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
112 iToken != tokens.end(); ++iToken) {
113 if ( iToken->empty() )
continue;
114 args.push_back(*iToken);
117 if ( args.size() < 4 ) {
118 LogInfo(
"DQMGenericClient") <<
"Wrong input to effProfileCmds\n";
129 const string typeName = args.size() == 4 ?
"eff" : args[4];
131 else if ( typeName ==
"fake" ) opt.
type = EfficType::fakerate;
132 else if ( typeName ==
"simpleratio" ) opt.
type = EfficType::simpleratio;
135 efficOptions_.push_back(opt);
139 for ( VPSet::const_iterator effProfileSet = effProfileSets.begin();
140 effProfileSet != effProfileSets.end(); ++effProfileSet )
143 opt.
name = effProfileSet->getUntrackedParameter<
string>(
"name");
144 opt.
title = effProfileSet->getUntrackedParameter<
string>(
"title");
145 opt.
numerator = effProfileSet->getUntrackedParameter<
string>(
"numerator");
146 opt.
denominator = effProfileSet->getUntrackedParameter<
string>(
"denominator");
149 const string typeName = effProfileSet->getUntrackedParameter<
string>(
"typeName",
"eff");
151 else if ( typeName ==
"fake" ) opt.
type = EfficType::fakerate;
152 else if ( typeName ==
"simpleratio" ) opt.
type = EfficType::simpleratio;
155 efficOptions_.push_back(opt);
159 vstring resCmds = pset.
getParameter<vstring>(
"resolution");
160 for ( vstring::const_iterator resCmd = resCmds.begin();
161 resCmd != resCmds.end(); ++resCmd )
163 if ( resCmd->empty() )
continue;
164 boost::tokenizer<elsc> tokens(*resCmd, commonEscapes);
167 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
168 iToken != tokens.end(); ++iToken) {
169 if ( iToken->empty() )
continue;
170 args.push_back(*iToken);
173 if ( args.size() != 3 ) {
174 LogInfo(
"DQMGenericClient") <<
"Wrong input to resCmds\n";
183 resolOptions_.push_back(opt);
187 for ( VPSet::const_iterator resolSet = resolSets.begin();
188 resolSet != resolSets.end(); ++resolSet )
191 opt.
namePrefix = resolSet->getUntrackedParameter<
string>(
"namePrefix");
192 opt.
titlePrefix = resolSet->getUntrackedParameter<
string>(
"titlePrefix");
193 opt.
srcName = resolSet->getUntrackedParameter<
string>(
"srcName");
195 resolOptions_.push_back(opt);
200 for(
const auto& profileCmd: profileCmds) {
201 boost::tokenizer<elsc> tokens(profileCmd, commonEscapes);
204 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
205 iToken != tokens.end(); ++iToken) {
206 if ( iToken->empty() )
continue;
207 args.push_back(*iToken);
210 if ( args.size() != 3 ) {
211 LogInfo(
"DQMGenericClient") <<
"Wrong input to profileCmds\n";
220 profileOptions_.push_back(opt);
224 for(
const auto& profileSet: profileSets) {
226 opt.
name = profileSet.getUntrackedParameter<
string>(
"name");
227 opt.
title = profileSet.getUntrackedParameter<
string>(
"title");
228 opt.
srcName = profileSet.getUntrackedParameter<
string>(
"srcName");
230 profileOptions_.push_back(opt);
235 for ( vstring::const_iterator normCmd = normCmds.begin();
236 normCmd != normCmds.end(); ++normCmd )
238 if ( normCmd->empty() )
continue;
239 boost::tokenizer<elsc> tokens(*normCmd, commonEscapes);
242 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
243 iToken != tokens.end(); ++iToken) {
244 if ( iToken->empty() )
continue;
245 args.push_back(*iToken);
248 if ( args.empty()
or args.size() > 2 ) {
249 LogInfo(
"DQMGenericClient") <<
"Wrong input to normCmds\n";
255 opt.
normHistName = args.size() == 2 ? args[1] : args[0];
257 normOptions_.push_back(opt);
261 for ( VPSet::const_iterator normSet = normSets.begin();
262 normSet != normSets.end(); ++normSet )
265 opt.
name = normSet->getUntrackedParameter<
string>(
"name");
266 opt.
normHistName = normSet->getUntrackedParameter<
string>(
"normalizedTo", opt.
name);
268 normOptions_.push_back(opt);
273 for ( vstring::const_iterator cdCmd = cdCmds.begin();
274 cdCmd != cdCmds.end(); ++cdCmd )
276 if ( cdCmd->empty() )
continue;
277 boost::tokenizer<elsc> tokens(*cdCmd, commonEscapes);
280 for(boost::tokenizer<elsc>::const_iterator iToken = tokens.begin();
281 iToken != tokens.end(); ++iToken) {
282 if ( iToken->empty() )
continue;
283 args.push_back(*iToken);
286 if ( args.size() == 0 || args.size() > 2) {
287 LogInfo(
"DQMGenericClient") <<
"Wrong input to cdCmds\n";
293 opt.
ascending = args.size() == 2 ? (args[1] !=
"descending") :
true;
295 cdOptions_.push_back(opt);
299 for ( VPSet::const_iterator cdSet = cdSets.begin();
300 cdSet != cdSets.end(); ++cdSet )
303 opt.
name = cdSet->getUntrackedParameter<
string>(
"name");
304 opt.
ascending = cdSet->getUntrackedParameter<
bool>(
"ascending",
true);
306 cdOptions_.push_back(opt);
313 isWildcardUsed_ =
false;
318 typedef vector<string>
vstring;
339 set<string> subDirSet;
341 for(vstring::const_iterator iSubDir = subDirs_.begin();
342 iSubDir != subDirs_.end(); ++iSubDir) {
345 if ( subDir[subDir.size()-1] ==
'/' ) subDir.erase(subDir.size()-1);
348 isWildcardUsed_ =
true;
351 const string searchPath = subDir.substr(0, shiftPos);
352 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
355 findAllSubdirectories (ibooker, igetter, searchPath, &subDirSet, pattern);
359 subDirSet.insert(subDir);
363 for(set<string>::const_iterator iSubDir = subDirSet.begin();
364 iSubDir != subDirSet.end(); ++iSubDir) {
365 const string&
dirName = *iSubDir;
369 for ( vector<NormOption>::const_iterator normOption = normOptions_.begin();
370 normOption != normOptions_.end(); ++normOption )
372 normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
375 for ( vector<CDOption>::const_iterator cdOption = cdOptions_.begin();
376 cdOption != cdOptions_.end(); ++cdOption )
378 makeCumulativeDist(ibooker, igetter, dirName, cdOption->name, cdOption->ascending);
381 for ( vector<EfficOption>::const_iterator efficOption = efficOptions_.begin();
382 efficOption != efficOptions_.end(); ++efficOption )
384 computeEfficiency(ibooker, igetter, dirName, efficOption->name, efficOption->title,
385 efficOption->numerator, efficOption->denominator,
386 efficOption->type, efficOption->isProfile);
389 for ( vector<ResolOption>::const_iterator resolOption = resolOptions_.begin();
390 resolOption != resolOptions_.end(); ++resolOption )
392 computeResolution(ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
395 for(
const auto& profileOption: profileOptions_) {
396 computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
401 if ( ! outputFileName_.empty() ) theDQM->save(outputFileName_);
406 const string& efficMETitle,
const string& recoMEName,
const string& simMEName,
const EfficType type,
const bool makeProfile)
409 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
410 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 411 <<
"Cannot find sub-directory " << startDir << endl;
418 ME* simME = igetter.
get(startDir+
"/"+simMEName);
419 ME* recoME = igetter.
get(startDir+
"/"+recoMEName);
422 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
423 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 424 <<
"No sim-ME '" << simMEName <<
"' found\n";
430 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
431 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 432 <<
"No reco-ME '" << recoMEName <<
"' found\n";
439 TH1* hSim = simME ->getTH1();
440 TH1* hReco = recoME->getTH1();
442 if ( !hSim || !hReco ) {
443 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
444 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 445 <<
"Cannot create TH1 from ME\n";
450 string efficDir = startDir;
451 string newEfficMEName = efficMEName;
453 if ( string::npos != (shiftPos = efficMEName.rfind(
'/')) ) {
454 efficDir +=
"/"+efficMEName.substr(0, shiftPos);
455 newEfficMEName.erase(0, shiftPos+1);
460 TProfile * efficHist = (hReco->GetXaxis()->GetXbins()->GetSize()==0) ?
461 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
462 hReco->GetXaxis()->GetNbins(),
463 hReco->GetXaxis()->GetXmin(),
464 hReco->GetXaxis()->GetXmax()) :
465 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
466 hReco->GetXaxis()->GetNbins(),
467 hReco->GetXaxis()->GetXbins()->GetArray());
469 efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
470 efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
472 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0) 473 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
475 const double nReco = hReco->GetBinContent(
i);
476 const double nSim = hSim->GetBinContent(
i);
477 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
479 LogError(
"DQMGenericClient") <<
"computeEfficiency() : " 480 <<
"Overflow: bin content either too large or too small to be casted to int";
485 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
487 if ( nSim == 0 || nReco > nSim )
continue;
488 const double effVal = nReco/nSim;
490 const double errLo = TEfficiency::ClopperPearson((
int)nSim,
493 const double errUp = TEfficiency::ClopperPearson((
int)nSim,
496 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
497 efficHist->SetBinContent(
i, effVal);
498 efficHist->SetBinEntries(
i, 1);
499 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
502 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
504 const double nReco = hReco->GetBinContent(
i);
505 const double nSim = hSim->GetBinContent(
i);
506 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
508 LogError(
"DQMGenericClient") <<
"computeEfficiency() : " 509 <<
"Overflow: bin content either too large or too small to be casted to int";
513 TGraphAsymmErrorsWrapper asymm;
514 std::pair<double, double> efficiencyWithError;
515 efficiencyWithError = asymm.efficiency((
int)nReco,
517 double effVal = efficiencyWithError.first;
518 double errVal = efficiencyWithError.second;
520 efficHist->SetBinContent(
i, effVal);
521 efficHist->SetBinEntries(
i, 1);
522 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
525 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
528 ibooker.
bookProfile(newEfficMEName.c_str(),efficHist);
534 TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
535 efficHist->SetTitle(efficMETitle.c_str());
544 TClass * myHistClass = efficHist->IsA();
545 TString histClassName = myHistClass->GetName();
547 if (histClassName ==
"TH1F"){
548 efficME = ibooker.
book1D(newEfficMEName, (TH1F*)efficHist);
549 }
else if (histClassName ==
"TH2F"){
550 efficME = ibooker.
book2D(newEfficMEName, (TH2F*)efficHist);
551 }
else if (histClassName ==
"TH3F"){
552 efficME = ibooker.
book3D(newEfficMEName, (TH3F*)efficHist);
557 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 558 <<
"Cannot book effic-ME from the DQM\n";
566 generic_eff (hSim, hReco, efficME, type);
579 efficME->setEntries(simME->getEntries());
584 ME* globalEfficME = igetter.
get(efficDir+
"/globalEfficiencies");
585 if ( !globalEfficME ) globalEfficME = ibooker.
book1D(
"globalEfficiencies",
"Global efficiencies", 1, 0, 1);
586 if ( !globalEfficME ) {
587 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 588 <<
"Cannot book globalEffic-ME from the DQM\n";
591 globalEfficME->setEfficiencyFlag();
592 TH1F* hGlobalEffic = globalEfficME->getTH1F();
593 if ( !hGlobalEffic ) {
594 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : " 595 <<
"Cannot create TH1F from ME, globalEfficME\n";
599 const float nSimAll = hSim->GetEntries();
600 const float nRecoAll = hReco->GetEntries();
602 if ( type ==
EfficType::efficiency || type == EfficType::simpleratio ) efficAll = nSimAll ? nRecoAll/nSimAll : 0;
603 else if ( type == EfficType::fakerate ) efficAll = nSimAll ? 1-nRecoAll/nSimAll : 0;
605 if ( type == EfficType::simpleratio ) {
607 const float x = nRecoAll/nSimAll;
612 errorAll = nSimAll && efficAll < 1 ?
sqrt(efficAll*(1-efficAll)/nSimAll) : 0;
614 const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
615 hGlobalEffic->SetBinContent(iBin, efficAll);
616 hGlobalEffic->SetBinError(iBin, errorAll);
623 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
624 LogInfo(
"DQMGenericClient") <<
"computeResolution() : " 625 <<
"Cannot find sub-directory " << startDir << endl;
632 ME* srcME = igetter.
get(startDir+
"/"+srcName);
634 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
635 LogInfo(
"DQMGenericClient") <<
"computeResolution() : " 636 <<
"No source ME '" << srcName <<
"' found\n";
641 TH2F* hSrc = srcME->getTH2F();
643 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
644 LogInfo(
"DQMGenericClient") <<
"computeResolution() : " 645 <<
"Cannot create TH2F from source-ME\n";
650 const int nBin = hSrc->GetNbinsX();
652 string newDir = startDir;
655 if ( string::npos != (shiftPos = namePrefix.rfind(
'/')) ) {
656 newDir +=
"/"+namePrefix.substr(0, shiftPos);
657 newPrefix.erase(0, shiftPos+1);
662 float * lowedgesfloats =
new float[nBin+1];
665 if (hSrc->GetXaxis()->GetXbins()->GetSize())
667 for (
int j=0; j<nBin+1; ++j)
668 lowedgesfloats[j] = (
float)hSrc->GetXaxis()->GetXbins()->GetAt(j);
669 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin, lowedgesfloats);
670 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin, lowedgesfloats);
674 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin,
675 hSrc->GetXaxis()->GetXmin(),
676 hSrc->GetXaxis()->GetXmax());
677 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin,
678 hSrc->GetXaxis()->GetXmin(),
679 hSrc->GetXaxis()->GetXmax());
682 if (meanME && sigmaME)
684 meanME->setEfficiencyFlag();
685 sigmaME->setEfficiencyFlag();
687 if (! resLimitedFit_ ) {
693 limitedFit(srcME,meanME,sigmaME);
696 delete[] lowedgesfloats;
701 if(verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
702 LogInfo(
"DQMGenericClient") <<
"computeProfile() : " 703 <<
"Cannot find sub-directory " << startDir << endl;
710 ME* srcME = igetter.
get(startDir+
"/"+srcMEName);
712 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
713 LogInfo(
"DQMGenericClient") <<
"computeProfile() : " 714 <<
"No source ME '" << srcMEName <<
"' found\n";
719 TH2F* hSrc = srcME->getTH2F();
721 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
722 LogInfo(
"DQMGenericClient") <<
"computeProfile() : " 723 <<
"Cannot create TH2F from source-ME\n";
728 string profileDir = startDir;
729 string newProfileMEName = profileMEName;
731 if ( string::npos != (shiftPos = profileMEName.rfind(
'/')) ) {
732 profileDir +=
"/"+profileMEName.substr(0, shiftPos);
733 newProfileMEName.erase(0, shiftPos+1);
737 std::unique_ptr<TProfile>
profile(hSrc->ProfileX());
738 profile->SetTitle(profileMETitle.c_str());
747 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
748 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 749 <<
"Cannot find sub-directory " << startDir << endl;
756 ME* element = igetter.
get(startDir+
"/"+histName);
757 ME* normME = igetter.
get(startDir+
"/"+normHistName);
760 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
761 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 762 <<
"No such element '" << histName <<
"' found\n";
768 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
769 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 770 <<
"No such element '" << normHistName <<
"' found\n";
775 TH1F*
hist = element->getTH1F();
777 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
778 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 779 <<
"Cannot create TH1F from ME\n";
784 TH1F* normHist = normME->getTH1F();
786 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
787 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 788 <<
"Cannot create TH1F from ME\n";
793 const double entries = normHist->GetEntries();
794 if ( entries != 0 ) {
795 hist->Scale(1./entries);
798 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : " 799 <<
"Zero entries in histogram\n";
808 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
809 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : " 810 <<
"Cannot find sub-directory " << startDir << endl;
817 ME* element_cd = igetter.
get(startDir+
"/"+cdName);
820 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
821 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : " 822 <<
"No such element '" << cdName <<
"' found\n";
827 TH1F* cd = element_cd->getTH1F();
830 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
831 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : " 832 <<
"Cannot create TH1F from ME\n";
837 int n_bins = cd->GetNbinsX() + 1;
840 for (
int i = 1;
i <= n_bins;
i++) {
841 cd->SetBinContent(
i,cd->GetBinContent(
i) + cd->GetBinContent(
i-1));
845 for (
int i = n_bins-1;
i >= 0;
i--) {
846 cd->SetBinContent(
i,cd->GetBinContent(
i) + cd->GetBinContent(
i+1));
861 double cont_min = 100;
862 Int_t binx = histo->GetXaxis()->GetNbins();
864 for (
int i = 1; i <= binx ; i++) {
866 TH1 *histoY = histo->ProjectionY(
" ", i, i);
867 double cont = histoY->GetEntries();
869 if (cont >= cont_min) {
870 float minfit = histoY->GetMean() - histoY->GetRMS();
871 float maxfit = histoY->GetMean() + histoY->GetRMS();
873 TF1 *fitFcn =
new TF1(TString(
"g")+histo->GetName()+iString,
"gaus",minfit,maxfit);
875 fitFcn->GetRange(x1,x2);
877 histoY->Fit(fitFcn,
"QR0",
"",x1,x2);
880 double *par = fitFcn->GetParameters();
881 const double *err = fitFcn->GetParErrors();
893 if(fitFcn)
delete fitFcn;
894 if(histoY)
delete histoY;
897 if(histoY)
delete histoY;
906 const TString& _pattern = TString(
"")) {
909 LogError(
"DQMGenericClient") <<
" DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
916 vector <string> foundDirs = igetter.
getSubdirs();
917 for(vector<string>::const_iterator iDir = foundDirs.begin();
918 iDir != foundDirs.end(); ++iDir) {
919 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
920 if (dirName.Contains(regexp))
921 findAllSubdirectories (ibooker, igetter, *iDir, myList);
930 findAllSubdirectories (ibooker, igetter, dir, myList,
"*");
934 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
935 <<
" failed because " << dir <<
" does not exist";
943 for (
int iBinX = 1; iBinX < denom->GetNbinsX()+1; iBinX++){
944 for (
int iBinY = 1; iBinY < denom->GetNbinsY()+1; iBinY++){
945 for (
int iBinZ = 1; iBinZ < denom->GetNbinsZ()+1; iBinZ++){
947 int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
949 float numerVal = numer->GetBinContent(globalBinNum);
950 float denomVal = denom->GetBinContent(globalBinNum);
955 if (type == EfficType::fakerate) {
956 effVal = denomVal ? (1 - numerVal / denomVal) : 0;
958 effVal = denomVal ? numerVal / denomVal : 0;
962 if (type == EfficType::simpleratio) {
963 errVal = denomVal ? 1.f/denomVal*effVal*(1+effVal) : 0;
965 errVal = (denomVal && (effVal <=1)) ?
sqrt(effVal*(1-effVal)/denomVal) : 0;
968 LogDebug (
"DQMGenericClient") <<
"(iBinX, iBinY, iBinZ) = " 971 << iBinZ <<
"), global bin = " << globalBinNum
972 <<
"eff = " << numerVal <<
" / " << denomVal
974 <<
" ... 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)
MonitorElement * bookProfile(Args &&...args)
MonitorElement * get(const std::string &path)
TPRegexp metacharacters("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]")
void makeCumulativeDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName, bool ascending=true)
T x() const
Cartesian x coordinate.
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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 EfficType type=EfficType::efficiency, const bool makeProfile=false)
void setEfficiencyFlag(void)
DQMGenericClient(const edm::ParameterSet &pset)
def efficSet(nameIn, titleIn, numeratorIn, denominatorIn, typeIn="eff")
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 EfficType type=EfficType::efficiency)