CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronValidator.cc
Go to the documentation of this file.
1 
8 #include "TMath.h"
9 #include "TFile.h"
10 #include "TH1F.h"
11 #include "TH1I.h"
12 #include "TH2F.h"
13 #include "TProfile.h"
14 #include "TTree.h"
15 #include <iostream>
16 
18  {}
19 
21  {}
22 
24  {
26  if (!store_)
27  { edm::LogError("ElectronValidator::prepareStore")<<"No DQMStore found !" ; }
28  }
29 
30 void ElectronValidator::setStoreFolder( const std::string & path )
31  { store_->setCurrentFolder(path) ; }
32 
33 void ElectronValidator::saveStore( const std::string & filename )
34  { store_->save(filename) ; }
35 
37  ( const std::string & name, const std::string & title,
38  int nchX, double lowX, double highX,
39  const std::string & titleX, const std::string & titleY )
40  {
41  MonitorElement * me = store_->book1D(name,title,nchX,lowX,highX) ;
42  if (titleX!="") { me->getTH1F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
43  if (titleY!="") { me->getTH1F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
44  return me ;
45  }
46 
48  ( const std::string & name, const std::string & title,
49  int nchX, double lowX, double highX,
50  const std::string & titleX, const std::string & titleY )
51  {
52  MonitorElement * me = store_->book1D(name,title,nchX,lowX,highX) ;
53  me->getTH1F()->Sumw2() ;
54  if (titleX!="") { me->getTH1F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
55  if (titleY!="") { me->getTH1F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
56  return me ;
57  }
58 
60  ( const std::string & name, const std::string & title,
61  int nchX, double lowX, double highX,
62  int nchY, double lowY, double highY,
63  const std::string & titleX, const std::string & titleY )
64  {
65  MonitorElement * me = store_->book2D(name,title,nchX,lowX,highX,nchY,lowY,highY) ;
66  if (titleX!="") { me->getTH2F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
67  if (titleY!="") { me->getTH2F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
68  return me ;
69  }
70 
72  ( const std::string & name, const std::string & title,
73  int nchX, double lowX, double highX,
74  int nchY, double lowY, double highY,
75  const std::string & titleX, const std::string & titleY )
76  {
77  MonitorElement * me = store_->book2D(name,title,nchX,lowX,highX,nchY,lowY,highY) ;
78  me->getTH2F()->Sumw2() ;
79  if (titleX!="") { me->getTH2F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
80  if (titleY!="") { me->getTH2F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
81  return me ;
82  }
83 
85  ( const std::string & name, const std::string & title,
86  int nchX, double lowX, double highX,
87  double lowY, double highY,
88  const std::string & titleX, const std::string & titleY )
89  {
90  MonitorElement * me = store_->bookProfile(name,title,nchX,lowX,highX,lowY,highY) ;
91  if (titleX!="") { me->getTProfile()->GetXaxis()->SetTitle(titleX.c_str()) ; }
92  if (titleY!="") { me->getTProfile()->GetYaxis()->SetTitle(titleY.c_str()) ; }
93  return me ;
94  }
95 
97  ( const std::string & name, MonitorElement * num, MonitorElement * denom,
98  const std::string & titleX, const std::string & titleY,
99  const std::string & title, bool print )
100  {
101  TH1F * h_temp = (TH1F *)num->getTH1F()->Clone(name.c_str()) ;
102  h_temp->Reset() ;
103  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
104  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
105  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
106  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
107  if (print) { h_temp->Print() ; }
108  MonitorElement * me = store_->book1D(name,h_temp) ;
109  delete h_temp ;
110  return me ;
111  }
112 
114  ( const std::string & name, MonitorElement * num, MonitorElement * denom,
115  const std::string & titleX, const std::string & titleY,
116  const std::string & title, bool print )
117  {
118  TH2F * h_temp = (TH2F *)num->getTH2F()->Clone(name.c_str()) ;
119  h_temp->Reset() ;
120  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
121  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
122  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
123  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
124  if (print) { h_temp->Print() ; }
125  MonitorElement * me = store_->book2D(name,h_temp) ;
126  delete h_temp ;
127  return me ;
128  }
129 
131  ( const std::string & name, MonitorElement * me2d,
132  const std::string & title, const std::string & titleX, const std::string & titleY,
133  Double_t minimum, Double_t maximum )
134  {
135  TProfile * p1_temp = me2d->getTH2F()->ProfileX() ;
136  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
137  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
138  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
139  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
140  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
141  MonitorElement * me = store_->bookProfile(name,p1_temp) ;
142  delete p1_temp ;
143  return me ;
144  }
145 
147  ( const std::string & name, MonitorElement * me2d,
148  const std::string & title, const std::string & titleX, const std::string & titleY,
149  Double_t minimum, Double_t maximum )
150  {
151  TProfile * p1_temp = me2d->getTH2F()->ProfileY() ;
152  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
153  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
154  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
155  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
156  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
157  MonitorElement * me = store_->bookProfile(name,p1_temp) ;
158  delete p1_temp ;
159  return me ;
160  }
161 
162 
MonitorElement * bookH1withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events")
MonitorElement * bookH2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="")
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1883
MonitorElement * profileX(const std::string &name, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
int path() const
Definition: HLTadd.h:3
void saveStore(const std::string &filename)
TH1 * getTH1(void) const
tuple conf
Definition: dbtoconf.py:185
MonitorElement * profileY(const std::string &name, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
MonitorElement * bookH2withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="")
TH1F * getTH1F(void) const
long long int num
Definition: procUtils.cc:71
MonitorElement * bookH1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events")
void setStoreFolder(const std::string &path)
TProfile * getTProfile(void) const
tuple filename
Definition: lut2db_cfg.py:20
MonitorElement * bookH1andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="", bool print=false)
MonitorElement * bookH2andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="", bool print=false)
ElectronValidator(const edm::ParameterSet &conf)
TH2F * getTH2F(void) const
virtual ~ElectronValidator()
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
MonitorElement * bookP1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, double lowY, double highY, const std::string &titleX="", const std::string &titleY="")