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 
10 //------------------------------------------------------------------------------
11 
13  m_MEsPath = conf.getUntrackedParameter<std::string>("rootPath","DataScouting") ;
14  m_modulePath = conf.getUntrackedParameter<std::string>("modulePath","DataScouting") ;
15  m_verbosityLevel = conf.getUntrackedParameter<unsigned int>("verbosityLevel", 0) ;
16  if (m_modulePath.size() != 0)
17  m_MEsPath+="/"+m_modulePath;
18  }
19 
20 //--------------------------------------------------------------------------
21 
23 
24 //------------------------------------------------------------------------------
25 
28  if (!m_store)
29  { edm::LogError("ScoutingAnalyzerBase::prepareStore")<<"No DQMStore found !" ; }
32  bookMEs() ;
33  }
34 
35 //------------------------------------------------------------------------------
36 
38  // let's keep it in case we need massage
39  return name;
40 }
41 
42 //------------------------------------------------------------------------------
43 
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  {
50  MonitorElement * me = m_store->book1DD(newName(name),title,nchX,lowX,highX) ;
51  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
52  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
53  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
54  return me ;
55  }
56 
57 //------------------------------------------------------------------------------
58 
60  ( const std::string & name, const std::string & title,
61  int nchX, double lowX, double highX,
62  const std::string & titleX, const std::string & titleY,
63  Option_t * option )
64  {
65 
66  std::cout << newName(name) << std::endl;
67  MonitorElement * me = m_store->book1DD(newName(name),title,nchX,lowX,highX) ;
68  me->getTH1()->Sumw2() ;
69  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
70  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
71  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
72  return me ;
73  }
74 
75 //------------------------------------------------------------------------------
76 
78  ( const std::string & name, const std::string & title,
79  int nchX, float *xbinsize,
80  const std::string & titleX, const std::string & titleY,
81  Option_t * option )
82  {
83  MonitorElement * me = m_store->book1D(newName(name),title,nchX,xbinsize) ;
84  //book1DD not implemented in DQMServices/Core/src/DQMStore.cc
85  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
86  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
87  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
88  return me ;
89  }
90 
91 //------------------------------------------------------------------------------
92 
94  ( const std::string & name, const std::string & title,
95  int nchX, float *xbinsize,
96  const std::string & titleX, const std::string & titleY,
97  Option_t * option )
98  {
99 
100  std::cout << newName(name) << std::endl;
101  MonitorElement * me = m_store->book1D(newName(name),title,nchX,xbinsize) ;
102  //book1DD not implemented in DQMServices/Core/src/DQMStore.cc
103  me->getTH1()->Sumw2() ;
104  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
105  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
106  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
107  return me ;
108  }
109 
110 //------------------------------------------------------------------------------
111 
113  ( const std::string & name, const std::string & title,
114  int nchX, double lowX, double highX,
115  int nchY, double lowY, double highY,
116  const std::string & titleX, const std::string & titleY,
117  Option_t * option )
118  {
119  MonitorElement * me = m_store->book2DD(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
120  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
121  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
122  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
123  return me ;
124  }
125 
126 //------------------------------------------------------------------------------
127 
129  ( const std::string & name, const std::string & title,
130  int nchX, double lowX, double highX,
131  int nchY, double lowY, double highY,
132  const std::string & titleX, const std::string & titleY,
133  Option_t * option )
134  {
135  MonitorElement * me = m_store->book2DD(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
136  me->getTH1()->Sumw2() ;
137  if (titleX!="") { me->getTH1()->GetXaxis()->SetTitle(titleX.c_str()) ; }
138  if (titleY!="") { me->getTH1()->GetYaxis()->SetTitle(titleY.c_str()) ; }
139  if (TString(option)!="") { me->getTH1()->SetOption(option) ; }
140  return me ;
141  }
142 
143 //------------------------------------------------------------------------------
144 
146  ( const std::string & name, const std::string & title,
147  int nchX, double lowX, double highX,
148  double lowY, double highY,
149  const std::string & titleX, const std::string & titleY,
150  Option_t * option )
151  {
152  MonitorElement * me = m_store->bookProfile(newName(name),title,nchX,lowX,highX,lowY,highY," ") ;
153  if (titleX!="") { me->getTProfile()->GetXaxis()->SetTitle(titleX.c_str()) ; }
154  if (titleY!="") { me->getTProfile()->GetYaxis()->SetTitle(titleY.c_str()) ; }
155  if (TString(option)!="") { me->getTProfile()->SetOption(option) ; }
156  return me ;
157  }
158 
159 //------------------------------------------------------------------------------
160 
162  ( const std::string & name, MonitorElement * num, MonitorElement * denom,
163  const std::string & titleX, const std::string & titleY,
164  const std::string & title )
165  {
166  std::string name2 = newName(name) ;
167  TH1D * h_temp = dynamic_cast<TH1D*>( num->getTH1()->Clone(name2.c_str()) );
168  h_temp->Reset() ;
169  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
170  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
171  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
172  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
173  if (m_verbosityLevel>0) { h_temp->Print() ; }
174  MonitorElement * me = m_store->book1DD(name2,h_temp) ;
175  delete h_temp ;
176  return me ;
177  }
178 
179 //------------------------------------------------------------------------------
180 
182  ( const std::string & name, MonitorElement * num, MonitorElement * denom,
183  const std::string & titleX, const std::string & titleY,
184  const std::string & title )
185  {
186  std::string name2 = newName(name) ;
187  TH2D * h_temp = dynamic_cast<TH2D*>( num->getTH1()->Clone(name2.c_str()) );
188  h_temp->Reset() ;
189  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
190  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
191  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
192  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
193  if (m_verbosityLevel>0) { h_temp->Print() ; }
194  MonitorElement * me = m_store->book2DD(name2,h_temp) ;
195  delete h_temp ;
196  return me ;
197  }
198 
199 //------------------------------------------------------------------------------
200 
202  ( MonitorElement * me2d,
203  const std::string & title, const std::string & titleX, const std::string & titleY,
204  Double_t minimum, Double_t maximum )
205  {
206  std::string name2 = me2d->getName()+"_pfx" ;
207  TProfile * p1_temp = me2d->getTH2D()->ProfileX() ;
208  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
209  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
210  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
211  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
212  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
213  MonitorElement * me = m_store->bookProfile(name2,p1_temp) ;
214  delete p1_temp ;
215  return me ;
216  }
217 
218 //------------------------------------------------------------------------------
219 
221  ( MonitorElement * me2d,
222  const std::string & title, const std::string & titleX, const std::string & titleY,
223  Double_t minimum, Double_t maximum )
224  {
225  std::string name2 = me2d->getName()+"_pfy" ;
226  TProfile * p1_temp = me2d->getTH2D()->ProfileY() ;
227  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
228  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
229  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
230  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
231  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
232  MonitorElement * me = m_store->bookProfile(name2,p1_temp) ;
233  delete p1_temp ;
234  return me ;
235  }
236 
237 //------------------------------------------------------------------------------
238 
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
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="", Option_t *option="COLZ")
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", Option_t *option="E1 P")
TH2D * getTH2D(void) const
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="", Option_t *option="E1 P")
MonitorElement * bookH1withSumw2BinArray(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 * profileY(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
std::string newName(const std::string &name)
MonitorElement * profileX(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
TH1 * getTH1(void) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
tuple conf
Definition: dbtoconf.py:185
ScoutingAnalyzerBase(const edm::ParameterSet &conf)
MonitorElement * bookH1BinArray(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")
long long int num
Definition: procUtils.cc:71
TProfile * getTProfile(void) const
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", Option_t *option="E1 P")
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookH2andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
MonitorElement * bookH1andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
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="", Option_t *option="COLZ")