48 myDQMrootFolder(
pset.getUntrackedParameter<
std::
string>(
"MyDQMrootFolder",
"")),
51 usesResource(
"DQMStore");
52 TString savePlotsInRootFileName =
pset.getUntrackedParameter<
string>(
"SavePlotsInRootFileName",
"");
53 plots = savePlotsInRootFileName !=
"" ?
new TFile(savePlotsInRootFileName,
"recreate") :
nullptr;
59 TPRegexp metacharacters(
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]");
63 LogError(
"DQMGenericTnPClient") <<
"Could not find DQMStore service\n";
68 set<std::string> subDirSet;
73 for (
auto iSubDir =
subDirs.begin(); iSubDir !=
subDirs.end(); ++iSubDir) {
77 if (TString(
subDir).Contains(metacharacters)) {
79 const string searchPath =
subDir.substr(0, shiftPos);
88 for (
auto const&
dirName : subDirSet) {
97 string allMEname =
dirName +
"/" +
pset.getUntrackedParameter<
string>(
"DenominatorMEname");
98 string passMEname =
dirName +
"/" +
pset.getUntrackedParameter<
string>(
"NumeratorMEname");
101 if (allME ==
nullptr || passME ==
nullptr) {
102 LogDebug(
"DQMGenericTnPClient") <<
"Could not find MEs: " << allMEname <<
" or " << passMEname << endl;
105 TH1*
all = allME->getTH1();
106 TH1* pass = passME->
getTH1();
108 string fitFunction =
pset.getUntrackedParameter<
string>(
"FitFunction");
110 if (fitFunction ==
"GaussianPlusLinear") {
112 pset.getUntrackedParameter<
double>(
"FitRangeLow"),
113 pset.getUntrackedParameter<
double>(
"FitRangeHigh"),
114 pset.getUntrackedParameter<
double>(
"ExpectedSigma"));
116 }
else if (fitFunction ==
"VoigtianPlusExponential") {
118 pset.getUntrackedParameter<
double>(
"FitRangeLow"),
119 pset.getUntrackedParameter<
double>(
"FitRangeHigh"),
120 pset.getUntrackedParameter<
double>(
"ExpectedSigma"),
121 pset.getUntrackedParameter<
double>(
"FixedWidth"));
124 LogError(
"DQMGenericTnPClient") <<
"Fit function: " << fitFunction <<
" does not exist" << endl;
129 int massDimension =
pset.getUntrackedParameter<
int>(
"MassDimension");
131 LogError(
"DQMGenericTnPClient") <<
"Monitoring Element " << allMEname <<
" has smaller dimension than " 132 << massDimension << endl;
136 string effName =
pset.getUntrackedParameter<
string>(
"EfficiencyMEname");
139 if (string::npos != slashPos) {
140 effDir +=
"/" + effName.substr(0, slashPos);
141 effName.erase(0, slashPos + 1);
144 TString
prefix(effDir.c_str());
145 prefix.ReplaceAll(
'/',
'_');
148 TProfile* eff =
nullptr;
149 TProfile* effChi2 =
nullptr;
150 TString
error = fitter->calculateEfficiency(
151 (TH2*)pass, (TH2*)
all, massDimension, eff, effChi2,
plots ?
prefix + effName.c_str() :
"");
161 TProfile2D* eff =
nullptr;
162 TProfile2D* effChi2 =
nullptr;
163 TString
error = fitter->calculateEfficiency(
164 (TH3*)pass, (TH3*)
all, massDimension, eff, effChi2,
plots ?
prefix + effName.c_str() :
"");
184 std::set<std::string>*
myList,
187 LogError(
"DQMGenericTnPClient") <<
" DQMGenericTnPClient::findAllSubdirectories ==> Missing folder " <<
dir 191 TPRegexp nonPerlWildcard(
"\\w\\*|^\\*");
193 if (
pattern.Contains(nonPerlWildcard))
198 for (
auto iDir = foundDirs.begin(); iDir != foundDirs.end(); ++iDir) {
199 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
208 LogInfo(
"DQMGenericClient") <<
"Trying to find sub-directories of " <<
dir <<
" failed because " <<
dir 209 <<
" does not exist";
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
dqm::legacy::DQMStore DQMStore
GaussianPlusLinearFitter * GPLfitter
~DQMGenericTnPClient() override
std::vector< ParameterSet > VParameterSet
void setCurrentFolder(std::string const &fullpath) override
void endRun(const edm::Run &run, const edm::EventSetup &setup) override
virtual bool dirExists(std::string const &path) const
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_)
void calculateEfficiency(const std::string &dirName, const ParameterSet &pset)
Log< level::Error, false > LogError
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_, double width_)
DQMGenericTnPClient(const edm::ParameterSet &pset)
void findAllSubdirectories(const std::string &dir, std::set< std::string > *myList, TString pattern)
VoigtianPlusExponentialFitter * VPEfitter
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())
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
std::string myDQMrootFolder
Log< level::Info, false > LogInfo
virtual MonitorElement * get(std::string const &fullpath) const
virtual TH1 * getTH1() const
void beginRun(edm::Run const &, edm::EventSetup const &) override
const VParameterSet efficiencies
dqm::legacy::MonitorElement MonitorElement
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const