Go to the documentation of this file.00001 #ifndef DQMServices_ClientConfig_DQMGenericClient_H
00002 #define DQMServices_ClientConfig_DQMGenericClient_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "FWCore/Framework/interface/Frameworkfwd.h"
00016 #include "FWCore/Framework/interface/EDAnalyzer.h"
00017 #include <set>
00018 #include <string>
00019 #include <vector>
00020 #include <TH1.h>
00021 #include <RVersion.h>
00022 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
00023 #include <TEfficiency.h>
00024 #else
00025 #include <TGraphAsymmErrors.h>
00026 #endif
00027
00028 class DQMStore;
00029 class MonitorElement;
00030
00031 class DQMGenericClient : public edm::EDAnalyzer
00032 {
00033 public:
00034 DQMGenericClient(const edm::ParameterSet& pset);
00035 ~DQMGenericClient() {};
00036
00037 void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) {};
00038 void endJob();
00039
00041 void endRun(const edm::Run& r, const edm::EventSetup& c);
00042
00043 struct EfficOption
00044 {
00045 std::string name, title;
00046 std::string numerator, denominator;
00047 int type;
00048 bool isProfile;
00049 };
00050
00051 struct ResolOption
00052 {
00053 std::string namePrefix, titlePrefix;
00054 std::string srcName;
00055 };
00056
00057 struct NormOption
00058 {
00059 std::string name, normHistName;
00060 };
00061
00062 struct CDOption
00063 {
00064 std::string name;
00065 };
00066
00067 void computeEfficiency(const std::string& startDir,
00068 const std::string& efficMEName,
00069 const std::string& efficMETitle,
00070 const std::string& recoMEName,
00071 const std::string& simMEName,
00072 const int type=1,
00073 const bool makeProfile = false);
00074 void computeResolution(const std::string& startDir,
00075 const std::string& fitMEPrefix, const std::string& fitMETitlePrefix,
00076 const std::string& srcMEName);
00077
00078 void normalizeToEntries(const std::string& startDir, const std::string& histName, const std::string& normHistName);
00079 void makeCumulativeDist(const std::string& startDir, const std::string& cdName);
00080
00081 void limitedFit(MonitorElement * srcME, MonitorElement * meanME, MonitorElement * sigmaME);
00082
00083 private:
00084 unsigned int verbose_;
00085 bool isWildcardUsed_;
00086 bool resLimitedFit_;
00087
00088 DQMStore* theDQM;
00089 std::vector<std::string> subDirs_;
00090 std::string outputFileName_;
00091
00092 std::vector<EfficOption> efficOptions_;
00093 std::vector<ResolOption> resolOptions_;
00094 std::vector<NormOption> normOptions_;
00095 std::vector<CDOption> cdOptions_;
00096
00097 void generic_eff (TH1 * denom, TH1 * numer, MonitorElement * efficiencyHist, const int type=1);
00098
00099 void findAllSubdirectories (std::string dir, std::set<std::string> * myList, const TString& pattern);
00100
00101 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
00102
00103 #else
00104 class TGraphAsymmErrorsWrapper : public TGraphAsymmErrors {
00105 public:
00106 std::pair<double, double> efficiency(int numerator, int denominator) {
00107 double eff, low, high;
00108 Efficiency(numerator, denominator, 0.683, eff, low, high);
00109 double error = (eff - low > high - eff) ? eff - low : high - eff;
00110 return std::pair<double, double>(eff, error);
00111 }
00112 };
00113 #endif
00114
00115 };
00116
00117 #endif
00118
00119