CMS 3D CMS Logo

MuonGEMBaseHarvestor.h
Go to the documentation of this file.
1 #ifndef Validation_MuonGEMHits_MuonGEMBaseHarvestor_h
2 #define Validation_MuonGEMHits_MuonGEMBaseHarvestor_h
3 
10 
11 #include "TSystem.h"
12 #include "TString.h"
13 
15 public:
17 
18 protected:
19  // FIXME typename
20  template <typename T>
21  T* getElement(DQMStore::IGetter& getter, const TString& path);
22 
23  // 0.683 means 1 standard deviation of the normal distribution.
24  TProfile* computeEfficiency(
25  const TH1F& passed, const TH1F& total, const char* name, const char* title, Double_t confidence_level = 0.683);
26 
27  TH2F* computeEfficiency(const TH2F& passed, const TH2F& total, const char* name, const char* title);
28 
29  void bookEff1D(DQMStore::IBooker& ibooker,
30  DQMStore::IGetter& getter,
31  const TString& passed_path,
32  const TString& total_path,
33  const TString& folder,
34  const TString& eff_name,
35  const TString& eff_title = "Efficiency");
36 
37  void bookEff2D(DQMStore::IBooker& ibooker,
38  DQMStore::IGetter& getter,
39  const TString& passed_path,
40  const TString& total_path,
41  const TString& folder,
42  const TString& eff_name,
43  const TString& eff_title = "Efficiency");
44 
45  // Constnats
46  const std::string kLogCategory_; // see member initializer list
47 };
48 
49 #endif // Validation_MuonGEMHits_MuonGEMBaseHarvestor_h
50 
51 template <typename T>
53  std::string folder = gSystem->DirName(path);
54  std::string name = gSystem->BaseName(path);
55 
56  getter.setCurrentFolder(folder);
57  std::vector<std::string> mes = getter.getMEs();
58 
59  if (std::find(mes.begin(), mes.end(), name) == mes.end()) {
60  edm::LogInfo(kLogCategory_) << "doesn't contain " << path << std::endl;
61  return nullptr;
62  }
63 
64  T* hist = nullptr;
65  if (auto tmp_me = getter.get(path.Data())) {
66  if (auto tmp_hist = dynamic_cast<T*>(tmp_me->getRootObject()->Clone())) {
67  hist = tmp_hist;
68  hist->Sumw2();
69  } else {
70  edm::LogError(kLogCategory_) << "failed to getRootObject " << path << std::endl;
71  }
72 
73  } else {
74  edm::LogError(kLogCategory_) << "failed to get " << path << std::endl;
75  }
76 
77  return hist;
78 }
DQMEDHarvester.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
MessageLogger.h
printsummarytable.folder
folder
Definition: printsummarytable.py:7
dqm::implementation::IGetter::getMEs
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:698
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GEMValidationUtils.h
MuonGEMBaseHarvestor::computeEfficiency
TProfile * computeEfficiency(const TH1F &passed, const TH1F &total, const char *name, const char *title, Double_t confidence_level=0.683)
Definition: MuonGEMBaseHarvestor.cc:8
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
MuonGEMBaseHarvestor::bookEff2D
void bookEff2D(DQMStore::IBooker &ibooker, DQMStore::IGetter &getter, const TString &passed_path, const TString &total_path, const TString &folder, const TString &eff_name, const TString &eff_title="Efficiency")
Definition: MuonGEMBaseHarvestor.cc:100
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
MuonGEMBaseHarvestor::MuonGEMBaseHarvestor
MuonGEMBaseHarvestor(const edm::ParameterSet &, std::string)
Definition: MuonGEMBaseHarvestor.cc:5
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
MuonGEMBaseHarvestor
Definition: MuonGEMBaseHarvestor.h:14
MuonGEMBaseHarvestor::bookEff1D
void bookEff1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &getter, const TString &passed_path, const TString &total_path, const TString &folder, const TString &eff_name, const TString &eff_title="Efficiency")
Definition: MuonGEMBaseHarvestor.cc:75
DQMEDHarvester
Definition: DQMEDHarvester.py:1
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
dqm::implementation::IGetter
Definition: DQMStore.h:484
TriggerAnalyzer.passed
passed
Definition: TriggerAnalyzer.py:62
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
dqmMemoryStats.total
total
Definition: dqmMemoryStats.py:152
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
ParameterSet.h
MuonGEMBaseHarvestor::getElement
T * getElement(DQMStore::IGetter &getter, const TString &path)
Definition: MuonGEMBaseHarvestor.h:52
MuonGEMBaseHarvestor::kLogCategory_
const std::string kLogCategory_
Definition: MuonGEMBaseHarvestor.h:46