CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ScoutingAnalyzerBase.cc
Go to the documentation of this file.
7 #include <iostream>
8 #include <sstream>
9 
11  m_MEsPath = conf.getUntrackedParameter<std::string>("rootPath","DataScouting") ;
12  m_modulePath = conf.getUntrackedParameter<std::string>("modulePath","DataScouting") ;
13  m_verbosityLevel = conf.getUntrackedParameter<unsigned int>("verbosityLevel", 0) ;
14  if (m_modulePath.size() != 0) {
16  }
17 }
18 
20 
22  // let's keep it in case we need massage
23  return name;
24 }
25 
27  iBooker.setCurrentFolder(m_MEsPath);
28 }
29 
31 ( DQMStore::IBooker & iBooker,
32  const std::string & name, const std::string & title,
33  int nchX, double lowX, double highX,
34  const std::string & titleX, const std::string & titleY,
35  Option_t * option ) {
36  MonitorElement * me = iBooker.book1DD(newName(name),title,nchX,lowX,highX) ;
37  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
38  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
39  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
40  return me ;
41 }
42 
44 ( DQMStore::IBooker & iBooker,
45  const std::string & name, const std::string & title,
46  int nchX, double lowX, double highX,
47  const std::string & titleX, const std::string & titleY,
48  Option_t * option ) {
49  std::cout << newName(name) << std::endl;
50  MonitorElement * me = iBooker.book1DD(newName(name),title,nchX,lowX,highX) ;
51  me->getTH1()->Sumw2() ;
52  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
53  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
54  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
55  return me ;
56 }
57 
59 ( DQMStore::IBooker & iBooker,
60  const std::string & name, const std::string & title,
61  int nchX, float *xbinsize,
62  const std::string & titleX, const std::string & titleY,
63  Option_t * option ) {
64  MonitorElement * me = iBooker.book1D(newName(name),title,nchX,xbinsize) ;
65  //book1DD not implemented in DQMServices/Core/src/DQMStore.cc
66  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
67  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
68  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
69  return me ;
70 }
71 
73 ( DQMStore::IBooker & iBooker,
74  const std::string & name, const std::string & title,
75  int nchX, float *xbinsize,
76  const std::string & titleX, const std::string & titleY,
77  Option_t * option ) {
78  std::cout << newName(name) << std::endl;
79  MonitorElement * me = iBooker.book1D(newName(name),title,nchX,xbinsize) ;
80  //book1DD not implemented in DQMServices/Core/src/DQMStore.cc
81  me->getTH1()->Sumw2() ;
82  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
83  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
84  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
85  return me ;
86 }
87 
89 ( DQMStore::IBooker & iBooker,
90  const std::string & name, const std::string & title,
91  int nchX, double lowX, double highX,
92  int nchY, double lowY, double highY,
93  const std::string & titleX, const std::string & titleY,
94  Option_t * option ) {
95  MonitorElement * me = iBooker.book2DD(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
96  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
97  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
98  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
99  return me ;
100 }
101 
103 ( DQMStore::IBooker & iBooker,
104  const std::string & name, const std::string & title,
105  int nchX, double lowX, double highX,
106  int nchY, double lowY, double highY,
107  const std::string & titleX, const std::string & titleY,
108  Option_t * option ) {
109  MonitorElement * me = iBooker.book2DD(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
110  me->getTH1()->Sumw2() ;
111  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
112  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
113  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
114  return me ;
115 }
116 
118 ( DQMStore::IBooker & iBooker,
119  const std::string & name, const std::string & title,
120  int nchX, double lowX, double highX,
121  double lowY, double highY,
122  const std::string & titleX, const std::string & titleY,
123  Option_t * option ) {
124  MonitorElement * me = iBooker.bookProfile(newName(name),title,nchX,lowX,highX,lowY,highY," ") ;
125  if (titleX!="") { me->getTProfile()->GetXaxis()->SetTitle(titleX.c_str()) ; }
126  if (titleY!="") { me->getTProfile()->GetYaxis()->SetTitle(titleY.c_str()) ; }
127  if (TString(option)!="") { me->getTProfile()->SetOption(option) ; }
128  return me ;
129 }
130 
132 ( DQMStore::IBooker & iBooker,
133  const std::string & name, MonitorElement * num, MonitorElement * denom,
134  const std::string & titleX, const std::string & titleY,
135  const std::string & title ) {
136  std::string name2 = newName(name) ;
137  TH1D * h_temp = dynamic_cast<TH1D*>(num->getTH1()->Clone(name2.c_str()) );
138  h_temp->Reset() ;
139  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
140  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
141  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
142  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
143  if (m_verbosityLevel>0) { h_temp->Print() ; }
144  MonitorElement * me = iBooker.book1DD(name2,h_temp) ;
145  delete h_temp ;
146  return me ;
147 }
148 
150 ( DQMStore::IBooker & iBooker,
151  const std::string & name, MonitorElement * num, MonitorElement * denom,
152  const std::string & titleX, const std::string & titleY,
153  const std::string & title ) {
154  std::string name2 = newName(name) ;
155  TH2D * h_temp = dynamic_cast<TH2D*>(num->getTH1()->Clone(name2.c_str()) );
156  h_temp->Reset() ;
157  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
158  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
159  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
160  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
161  if (m_verbosityLevel>0) { h_temp->Print() ; }
162  MonitorElement * me = iBooker.book2DD(name2,h_temp) ;
163  delete h_temp ;
164  return me ;
165 }
166 
168 ( DQMStore::IBooker & iBooker,
169  MonitorElement * me2d,
170  const std::string & title, const std::string & titleX, const std::string & titleY,
171  Double_t minimum, Double_t maximum ) {
172  std::string name2 = me2d->getName()+"_pfx" ;
173  TProfile * p1_temp = me2d->getTH2D()->ProfileX() ;
174  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
175  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
176  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
177  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
178  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
179  MonitorElement * me = iBooker.bookProfile(name2,p1_temp) ;
180  delete p1_temp ;
181  return me ;
182 }
183 
185 ( DQMStore::IBooker & iBooker,
186  MonitorElement * me2d,
187  const std::string & title, const std::string & titleX, const std::string & titleY,
188  Double_t minimum, Double_t maximum ) {
189  std::string name2 = me2d->getName()+"_pfy" ;
190  TProfile * p1_temp = me2d->getTH2D()->ProfileY() ;
191  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
192  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
193  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
194  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
195  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
196  MonitorElement * me = iBooker.bookProfile(name2,p1_temp) ;
197  delete p1_temp ;
198  return me ;
199 }
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
void prepareBooking(DQMStore::IBooker &)
MonitorElement * bookH2andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
TH2D * getTH2D(void) const
MonitorElement * bookH1andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
MonitorElement * bookH1withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
std::string newName(const std::string &name)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1 * getTH1(void) const
MonitorElement * bookP1(DQMStore::IBooker &, 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="", Option_t *option="E1 P")
MonitorElement * profileY(DQMStore::IBooker &, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
ScoutingAnalyzerBase(const edm::ParameterSet &conf)
MonitorElement * bookH1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
MonitorElement * bookH2(DQMStore::IBooker &, 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="", Option_t *option="COLZ")
MonitorElement * bookH2withSumw2(DQMStore::IBooker &, 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="", Option_t *option="COLZ")
TProfile * getTProfile(void) const
MonitorElement * book2DD(Args &&...args)
Definition: DQMStore.h:145
tuple cout
Definition: gather_cfg.py:145
MonitorElement * bookH1withSumw2BinArray(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, float *xbinsize, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
MonitorElement * profileX(DQMStore::IBooker &, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
MonitorElement * book1DD(Args &&...args)
Definition: DQMStore.h:127
MonitorElement * bookH1BinArray(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, float *xbinsize, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")