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() == 0 || args.size() > 2) {
283 LogInfo(
"DQMGenericClient") <<
"Wrong input to cdCmds\n";
289 opt.
ascending = args.size() == 2 ? (args[1] !=
"descending") :
true;
291 cdOptions_.push_back(opt);
295 for ( VPSet::const_iterator cdSet = cdSets.begin();
296 cdSet != cdSets.end(); ++cdSet )
299 opt.
name = cdSet->getUntrackedParameter<
string>(
"name");
300 opt.
ascending = cdSet->getUntrackedParameter<
bool>(
"ascending",
true);
302 cdOptions_.push_back(opt);
309 isWildcardUsed_ =
false;
314 typedef vector<string>
vstring;
335 set<string> subDirSet;
337 for(vstring::const_iterator iSubDir = subDirs_.begin();
338 iSubDir != subDirs_.end(); ++iSubDir) {
339 string subDir = *iSubDir;
341 if ( subDir[subDir.size()-1] ==
'/' ) subDir.erase(subDir.size()-1);
344 isWildcardUsed_ =
true;
347 const string searchPath = subDir.substr(0, shiftPos);
348 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
351 findAllSubdirectories (ibooker, igetter, searchPath, &subDirSet, pattern);
355 subDirSet.insert(subDir);
359 for(set<string>::const_iterator iSubDir = subDirSet.begin();
360 iSubDir != subDirSet.end(); ++iSubDir) {
361 const string&
dirName = *iSubDir;
365 for ( vector<NormOption>::const_iterator normOption = normOptions_.begin();
366 normOption != normOptions_.end(); ++normOption )
368 normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
371 for ( vector<CDOption>::const_iterator cdOption = cdOptions_.begin();
372 cdOption != cdOptions_.end(); ++cdOption )
374 makeCumulativeDist(ibooker, igetter, dirName, cdOption->name, cdOption->ascending);
377 for ( vector<EfficOption>::const_iterator efficOption = efficOptions_.begin();
378 efficOption != efficOptions_.end(); ++efficOption )
380 computeEfficiency(ibooker, igetter, dirName, efficOption->name, efficOption->title,
381 efficOption->numerator, efficOption->denominator,
382 efficOption->type, efficOption->isProfile);
385 for ( vector<ResolOption>::const_iterator resolOption = resolOptions_.begin();
386 resolOption != resolOptions_.end(); ++resolOption )
388 computeResolution(ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
391 for(
const auto& profileOption: profileOptions_) {
392 computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
397 if ( ! outputFileName_.empty() ) theDQM->save(outputFileName_);
402 const string& efficMETitle,
const string& recoMEName,
const string& simMEName,
const int type,
const bool makeProfile)
405 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
406 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
407 <<
"Cannot find sub-directory " << startDir << endl;
414 ME* simME = igetter.
get(startDir+
"/"+simMEName);
415 ME* recoME = igetter.
get(startDir+
"/"+recoMEName);
418 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
419 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
420 <<
"No sim-ME '" << simMEName <<
"' found\n";
426 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
427 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
428 <<
"No reco-ME '" << recoMEName <<
"' found\n";
435 TH1* hSim = simME ->getTH1();
436 TH1* hReco = recoME->getTH1();
438 if ( !hSim || !hReco ) {
439 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
440 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
441 <<
"Cannot create TH1 from ME\n";
446 string efficDir = startDir;
447 string newEfficMEName = efficMEName;
449 if ( string::npos != (shiftPos = efficMEName.rfind(
'/')) ) {
450 efficDir +=
"/"+efficMEName.substr(0, shiftPos);
451 newEfficMEName.erase(0, shiftPos+1);
456 TProfile * efficHist = (hReco->GetXaxis()->GetXbins()->GetSize()==0) ?
457 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
458 hReco->GetXaxis()->GetNbins(),
459 hReco->GetXaxis()->GetXmin(),
460 hReco->GetXaxis()->GetXmax()) :
461 new TProfile(newEfficMEName.c_str(), efficMETitle.c_str(),
462 hReco->GetXaxis()->GetNbins(),
463 hReco->GetXaxis()->GetXbins()->GetArray());
465 efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
466 efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
468 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
469 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
471 const double nReco = hReco->GetBinContent(
i);
472 const double nSim = hSim->GetBinContent(
i);
473 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
475 LogError(
"DQMGenericClient") <<
"computeEfficiency() : "
476 <<
"Overflow: bin content either too large or too small to be casted to int";
481 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
483 if ( nSim == 0 || nReco > nSim )
continue;
484 const double effVal = nReco/nSim;
486 const double errLo = TEfficiency::ClopperPearson((
int)nSim,
489 const double errUp = TEfficiency::ClopperPearson((
int)nSim,
492 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
493 efficHist->SetBinContent(
i, effVal);
494 efficHist->SetBinEntries(
i, 1);
495 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
498 for (
int i=1;
i <= hReco->GetNbinsX();
i++) {
500 const double nReco = hReco->GetBinContent(
i);
501 const double nSim = hSim->GetBinContent(
i);
502 if(nSim > INT_MAX || nSim < INT_MIN || nReco > INT_MAX || nReco < INT_MIN)
504 LogError(
"DQMGenericClient") <<
"computeEfficiency() : "
505 <<
"Overflow: bin content either too large or too small to be casted to int";
509 TGraphAsymmErrorsWrapper asymm;
510 std::pair<double, double> efficiencyWithError;
511 efficiencyWithError = asymm.efficiency((
int)nReco,
513 double effVal = efficiencyWithError.first;
514 double errVal = efficiencyWithError.second;
516 efficHist->SetBinContent(
i, effVal);
517 efficHist->SetBinEntries(
i, 1);
518 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
521 efficHist->GetXaxis()->SetBinLabel(
i, hSim->GetXaxis()->GetBinLabel(
i));
524 ibooker.
bookProfile(newEfficMEName.c_str(),efficHist);
530 TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
531 efficHist->SetTitle(efficMETitle.c_str());
540 TClass * myHistClass = efficHist->IsA();
541 TString histClassName = myHistClass->GetName();
543 if (histClassName ==
"TH1F"){
544 efficME = ibooker.
book1D(newEfficMEName, (TH1F*)efficHist);
545 }
else if (histClassName ==
"TH2F"){
546 efficME = ibooker.
book2D(newEfficMEName, (TH2F*)efficHist);
547 }
else if (histClassName ==
"TH3F"){
548 efficME = ibooker.
book3D(newEfficMEName, (TH3F*)efficHist);
553 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
554 <<
"Cannot book effic-ME from the DQM\n";
562 generic_eff (hSim, hReco, efficME, type);
575 efficME->setEntries(simME->getEntries());
580 ME* globalEfficME = igetter.
get(efficDir+
"/globalEfficiencies");
581 if ( !globalEfficME ) globalEfficME = ibooker.
book1D(
"globalEfficiencies",
"Global efficiencies", 1, 0, 1);
582 if ( !globalEfficME ) {
583 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
584 <<
"Cannot book globalEffic-ME from the DQM\n";
587 globalEfficME->setEfficiencyFlag();
588 TH1F* hGlobalEffic = globalEfficME->getTH1F();
589 if ( !hGlobalEffic ) {
590 LogInfo(
"DQMGenericClient") <<
"computeEfficiency() : "
591 <<
"Cannot create TH1F from ME, globalEfficME\n";
595 const float nSimAll = hSim->GetEntries();
596 const float nRecoAll = hReco->GetEntries();
598 if ( type == 1 ) efficAll = nSimAll ? nRecoAll/nSimAll : 0;
599 else if ( type == 2 ) efficAll = nSimAll ? 1-nRecoAll/nSimAll : 0;
600 const float errorAll = nSimAll && efficAll < 1 ?
sqrt(efficAll*(1-efficAll)/nSimAll) : 0;
602 const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
603 hGlobalEffic->SetBinContent(iBin, efficAll);
604 hGlobalEffic->SetBinError(iBin, errorAll);
611 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
612 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
613 <<
"Cannot find sub-directory " << startDir << endl;
620 ME* srcME = igetter.
get(startDir+
"/"+srcName);
622 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
623 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
624 <<
"No source ME '" << srcName <<
"' found\n";
629 TH2F* hSrc = srcME->getTH2F();
631 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
632 LogInfo(
"DQMGenericClient") <<
"computeResolution() : "
633 <<
"Cannot create TH2F from source-ME\n";
638 const int nBin = hSrc->GetNbinsX();
640 string newDir = startDir;
641 string newPrefix = namePrefix;
643 if ( string::npos != (shiftPos = namePrefix.rfind(
'/')) ) {
644 newDir +=
"/"+namePrefix.substr(0, shiftPos);
645 newPrefix.erase(0, shiftPos+1);
650 float * lowedgesfloats =
new float[nBin+1];
653 if (hSrc->GetXaxis()->GetXbins()->GetSize())
655 for (
int j=0;
j<nBin+1; ++
j)
656 lowedgesfloats[
j] = (
float)hSrc->GetXaxis()->GetXbins()->GetAt(
j);
657 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin, lowedgesfloats);
658 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin, lowedgesfloats);
662 meanME = ibooker.
book1D(newPrefix+
"_Mean", titlePrefix+
" Mean", nBin,
663 hSrc->GetXaxis()->GetXmin(),
664 hSrc->GetXaxis()->GetXmax());
665 sigmaME = ibooker.
book1D(newPrefix+
"_Sigma", titlePrefix+
" Sigma", nBin,
666 hSrc->GetXaxis()->GetXmin(),
667 hSrc->GetXaxis()->GetXmax());
670 if (meanME && sigmaME)
672 meanME->setEfficiencyFlag();
673 sigmaME->setEfficiencyFlag();
675 if (! resLimitedFit_ ) {
681 limitedFit(srcME,meanME,sigmaME);
684 delete[] lowedgesfloats;
689 if(verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
690 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
691 <<
"Cannot find sub-directory " << startDir << endl;
698 ME* srcME = igetter.
get(startDir+
"/"+srcMEName);
700 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
701 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
702 <<
"No source ME '" << srcMEName <<
"' found\n";
707 TH2F* hSrc = srcME->getTH2F();
709 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
710 LogInfo(
"DQMGenericClient") <<
"computeProfile() : "
711 <<
"Cannot create TH2F from source-ME\n";
716 string profileDir = startDir;
717 string newProfileMEName = profileMEName;
719 if ( string::npos != (shiftPos = profileMEName.rfind(
'/')) ) {
720 profileDir +=
"/"+profileMEName.substr(0, shiftPos);
721 newProfileMEName.erase(0, shiftPos+1);
725 std::unique_ptr<TProfile> profile(hSrc->ProfileX());
726 profile->SetTitle(profileMETitle.c_str());
735 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
736 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
737 <<
"Cannot find sub-directory " << startDir << endl;
744 ME* element = igetter.
get(startDir+
"/"+histName);
745 ME* normME = igetter.
get(startDir+
"/"+normHistName);
748 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
749 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
750 <<
"No such element '" << histName <<
"' found\n";
756 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
757 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
758 <<
"No such element '" << normHistName <<
"' found\n";
763 TH1F*
hist = element->getTH1F();
765 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
766 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
767 <<
"Cannot create TH1F from ME\n";
772 TH1F* normHist = normME->getTH1F();
774 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
775 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
776 <<
"Cannot create TH1F from ME\n";
781 const double entries = normHist->GetEntries();
782 if ( entries != 0 ) {
783 hist->Scale(1./entries);
786 LogInfo(
"DQMGenericClient") <<
"normalizeToEntries() : "
787 <<
"Zero entries in histogram\n";
796 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
797 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
798 <<
"Cannot find sub-directory " << startDir << endl;
805 ME* element_cd = igetter.
get(startDir+
"/"+cdName);
808 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
809 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
810 <<
"No such element '" << cdName <<
"' found\n";
815 TH1F* cd = element_cd->getTH1F();
818 if ( verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_) ) {
819 LogInfo(
"DQMGenericClient") <<
"makeCumulativeDist() : "
820 <<
"Cannot create TH1F from ME\n";
825 int n_bins = cd->GetNbinsX() + 1;
828 for (
int i = 1;
i <= n_bins;
i++) {
829 cd->SetBinContent(
i,cd->GetBinContent(
i) + cd->GetBinContent(
i-1));
833 for (
int i = n_bins-1;
i >= 0;
i--) {
834 cd->SetBinContent(
i,cd->GetBinContent(
i) + cd->GetBinContent(
i+1));
849 double cont_min = 100;
850 Int_t binx = histo->GetXaxis()->GetNbins();
852 for (
int i = 1; i <= binx ; i++) {
854 TH1 *histoY = histo->ProjectionY(
" ", i, i);
855 double cont = histoY->GetEntries();
857 if (cont >= cont_min) {
858 float minfit = histoY->GetMean() - histoY->GetRMS();
859 float maxfit = histoY->GetMean() + histoY->GetRMS();
861 TF1 *fitFcn =
new TF1(TString(
"g")+histo->GetName()+iString,
"gaus",minfit,maxfit);
863 fitFcn->GetRange(x1,x2);
865 histoY->Fit(fitFcn,
"QR0",
"",x1,x2);
868 double *par = fitFcn->GetParameters();
869 const double *err = fitFcn->GetParErrors();
881 if(fitFcn)
delete fitFcn;
882 if(histoY)
delete histoY;
885 if(histoY)
delete histoY;
894 const TString& _pattern = TString(
"")) {
897 LogError(
"DQMGenericClient") <<
" DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
902 TPRegexp regexp(pattern);
904 vector <string> foundDirs = igetter.
getSubdirs();
905 for(vector<string>::const_iterator iDir = foundDirs.begin();
906 iDir != foundDirs.end(); ++iDir) {
907 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
908 if (dirName.Contains(regexp))
909 findAllSubdirectories (ibooker, igetter, *iDir, myList);
918 findAllSubdirectories (ibooker, igetter, dir, myList,
"*");
922 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
923 <<
" failed because " << dir <<
" does not exist";
931 for (
int iBinX = 1; iBinX < denom->GetNbinsX()+1; iBinX++){
932 for (
int iBinY = 1; iBinY < denom->GetNbinsY()+1; iBinY++){
933 for (
int iBinZ = 1; iBinZ < denom->GetNbinsZ()+1; iBinZ++){
935 int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
937 float numerVal = numer->GetBinContent(globalBinNum);
938 float denomVal = denom->GetBinContent(globalBinNum);
944 effVal = denomVal ? (1 - numerVal / denomVal) : 0;
946 effVal = denomVal ? numerVal / denomVal : 0;
949 float errVal = (denomVal && (effVal <=1)) ?
sqrt(effVal*(1-effVal)/denomVal) : 0;
951 LogDebug (
"DQMGenericClient") <<
"(iBinX, iBinY, iBinZ) = "
954 << iBinZ <<
"), global bin = " << globalBinNum
955 <<
"eff = " << numerVal <<
" / " << denomVal
957 <<
" ... 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 makeCumulativeDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName, bool ascending=true)
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 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)