45 myDQMrootFolder( pset.getUntrackedParameter<
std::
string>(
"MyDQMrootFolder",
"") ),
50 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();
72 iSubDir !=
subDirs.end(); ++iSubDir) {
74 if ( subDir[subDir.size()-1] ==
'/' ) 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());
82 subDirSet.insert(subDir);
87 for(
auto const &
dirName : subDirSet) {
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();
110 if(fitFunction==
"GaussianPlusLinear"){
118 }
else if(fitFunction==
"VoigtianPlusExponential"){
128 LogError(
"DQMGenericTnPClient")<<
"Fit function: "<<fitFunction<<
" does not exist"<<endl;
134 if(massDimension>dimensions){
135 LogError(
"DQMGenericTnPClient")<<
"Monitoring Element "<<allMEname<<
" has smaller dimension than "<<massDimension<<endl;
142 if ( string::npos != slashPos ) {
143 effDir +=
"/"+effName.substr(0, slashPos);
144 effName.erase(0, slashPos+1);
147 TString
prefix(effDir.c_str());
148 prefix.ReplaceAll(
'/',
'_');
151 TProfile* eff =
nullptr;
152 TProfile* effChi2 =
nullptr;
153 TString
error = fitter->calculateEfficiency((TH2*)pass, (TH2*)all, massDimension, eff, effChi2,
plots?
prefix+effName.c_str():
"");
155 LogError(
"DQMGenericTnPClient")<<error<<endl;
159 dqmStore->bookProfile(effName+
"Chi2",effChi2);
162 }
else if(dimensions==3){
163 TProfile2D* eff =
nullptr;
164 TProfile2D* effChi2 =
nullptr;
165 TString
error = fitter->calculateEfficiency((TH3*)pass, (TH3*)all, massDimension, eff, effChi2,
plots?
prefix+effName.c_str():
"");
167 LogError(
"DQMGenericTnPClient")<<error<<endl;
170 dqmStore->bookProfile2D(effName,eff);
171 dqmStore->bookProfile2D(effName+
"Chi2",effChi2);
186 LogError(
"DQMGenericTnPClient") <<
" DQMGenericTnPClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
191 if (
pattern.Contains(nonPerlWildcard))
pattern.ReplaceAll(
"*",
".*");
194 vector <string> foundDirs =
dqmStore->getSubdirs();
195 for(
auto iDir = foundDirs.begin();
196 iDir != foundDirs.end(); ++iDir) {
197 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
198 if (dirName.Contains(regexp))
208 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
209 <<
" failed because " << dir <<
" does not exist";
T getUntrackedParameter(std::string const &, T const &) const
GaussianPlusLinearFitter * GPLfitter
~DQMGenericTnPClient() override
#define DEFINE_FWK_MODULE(type)
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_)
def setup(process, global_tag, zero_tesla=False)
void calculateEfficiency(const std::string &dirName, const ParameterSet &pset)
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
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
std::string myDQMrootFolder
TPRegexp nonPerlWildcard("\\w\\*|^\\*")
const VParameterSet efficiencies