47 myDQMrootFolder(pset.getUntrackedParameter<
std::
string>(
"MyDQMrootFolder",
"")),
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) {
73 if (subDir[subDir.size() - 1] ==
'/')
74 subDir.erase(subDir.size() - 1);
75 if (TString(subDir).Contains(metacharacters)) {
77 const string searchPath = subDir.substr(0, shiftPos);
78 const string pattern = subDir.substr(shiftPos + 1, subDir.length());
81 subDirSet.insert(subDir);
86 for (
auto const&
dirName : subDirSet) {
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();
108 if (fitFunction ==
"GaussianPlusLinear") {
114 }
else if (fitFunction ==
"VoigtianPlusExponential") {
122 LogError(
"DQMGenericTnPClient") <<
"Fit function: " << fitFunction <<
" does not exist" << endl;
128 if (massDimension > dimensions) {
129 LogError(
"DQMGenericTnPClient") <<
"Monitoring Element " << allMEname <<
" has smaller dimension than " 130 << massDimension << endl;
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(
'/',
'_');
145 if (dimensions == 2) {
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() :
"");
151 LogError(
"DQMGenericTnPClient") << error << endl;
158 }
else if (dimensions == 3) {
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() :
"");
164 LogError(
"DQMGenericTnPClient") << error << endl;
182 std::set<std::string>*
myList,
185 LogError(
"DQMGenericTnPClient") <<
" DQMGenericTnPClient::findAllSubdirectories ==> Missing folder " << dir
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());
198 if (dirName.Contains(regexp))
206 LogInfo(
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir <<
" failed because " << dir
207 <<
" does not exist";
T getUntrackedParameter(std::string const &, T const &) const
dqm::legacy::DQMStore DQMStore
GaussianPlusLinearFitter * GPLfitter
~DQMGenericTnPClient() override
std::vector< ParameterSet > VParameterSet
void endRun(const edm::Run &run, const edm::EventSetup &setup) override
TPRegexp metacharacters("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]")
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_)
MonitorElement * bookProfile2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
void calculateEfficiency(const std::string &dirName, const ParameterSet &pset)
void cd()
go to top directory (ie. root)
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_, double width_)
DQMGenericTnPClient(const edm::ParameterSet &pset)
MonitorElement * bookProfile(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
void findAllSubdirectories(const std::string &dir, std::set< std::string > *myList, TString pattern)
VoigtianPlusExponentialFitter * VPEfitter
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
std::string myDQMrootFolder
void setCurrentFolder(std::string const &fullpath)
std::vector< std::string > getSubdirs() const
TPRegexp nonPerlWildcard("\\w\\*|^\\*")
const VParameterSet efficiencies
virtual TH1 * getTH1() const
bool dirExists(std::string const &path) const
true if directory exists
dqm::legacy::MonitorElement MonitorElement