CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetMETDQMPostProcessor.cc
Go to the documentation of this file.
2 
7 
8 
9 #include <iostream>
10 #include <string.h>
11 #include <iomanip>
12 #include<fstream>
13 #include <math.h>
14 
15 
17 {
18  subDir_ = pset.getUntrackedParameter<std::string>("subDir");
19  patternJetTrg_ = pset.getUntrackedParameter<std::string>("PatternJetTrg","");
20  patternMetTrg_ = pset.getUntrackedParameter<std::string>("PatternMetTrg","");
21 }
22 
24 {
26  // setup DQM stor //
28 
29  bool isJetDir = false;
30  bool isMetDir = false;
31  double val,err;
32  TPRegexp patternJet(patternJetTrg_);
33  TPRegexp patternMet(patternMetTrg_);
34 
35  DQMStore * dqm = 0;
36  dqm = edm::Service<DQMStore>().operator->();
37 
38  if ( ! dqm ) {
39  edm::LogInfo("JetMETDQMPostProcessor") << "Cannot create DQMStore instance\n";
40  return;
41  }
42 
43 
44  //go to the directory to be processed
45  if(dqm->dirExists(subDir_)) dqm->cd(subDir_);
46  else {
47  edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
48  return;
49  }
50 
51  std::vector<std::string> subdirectories = dqm->getSubdirs();
52  for(std::vector<std::string>::iterator dir = subdirectories.begin() ;dir!= subdirectories.end(); dir++ ){
53  dqm->cd(*dir);
54  isJetDir = false;
55  isMetDir = false;
56  //if (TString(*dir).Contains("Jet([0-9]*)?")) isJetDir = true;
57  if (TString(*dir).Contains(patternJet)) isJetDir = true;
58  //if (TString(*dir).Contains("MET([0-9]*)?") || TString(*dir).Contains("MHT([0-9]*)?")) isMetDir = true;
59  if (TString(*dir).Contains(patternMet)) isMetDir = true;
60 
61  if (isMetDir) {
62  TH1F* gmetTrg = new TH1F("gmetTrg","gmetTrg",100,0,500);
63  TH1F* gmetTrg2 = new TH1F("gmetTrg2","gmetTrg2",100,0,500);
64  TH1F* gmetTrgLow = new TH1F("gmetTrgLow","gmetTrgLow",100,0,500);
65  TH1F* gmet = new TH1F("gmet","gmet",100,0,500);
66  TH1F* rmetTrg = new TH1F("rmetTrg","rmetTrg",100,0,500);
67  TH1F* rmetTrg2 = new TH1F("rmetTrg2","rmetTrg2",100,0,500);
68  TH1F* rmetTrgLow = new TH1F("rmetTrgLow","rmetTrgLow",100,0,500);
69  TH1F* rmet = new TH1F("rmet","rmet",100,0,500);
70 
71  TProfile* gmto = new TProfile("_meTurnOngMET","Gen Missing ET Turn-On RelVal",100,0,500,0,1);
72  TProfile* gmtol = new TProfile("_meTurnOngMETLow","Gen Missing ET Turn-On Data",100,0,500,0,1);
73  TProfile* rmto = new TProfile("_meTurnOnrMET","Reco Missing ET Turn-On RelVal",100,0,500,0,1);
74  TProfile* rmtol = new TProfile("_meTurnOnrMETLow","Reco Missing ET Turn-On Data",100,0,500,0,1);
75 
76  //std::cout<<"PostVal-Met paths: "<<dqm->pwd()<<" "<<*dir<<std::endl;
77 
78  gmetTrg->Add(dqm->get(dqm->pwd() + "/_meGenMETTrgMC")->getTH1F(),1);
79  gmetTrg->Sumw2();
80  gmetTrg2->Add(dqm->get(dqm->pwd() + "/_meGenMETTrg")->getTH1F(),1);
81  gmetTrg2->Sumw2();
82  gmetTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenMETTrgLow")->getTH1F(),1);
83  gmetTrgLow->Sumw2();
84  gmet->Add(dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F(),1);
85  gmet->Sumw2();
86  gmetTrg->Divide(gmetTrg,gmet,1,1,"B");
87  gmetTrg2->Divide(gmetTrg2,gmetTrgLow,1,1,"B");
88 
89  rmetTrg->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrgMC")->getTH1F(),1);
90  rmetTrg->Sumw2();
91  rmetTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrg")->getTH1F(),1);
92  rmetTrg2->Sumw2();
93  rmetTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoMETTrgLow")->getTH1F(),1);
94  rmetTrgLow->Sumw2();
95  rmet->Add(dqm->get(dqm->pwd() + "/_meRecoMET")->getTH1F(),1);
96  rmet->Sumw2();
97  rmetTrg->Divide(rmetTrg,rmet,1,1,"B");
98  rmetTrg2->Divide(rmetTrg2,rmetTrgLow,1,1,"B");
99 
100  for (int ib=0;ib<100;ib++) {//---assumes 100 bins
101  //genmet relval
102  val = gmetTrg->GetBinContent(ib+1);
103  gmto->SetBinContent(ib+1,val);
104  gmto->SetBinEntries(ib+1,1);
105  err = gmetTrg->GetBinError(ib+1);
106  gmto->SetBinError(ib+1,sqrt(err*err+val*val));
107  //genmet data
108  val = gmetTrg2->GetBinContent(ib+1);
109  gmtol->SetBinContent(ib+1,val);
110  gmtol->SetBinEntries(ib+1,1);
111  err = gmetTrg2->GetBinError(ib+1);
112  gmtol->SetBinError(ib+1,sqrt(err*err+val*val));
113  //recmet relval
114  val = rmetTrg->GetBinContent(ib+1);
115  rmto->SetBinContent(ib+1,val);
116  rmto->SetBinEntries(ib+1,1);
117  err = rmetTrg->GetBinError(ib+1);
118  rmto->SetBinError(ib+1,sqrt(err*err+val*val));
119  //recmet data
120  val = rmetTrg2->GetBinContent(ib+1);
121  rmtol->SetBinContent(ib+1,val);
122  rmtol->SetBinEntries(ib+1,1);
123  err = rmetTrg2->GetBinError(ib+1);
124  rmtol->SetBinError(ib+1,sqrt(err*err+val*val));
125  }
126  dqm->bookProfile("Gen Missing ET Turn-On RelVal",gmto);
127  dqm->bookProfile("Gen Missing ET Turn-On Data",gmtol);
128  dqm->bookProfile("Reco Missing ET Turn-On RelVal",rmto);
129  dqm->bookProfile("Reco Missing ET Turn-On Data",rmtol);
130  delete gmto;
131  delete gmtol;
132  delete rmto;
133  delete rmtol;
134  delete gmetTrg;
135  delete gmetTrg2;
136  delete gmetTrgLow;
137  delete gmet;
138  delete rmetTrg;
139  delete rmetTrg2;
140  delete rmetTrgLow;
141  delete rmet;
142 
143  }
144 
145  if (isJetDir) {
146  TH1F* gjetTrg = new TH1F("gjetTrg","gjetTrg",100,0,500);
147  TH1F* gjetTrg2 = new TH1F("gjetTrg2","gjetTrg2",100,0,500);
148  TH1F* gjetTrgLow = new TH1F("gjetTrgLow","gjetTrgLow",100,0,500);
149  TH1F* gjet = new TH1F("gjet","gjet",100,0,500);
150  TH1F* gjetEtaTrg = new TH1F("gjetEtaTrg","gjetEtaTrg",100,-10,10);
151  TH1F* gjetEtaTrg2 = new TH1F("gjetEtaTrg2","gjetEtaTrg2",100,-10,10);
152  TH1F* gjetEtaTrgLow = new TH1F("gjetEtaTrgLow","gjetEtaTrgLow",100,-10,10);
153  TH1F* gjetEta = new TH1F("gjetEta","gjetEta",100,-10,10);
154  TH1F* gjetPhiTrg = new TH1F("gjetPhiTrg","gjetPhiTrg",100,-4,4);
155  TH1F* gjetPhiTrg2 = new TH1F("gjetPhiTrg2","gjetPhiTrg2",100,-4,4);
156  TH1F* gjetPhiTrgLow = new TH1F("gjetPhiTrgLow","gjetPhiTrgLow",100,-4,4);
157  TH1F* gjetPhi = new TH1F("gjetPhi","gjetPhi",100,-4,4);
158  TH1F* rjetTrg = new TH1F("rjetTrg","rjetTrg",100,0,500);
159  TH1F* rjetTrg2 = new TH1F("rjetTrg2","rjetTrg2",100,0,500);
160  TH1F* rjetTrgLow = new TH1F("rjetTrgLow","rjetTrgLow",100,0,500);
161  TH1F* rjet = new TH1F("rjet","rjet",100,0,500);
162  TH1F* rjetEtaTrg = new TH1F("rjetEtaTrg","rjetEtaTrg",100,-10,10);
163  TH1F* rjetEtaTrg2 = new TH1F("rjetEtaTrg2","rjetEtaTrg2",100,-10,10);
164  TH1F* rjetEtaTrgLow = new TH1F("rjetEtaTrgLow","rjetEtaTrgLow",100,-10,10);
165  TH1F* rjetEta = new TH1F("rjetEta","rjetEta",100,-10,10);
166  TH1F* rjetPhiTrg = new TH1F("rjetPhiTrg","rjetPhiTrg",100,-4,4);
167  TH1F* rjetPhiTrg2 = new TH1F("rjetPhiTrg2","rjetPhiTrg2",100,-4,4);
168  TH1F* rjetPhiTrgLow = new TH1F("rjetPhiTrgLow","rjetPhiTrgLow",100,-4,4);
169  TH1F* rjetPhi = new TH1F("rjetPhi","rjetPhi",100,-4,4);
170 
171  TProfile* gjto = new TProfile("_meTurnOngJetPt","Gen Jet Pt Turn-On RelVal",100,0,500,0,1);
172  TProfile* gjtol = new TProfile("_meTurnOngJetPtLow","Gen Jet Pt Turn-On Data",100,0,500,0,1);
173  TProfile* gjeto = new TProfile("_meTurnOngJetEta","Gen Jet Eta Turn-On RelVal",100,-10,10,0,1);
174  TProfile* gjetol = new TProfile("_meTurnOngJetEtaLow","Gen Jet Eta Turn-On Data",100,-10,10,0,1);
175  TProfile* gjpto = new TProfile("_meTurnOngJetPhi","Gen Jet Phi Turn-On RelVal",100,-4,4,0,1);
176  TProfile* gjptol = new TProfile("_meTurnOngJetPhiLow","Gen Jet Phi Turn-On Data",100,-4,4,0,1);
177  TProfile* rjto = new TProfile("_meTurnOnrJetPt","Reco Jet Pt Turn-On RelVal",100,0,500,0,1);
178  TProfile* rjtol = new TProfile("_meTurnOnrJetPtLow","Reco Jet Pt Turn-On Data",100,0,500,0,1);
179  TProfile* rjeto = new TProfile("_meTurnOnrJetEta","Reco Jet Eta Turn-On RelVal",100,-10,10,0,1);
180  TProfile* rjetol = new TProfile("_meTurnOnrJetEtaLow","Reco Jet Eta Turn-On Data",100,-10,10,0,1);
181  TProfile* rjpto = new TProfile("_meTurnOnrJetPhi","Reco Jet Phi Turn-On RelVal",100,-4,4,0,1);
182  TProfile* rjptol = new TProfile("_meTurnOnrJetPhiLow","Reco Jet Phi Turn-On Data",100,-4,4,0,1);
183 
184  //std::cout<<"PostVal-Jet paths: "<<dqm->pwd()<<" "<<*dir<<std::endl;
185 
186  gjetTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrgMC")->getTH1F(),1);
187  gjetTrg->Sumw2();
188  gjetTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrg")->getTH1F(),1);
189  gjetTrg2->Sumw2();
190  gjetTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrgLow")->getTH1F(),1);
191  gjetTrgLow->Sumw2();
192  gjet->Add(dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F(),1);
193  gjet->Sumw2();
194  gjetTrg->Divide(gjetTrg,gjet,1,1,"B");
195  gjetTrg2->Divide(gjetTrg2,gjetTrgLow,1,1,"B");
196 
197  rjetTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrgMC")->getTH1F(),1);
198  rjetTrg->Sumw2();
199  rjetTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrg")->getTH1F(),1);
200  rjetTrg2->Sumw2();
201  rjetTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetPtTrgLow")->getTH1F(),1);
202  rjetTrgLow->Sumw2();
203  rjet->Add(dqm->get(dqm->pwd() + "/_meRecoJetPt")->getTH1F(),1);
204  rjet->Sumw2();
205  rjetTrg->Divide(rjetTrg,rjet,1,1,"B");
206  rjetTrg2->Divide(rjetTrg2,rjetTrgLow,1,1,"B");
207 
208  gjetEtaTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrgMC")->getTH1F(),1);
209  gjetEtaTrg->Sumw2();
210  gjetEtaTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrg")->getTH1F(),1);
211  gjetEtaTrg2->Sumw2();
212  gjetEtaTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetEtaTrgLow")->getTH1F(),1);
213  gjetEtaTrgLow->Sumw2();
214  gjetEta->Add(dqm->get(dqm->pwd() + "/_meGenJetEta")->getTH1F(),1);
215  gjetEta->Sumw2();
216  gjetEtaTrg->Divide(gjetEtaTrg,gjetEta,1,1,"B");
217  gjetEtaTrg2->Divide(gjetEtaTrg2,gjetEtaTrgLow,1,1,"B");
218 
219  rjetEtaTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrgMC")->getTH1F(),1);
220  rjetEtaTrg->Sumw2();
221  rjetEtaTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrg")->getTH1F(),1);
222  rjetEtaTrg2->Sumw2();
223  rjetEtaTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetEtaTrgLow")->getTH1F(),1);
224  rjetEtaTrgLow->Sumw2();
225  rjetEta->Add(dqm->get(dqm->pwd() + "/_meRecoJetEta")->getTH1F(),1);
226  rjetEta->Sumw2();
227  rjetEtaTrg->Divide(rjetEtaTrg,rjetEta,1,1,"B");
228  rjetEtaTrg2->Divide(rjetEtaTrg2,rjetEtaTrgLow,1,1,"B");
229 
230  gjetPhiTrg->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrgMC")->getTH1F(),1);
231  gjetPhiTrg->Sumw2();
232  gjetPhiTrg2->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrg")->getTH1F(),1);
233  gjetPhiTrg2->Sumw2();
234  gjetPhiTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenJetPhiTrgLow")->getTH1F(),1);
235  gjetPhiTrgLow->Sumw2();
236  gjetPhi->Add(dqm->get(dqm->pwd() + "/_meGenJetPhi")->getTH1F(),1);
237  gjetPhi->Sumw2();
238  gjetPhiTrg->Divide(gjetPhiTrg,gjetPhi,1,1,"B");
239  gjetPhiTrg2->Divide(gjetPhiTrg2,gjetPhiTrgLow,1,1,"B");
240 
241  rjetPhiTrg->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrgMC")->getTH1F(),1);
242  rjetPhiTrg->Sumw2();
243  rjetPhiTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrg")->getTH1F(),1);
244  rjetPhiTrg2->Sumw2();
245  rjetPhiTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhiTrgLow")->getTH1F(),1);
246  rjetPhiTrgLow->Sumw2();
247  rjetPhi->Add(dqm->get(dqm->pwd() + "/_meRecoJetPhi")->getTH1F(),1);
248  rjetPhi->Sumw2();
249  rjetPhiTrg->Divide(rjetPhiTrg,rjetPhi,1,1,"B");
250  rjetPhiTrg2->Divide(rjetPhiTrg2,rjetPhiTrgLow,1,1,"B");
251 
252  for (int ib=0;ib<100;ib++) {//---assumes 100 bins too
253  //genjet relval
254  val = gjetTrg->GetBinContent(ib+1);
255  gjto->SetBinContent(ib+1,val);
256  gjto->SetBinEntries(ib+1,1);
257  err = gjetTrg->GetBinError(ib+1);
258  gjto->SetBinError(ib+1,sqrt(err*err+val*val));
259  //genjet data
260  val = gjetTrg2->GetBinContent(ib+1);
261  gjtol->SetBinContent(ib+1,val);
262  gjtol->SetBinEntries(ib+1,1);
263  err = gjetTrg2->GetBinError(ib+1);
264  gjtol->SetBinError(ib+1,sqrt(err*err+val*val));
265  //recjet relval
266  val = rjetTrg->GetBinContent(ib+1);
267  rjto->SetBinContent(ib+1,val);
268  rjto->SetBinEntries(ib+1,1);
269  err = rjetTrg->GetBinError(ib+1);
270  rjto->SetBinError(ib+1,sqrt(err*err+val*val));
271  //recjet data
272  val = rjetTrg2->GetBinContent(ib+1);
273  rjtol->SetBinContent(ib+1,val);
274  rjtol->SetBinEntries(ib+1,1);
275  err = rjetTrg2->GetBinError(ib+1);
276  rjtol->SetBinError(ib+1,sqrt(err*err+val*val));
277  //genjeteta relval
278  val = gjetEtaTrg->GetBinContent(ib+1);
279  gjeto->SetBinContent(ib+1,val);
280  gjeto->SetBinEntries(ib+1,1);
281  err = gjetEtaTrg->GetBinError(ib+1);
282  gjeto->SetBinError(ib+1,sqrt(err*err+val*val));
283  //genjeteta data
284  val = gjetEtaTrg2->GetBinContent(ib+1);
285  gjetol->SetBinContent(ib+1,val);
286  gjetol->SetBinEntries(ib+1,1);
287  err = gjetEtaTrg2->GetBinError(ib+1);
288  gjetol->SetBinError(ib+1,sqrt(err*err+val*val));
289  //recjeteta relval
290  val = rjetEtaTrg->GetBinContent(ib+1);
291  rjeto->SetBinContent(ib+1,val);
292  rjeto->SetBinEntries(ib+1,1);
293  err = rjetEtaTrg->GetBinError(ib+1);
294  rjeto->SetBinError(ib+1,sqrt(err*err+val*val));
295  //recjeteta data
296  val = rjetEtaTrg2->GetBinContent(ib+1);
297  rjetol->SetBinContent(ib+1,val);
298  rjetol->SetBinEntries(ib+1,1);
299  err = rjetEtaTrg2->GetBinError(ib+1);
300  rjetol->SetBinError(ib+1,sqrt(err*err+val*val));
301  //genjetphi relval
302  val = gjetPhiTrg->GetBinContent(ib+1);
303  gjpto->SetBinContent(ib+1,val);
304  gjpto->SetBinEntries(ib+1,1);
305  err = gjetPhiTrg->GetBinError(ib+1);
306  gjpto->SetBinError(ib+1,sqrt(err*err+val*val));
307  //genjetphi data
308  val = gjetPhiTrg2->GetBinContent(ib+1);
309  gjptol->SetBinContent(ib+1,val);
310  gjptol->SetBinEntries(ib+1,1);
311  err = gjetPhiTrg2->GetBinError(ib+1);
312  gjptol->SetBinError(ib+1,sqrt(err*err+val*val));
313  //recjetphi relval
314  val = rjetPhiTrg->GetBinContent(ib+1);
315  rjpto->SetBinContent(ib+1,val);
316  rjpto->SetBinEntries(ib+1,1);
317  err = rjetPhiTrg->GetBinError(ib+1);
318  rjpto->SetBinError(ib+1,sqrt(err*err+val*val));
319  //recjetphi data
320  val = rjetPhiTrg2->GetBinContent(ib+1);
321  rjptol->SetBinContent(ib+1,val);
322  rjptol->SetBinEntries(ib+1,1);
323  err = rjetPhiTrg2->GetBinError(ib+1);
324  rjptol->SetBinError(ib+1,sqrt(err*err+val*val));
325  }
326  dqm->bookProfile("Gen Jet Pt Turn-On RelVal",gjto);
327  dqm->bookProfile("Gen Jet Pt Turn-On Data",gjtol);
328  dqm->bookProfile("Reco Jet Pt Turn-On RelVal",rjto);
329  dqm->bookProfile("Reco Jet Pt Turn-On Data",rjtol);
330  dqm->bookProfile("Gen Jet Eta Turn-On RelVal",gjeto);
331  dqm->bookProfile("Gen Jet Eta Turn-On Data",gjetol);
332  dqm->bookProfile("Reco Jet Eta Turn-On RelVal",rjeto);
333  dqm->bookProfile("Reco Jet Eta Turn-On Data",rjetol);
334  dqm->bookProfile("Gen Jet Phi Turn-On RelVal",gjpto);
335  dqm->bookProfile("Gen Jet Phi Turn-On Data",gjptol);
336  dqm->bookProfile("Reco Jet Phi Turn-On RelVal",rjpto);
337  dqm->bookProfile("Reco Jet Phi Turn-On Data",rjptol);
338  delete gjto;
339  delete gjtol;
340  delete gjeto;
341  delete gjetol;
342  delete gjpto;
343  delete gjptol;
344  delete rjto;
345  delete rjtol;
346  delete rjeto;
347  delete rjetol;
348  delete rjpto;
349  delete rjptol;
350  delete gjetTrg;
351  delete gjetTrg2;
352  delete gjetTrgLow;
353  delete gjet;
354  delete rjetTrg;
355  delete rjetTrg2;
356  delete rjetTrgLow;
357  delete rjet;
358  delete gjetEtaTrg;
359  delete gjetEtaTrg2;
360  delete gjetEtaTrgLow;
361  delete gjetEta;
362  delete rjetEtaTrg;
363  delete rjetEtaTrg2;
364  delete rjetEtaTrgLow;
365  delete rjetEta;
366  delete gjetPhiTrg;
367  delete gjetPhiTrg2;
368  delete gjetPhiTrgLow;
369  delete gjetPhi;
370  delete rjetPhiTrg;
371  delete rjetPhiTrg2;
372  delete rjetPhiTrgLow;
373  delete rjetPhi;
374  }
375 
376  /*
377  TH1F* ghtTrg = new TH1F("ghtTrg","ghtTrg",100,0,1000);
378  TH1F* ghtTrg2 = new TH1F("ghtTrg2","ghtTrg2",100,0,1000);
379  TH1F* ghtTrgLow = new TH1F("ghtTrgLow","ghtTrgLow",100,0,1000);
380  TH1F* ght = new TH1F("ght","ght",100,0,1000);
381  TH1F* rhtTrg = new TH1F("rhtTrg","rhtTrg",100,0,1000);
382  TH1F* rhtTrg2 = new TH1F("rhtTrg2","rhtTrg2",100,0,1000);
383  TH1F* rhtTrgLow = new TH1F("rhtTrgLow","rhtTrgLow",100,0,1000);
384  TH1F* rht = new TH1F("rht","rht",100,0,1000);
385  TProfile* ghto = new TProfile("_meTurnOngHT","Gen HT Turn-On RelVal",100,0,1000,0,1);
386  TProfile* ghtol = new TProfile("_meTurnOngHTLow","Gen HT Turn-On Data",100,0,1000,0,1);
387  TProfile* rhto = new TProfile("_meTurnOnrHT","Reco HT Turn-On RelVal",100,0,1000,0,1);
388  TProfile* rhtol = new TProfile("_meTurnOnrHTLow","Reco HT Turn-On Data",100,0,1000,0,1);
389 
390  ghtTrg->Add(dqm->get(dqm->pwd() + "/_meGenHTTrg")->getTH1F(),1);
391  ghtTrg->Sumw2();
392  ghtTrg2->Add(dqm->get(dqm->pwd() + "/_meGenHTTrg")->getTH1F(),1);
393  ghtTrg2->Sumw2();
394  ghtTrgLow->Add(dqm->get(dqm->pwd() + "/_meGenHTTrgLow")->getTH1F(),1);
395  ghtTrgLow->Sumw2();
396  ght->Add(dqm->get(dqm->pwd() + "/_meGenHT")->getTH1F(),1);
397  ght->Sumw2();
398  ghtTrg->Divide(ghtTrg,ght,1,1,"B");
399  ghtTrg2->Divide(ghtTrg2,ghtTrgLow,1,1,"B");
400 
401  rhtTrg->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrg")->getTH1F(),1);
402  rhtTrg->Sumw2();
403  rhtTrg2->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrg")->getTH1F(),1);
404  rhtTrg2->Sumw2();
405  rhtTrgLow->Add(dqm->get(dqm->pwd() + "/_meRecoHTTrgLow")->getTH1F(),1);
406  rhtTrgLow->Sumw2();
407  rht->Add(dqm->get(dqm->pwd() + "/_meRecoHT")->getTH1F(),1);
408  rht->Sumw2();
409  rhtTrg->Divide(rhtTrg,rht,1,1,"B");
410  rhtTrg2->Divide(rhtTrg2,rhtTrgLow,1,1,"B");
411  */
412 
413  //std::vector<std::string> mes = dqm->getMEs();
414  //for(std::vector<std::string>::iterator me = mes.begin() ;me!= mes.end(); me++ )
415  // std::cout <<*me <<std::endl;
416  //std::cout <<std::endl;
417 
418  /*
419  //genht relval
420  val = ghtTrg->GetBinContent(ib+1);
421  ghto->SetBinContent(ib+1,val);
422  ghto->SetBinEntries(ib+1,1);
423  err = ghtTrg->GetBinError(ib+1);
424  ghto->SetBinError(ib+1,sqrt(err*err+val*val));
425  //genht data
426  val = ghtTrg2->GetBinContent(ib+1);
427  ghtol->SetBinContent(ib+1,val);
428  ghtol->SetBinEntries(ib+1,1);
429  err = ghtTrg2->GetBinError(ib+1);
430  ghtol->SetBinError(ib+1,sqrt(err*err+val*val));
431  //recht relval
432  val = rhtTrg->GetBinContent(ib+1);
433  rhto->SetBinContent(ib+1,val);
434  rhto->SetBinEntries(ib+1,1);
435  err = rhtTrg->GetBinError(ib+1);
436  rhto->SetBinError(ib+1,sqrt(err*err+val*val));
437  //recht data
438  val = rhtTrg2->GetBinContent(ib+1);
439  rhtol->SetBinContent(ib+1,val);
440  rhtol->SetBinEntries(ib+1,1);
441  err = rhtTrg2->GetBinError(ib+1);
442  rhtol->SetBinError(ib+1,sqrt(err*err+val*val));
443  */
444 
445  //std::cout <<"MET:"<<_meTurnOnMET->getBinContent(ib+1)<<" "<<gmetTrg->GetBinContent(ib+1)<<" "<<_meTurnOnMET->getBinError(ib+1)<<" "<<gmetTrg->GetBinError(ib+1)<<std::endl;
446  //std::cout <<"JET:"<<_meTurnOnJetPt->getBinContent(ib+1)<<" "<<gjetTrg->GetBinContent(ib+1)<<" "<<_meTurnOnJetPt->getBinError(ib+1)<<" "<<gjetTrg->GetBinError(ib+1)<<std::endl;
447 
448 
449  /*
450  dqm->bookProfile("Gen HT Turn-On RelVal",ghto);
451  dqm->bookProfile("Gen HT Turn-On Data",ghtol);
452  dqm->bookProfile("Reco HT Turn-On RelVal",rhto);
453  dqm->bookProfile("Reco HT Turn-On Data",rhtol);
454  delete ghto;
455  delete ghtol;
456  delete rhto;
457  delete rhtol;
458  delete ghtTrg;
459  delete ghtTrg2;
460  delete ghtTrgLow;
461  delete ght;
462  delete rhtTrg;
463  delete rhtTrg2;
464  delete rhtTrgLow;
465  delete rht;
466  */
467  dqm->goUp();
468  }
469 }
471 {
472  /*
474  // setup DQM stor //
476 
477  DQMStore * dqm = 0;
478  dqm = edm::Service<DQMStore>().operator->();
479 
480  if ( ! dqm ) {
481  edm::LogInfo("JetMETDQMPostProcessor") << "Cannot create DQMStore instance\n";
482  return;
483  }
484 
485 
486  //go to the directory to be processed
487  if(dqm->dirExists(subDir_)) dqm->cd(subDir_);
488  else {
489  edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
490  return;
491  }
492 
493  std::vector<std::string> subdirectories = dqm->getSubdirs();
494  for(std::vector<std::string>::iterator dir = subdirectories.begin() ;dir!= subdirectories.end(); dir++ ){
495  dqm->cd(*dir);
496 
497  MonitorElement*_meTurnOnMET = dqm->book1D("_meTurnOnMET","Missing ET Turn-On",100,0,500);
498  MonitorElement*_meTurnOnJetPt = dqm->book1D("_meTurnOnJetPt","Jet Pt Turn-On",100,0,500);
499 
500  //std::vector<std::string> mes = dqm->getMEs();
501  //for(std::vector<std::string>::iterator me = mes.begin() ;me!= mes.end(); me++ )
502  // std::cout <<*me <<std::endl;
503  //std::cout <<std::endl;
504 
505  _meTurnOnMET->getTH1F()->Add(dqm->get(dqm->pwd() + "/_meGenMETTrg")->getTH1F(),1);
506  _meTurnOnMET->getTH1F()->Sumw2();
507  dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F()->Sumw2();
508  _meTurnOnMET->getTH1F()->Divide(_meTurnOnMET->getTH1F(),dqm->get(dqm->pwd() + "/_meGenMET")->getTH1F(),1,1,"B");
509 
510  _meTurnOnJetPt->getTH1F()->Add(dqm->get(dqm->pwd() + "/_meGenJetPtTrg")->getTH1F(),1);
511  _meTurnOnJetPt->getTH1F()->Sumw2();
512  dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F()->Sumw2();
513  _meTurnOnJetPt->getTH1F()->Divide(_meTurnOnJetPt->getTH1F(),dqm->get(dqm->pwd() + "/_meGenJetPt")->getTH1F(),1,1,"B");
514 
515  dqm->goUp();
516  }
517  */
518 }
T getUntrackedParameter(std::string const &, T const &) const
void endRun(edm::Run const &, edm::EventSetup const &)
int ib
Definition: cuy.py:660
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1659
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:644
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
JetMETDQMPostProcessor(const edm::ParameterSet &pset)
T sqrt(T t)
Definition: SSEVec.h:48
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1268
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:732
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:678
dbl *** dir
Definition: mlp_gen.cc:35
Definition: Run.h:41
const std::string & pwd(void) const
Definition: DQMStore.cc:639