47 myDQMrootFolder(
pset.getUntrackedParameter<
std::
string>(
"MyDQMrootFolder",
"")),
50 TString savePlotsInRootFileName =
pset.getUntrackedParameter<
string>(
"SavePlotsInRootFileName",
"");
51 plots = savePlotsInRootFileName !=
"" ?
new TFile(savePlotsInRootFileName,
"recreate") :
nullptr;
57 TPRegexp metacharacters(
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]");
61 LogError(
"DQMGenericTnPClient") <<
"Could not find DQMStore service\n";
66 set<std::string> subDirSet;
71 for (
auto iSubDir =
subDirs.begin(); iSubDir !=
subDirs.end(); ++iSubDir) {
75 if (TString(
subDir).Contains(metacharacters)) {
77 const string searchPath =
subDir.substr(0, shiftPos);
86 for (
auto const&
dirName : subDirSet) {
95 string allMEname =
dirName +
"/" +
pset.getUntrackedParameter<
string>(
"DenominatorMEname");
96 string passMEname =
dirName +
"/" +
pset.getUntrackedParameter<
string>(
"NumeratorMEname");
99 if (allME ==
nullptr || passME ==
nullptr) {
100 LogDebug(
"DQMGenericTnPClient") <<
"Could not find MEs: " << allMEname <<
" or " << passMEname << endl;
103 TH1*
all = allME->getTH1();
104 TH1* pass = passME->
getTH1();
106 string fitFunction =
pset.getUntrackedParameter<
string>(
"FitFunction");
108 if (fitFunction ==
"GaussianPlusLinear") {
110 pset.getUntrackedParameter<
double>(
"FitRangeLow"),
111 pset.getUntrackedParameter<
double>(
"FitRangeHigh"),
112 pset.getUntrackedParameter<
double>(
"ExpectedSigma"));
114 }
else if (fitFunction ==
"VoigtianPlusExponential") {
116 pset.getUntrackedParameter<
double>(
"FitRangeLow"),
117 pset.getUntrackedParameter<
double>(
"FitRangeHigh"),
118 pset.getUntrackedParameter<
double>(
"ExpectedSigma"),
119 pset.getUntrackedParameter<
double>(
"FixedWidth"));
122 LogError(
"DQMGenericTnPClient") <<
"Fit function: " << fitFunction <<
" does not exist" << endl;
127 int massDimension =
pset.getUntrackedParameter<
int>(
"MassDimension");
129 LogError(
"DQMGenericTnPClient") <<
"Monitoring Element " << allMEname <<
" has smaller dimension than " 130 << massDimension << endl;
134 string effName =
pset.getUntrackedParameter<
string>(
"EfficiencyMEname");
137 if (string::npos != slashPos) {
138 effDir +=
"/" + effName.substr(0, slashPos);
139 effName.erase(0, slashPos + 1);
142 TString
prefix(effDir.c_str());
143 prefix.ReplaceAll(
'/',
'_');
146 TProfile* eff =
nullptr;
147 TProfile* effChi2 =
nullptr;
148 TString
error = fitter->calculateEfficiency(
149 (TH2*)pass, (TH2*)
all, massDimension, eff, effChi2,
plots ?
prefix + effName.c_str() :
"");
159 TProfile2D* eff =
nullptr;
160 TProfile2D* effChi2 =
nullptr;
161 TString
error = fitter->calculateEfficiency(
162 (TH3*)pass, (TH3*)
all, massDimension, eff, effChi2,
plots ?
prefix + effName.c_str() :
"");
182 std::set<std::string>*
myList,
185 LogError(
"DQMGenericTnPClient") <<
" DQMGenericTnPClient::findAllSubdirectories ==> Missing folder " <<
dir 189 TPRegexp nonPerlWildcard(
"\\w\\*|^\\*");
191 if (
pattern.Contains(nonPerlWildcard))
196 for (
auto iDir = foundDirs.begin(); iDir != foundDirs.end(); ++iDir) {
197 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
206 LogInfo(
"DQMGenericClient") <<
"Trying to find sub-directories of " <<
dir <<
" failed because " <<
dir 207 <<
" 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
#define DEFINE_FWK_MODULE(type)
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())
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
const VParameterSet efficiencies
dqm::legacy::MonitorElement MonitorElement
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const