45 myDQMrootFolder( pset.getUntrackedParameter<
std::
string>(
"MyDQMrootFolder",
"") ),
46 verbose( pset.getUntrackedParameter<bool>(
"Verbose",
false) ),
50 plots = savePlotsInRootFileName!=
"" ?
new TFile(savePlotsInRootFileName,
"recreate") : 0;
57 TPRegexp
metacharacters(
"[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]");
61 LogError(
"DQMGenericTnPClient")<<
"Could not find DQMStore service\n";
66 set<std::string> subDirSet;
71 for(vstring::const_iterator 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(set<string>::const_iterator iSubDir = subDirSet.begin();
88 iSubDir != subDirSet.end(); ++iSubDir) {
89 const string&
dirName = *iSubDir;
104 if(allME==0 || passME==0){
105 LogDebug(
"DQMGenericTnPClient")<<
"Could not find MEs: "<<allMEname<<
" or "<<passMEname<<endl;
108 TH1 *
all = allME->getTH1();
109 TH1 *pass = passME->
getTH1();
113 if(fitFunction==
"GaussianPlusLinear"){
121 }
else if(fitFunction==
"VoigtianPlusExponential"){
131 LogError(
"DQMGenericTnPClient")<<
"Fit function: "<<fitFunction<<
" does not exist"<<endl;
135 int dimensions = all->GetDimension();
137 if(massDimension>dimensions){
138 LogError(
"DQMGenericTnPClient")<<
"Monitoring Element "<<allMEname<<
" has smaller dimension than "<<massDimension<<endl;
145 if ( string::npos != slashPos ) {
146 effDir +=
"/"+effName.substr(0, slashPos);
147 effName.erase(0, slashPos+1);
150 TString
prefix(effDir.c_str());
151 prefix.ReplaceAll(
'/',
'_');
155 TProfile* effChi2 = 0;
156 TString
error = fitter->calculateEfficiency((TH2*)pass, (TH2*)all, massDimension, eff, effChi2,
plots?
prefix+effName.c_str():
"");
158 LogError(
"DQMGenericTnPClient")<<error<<endl;
162 dqmStore->bookProfile(effName+
"Chi2",effChi2);
165 }
else if(dimensions==3){
167 TProfile2D* effChi2 = 0;
168 TString
error = fitter->calculateEfficiency((TH3*)pass, (TH3*)all, massDimension, eff, effChi2,
plots?
prefix+effName.c_str():
"");
170 LogError(
"DQMGenericTnPClient")<<error<<endl;
173 dqmStore->bookProfile2D(effName,eff);
174 dqmStore->bookProfile2D(effName+
"Chi2",effChi2);
189 LogError(
"DQMGenericTnPClient") <<
" DQMGenericTnPClient::findAllSubdirectories ==> Missing folder " << dir <<
" !!!";
194 if (
pattern.Contains(nonPerlWildcard))
pattern.ReplaceAll(
"*",
".*");
197 vector <string> foundDirs =
dqmStore->getSubdirs();
198 for(vector<string>::const_iterator iDir = foundDirs.begin();
199 iDir != foundDirs.end(); ++iDir) {
200 TString
dirName = iDir->substr(iDir->rfind(
'/') + 1, iDir->length());
201 if (dirName.Contains(regexp))
211 LogInfo (
"DQMGenericClient") <<
"Trying to find sub-directories of " << dir
212 <<
" failed because " << dir <<
" does not exist";
T getUntrackedParameter(std::string const &, T const &) const
GaussianPlusLinearFitter * GPLfitter
#define DEFINE_FWK_MODULE(type)
std::vector< ParameterSet > VParameterSet
virtual 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 setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_, double width_)
DQMGenericTnPClient(const edm::ParameterSet &pset)
VoigtianPlusExponentialFitter * VPEfitter
virtual ~DQMGenericTnPClient()
std::string myDQMrootFolder
TPRegexp nonPerlWildcard("\\w\\*|^\\*")
void calculateEfficiency(std::string dirName, const ParameterSet &pset)
const VParameterSet efficiencies
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
std::vector< std::string > vstring
void findAllSubdirectories(std::string dir, std::set< std::string > *myList, TString pattern)