CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonTestSummary.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * \author G. Mila - INFN Torino
6  */
7 
8 
10 
11 // Framework
15 
20 
21 #include "DQMOffline/Muon/test/langauFit.C"
22 #include <string>
23 
24 using namespace edm;
25 using namespace std;
26 
27 
29 
30  dbe = Service<DQMStore>().operator->();
31  dbe->cd();
32  dbe->setCurrentFolder("Muons/TestSummary");
33 
34  // parameter initialization for kinematics test
35  etaExpected = ps.getParameter<double>("etaExpected");
36  phiExpected = ps.getParameter<double>("phiExpected");
37  chi2Fraction = ps.getParameter<double>("chi2Fraction");
38  chi2Spread = ps.getParameter<double>("chi2Spread");
39  resEtaSpread_tkGlb = ps.getParameter<double>("resEtaSpread_tkGlb");
40  resEtaSpread_glbSta = ps.getParameter<double>("resEtaSpread_glbSta");
41  resPhiSpread_tkGlb = ps.getParameter<double>("resPhiSpread_tkGlb");
42  resPhiSpread_glbSta = ps.getParameter<double>("resPhiSpread_glbSta");
43  resOneOvPSpread_tkGlb = ps.getParameter<double>("resOneOvPSpread_tkGlb");
44  resOneOvPSpread_glbSta = ps.getParameter<double>("resOneOvPSpread_glbSta");
45  pullEtaSpread = ps.getParameter<double>("pullEtaSpread");
46  pullPhiSpread = ps.getParameter<double>("pullPhiSpread");
47  pullOneOvPSpread = ps.getParameter<double>("pullOneOvPSpread");
48  resChargeLimit_tkGlb = ps.getParameter<double>("resChargeLimit_tkGlb");
49  resChargeLimit_glbSta = ps.getParameter<double>("resChargeLimit_glbSta");
50  resChargeLimit_tkSta = ps.getParameter<double>("resChargeLimit_tkSta");
51  numMatchedExpected_min = ps.getParameter<double>("numMatchedExpected_min");
52  numMatchedExpected_max = ps.getParameter<double>("numMatchedExpected_max");
53  matchesFractionDt_min = ps.getParameter<double>("matchesFractionDt_min");
54  matchesFractionDt_max = ps.getParameter<double>("matchesFractionDt_max");
55  matchesFractionCsc_min = ps.getParameter<double>("matchesFractionCsc_min");
56  matchesFractionCsc_max = ps.getParameter<double>("matchesFractionCsc_max");
57  resSegmTrack_rms_min = ps.getParameter<double>("resSegmTrack_rms_min");
58  resSegmTrack_rms_max = ps.getParameter<double>("resSegmTrack_rms_max");
59  resSegmTrack_mean_min = ps.getParameter<double>("resSegmTrack_mean_min");
60  resSegmTrack_mean_max = ps.getParameter<double>("resSegmTrack_mean_max");
61  expPeakEcalS9_min = ps.getParameter<double>("expPeakEcalS9_min");
62  expPeakEcalS9_max = ps.getParameter<double>("expPeakEcalS9_max");
63  expPeakHadS9_min = ps.getParameter<double>("expPeakHadS9_min");
64  expPeakHadS9_max = ps.getParameter<double>("expPeakHadS9_max");
65  expMultiplicityGlb_max = ps.getParameter<double>("expMultiplicityGlb_max");
66  expMultiplicityTk_max = ps.getParameter<double>("expMultiplicityTk_max");
67  expMultiplicitySta_max = ps.getParameter<double>("expMultiplicitySta_max");
68  expMultiplicityGlb_min = ps.getParameter<double>("expMultiplicityGlb_min");
69  expMultiplicityTk_min = ps.getParameter<double>("expMultiplicityTk_min");
70  expMultiplicitySta_min = ps.getParameter<double>("expMultiplicitySta_min");
71 
72 }
73 
75 
77 
78  metname = "muonTestSummary";
79  LogTrace(metname)<<"[MuonTestSummary] beginJob: Histo booking";
80  dbe->cd();
81  dbe->setCurrentFolder("Muons/TestSummary");
82 
83  // book the summary histos
84 }
85 void MuonTestSummary::beginRun(Run const& run, EventSetup const& eSetup) {
86 
87  LogTrace(metname)<<"[MuonTestSummary]: beginRun";
88 
89  dbe->cd();
90  dbe->setCurrentFolder("Muons/TestSummary");
91 
92  // kinematics test report
93  kinematicsSummaryMap = dbe->book2D("kinematicsSummaryMap","Kinematics test summary",5,1,6,3,1,4);
94  kinematicsSummaryMap->setAxisTitle("track monitored",1);
95  kinematicsSummaryMap->setBinLabel(1,"GLB",1);
96  kinematicsSummaryMap->setBinLabel(2,"TKfromGLB",1);
97  kinematicsSummaryMap->setBinLabel(3,"STAfromGLB",1);
98  kinematicsSummaryMap->setBinLabel(4,"TK",1);
99  kinematicsSummaryMap->setBinLabel(5,"STA",1);
100  kinematicsSummaryMap->setAxisTitle("parameter tested",2);
101  kinematicsSummaryMap->setBinLabel(1,"#chi^{2}",2);
102  kinematicsSummaryMap->setBinLabel(2,"#eta",2);
103  kinematicsSummaryMap->setBinLabel(3,"#phi",2);
104 
105  //chi2 kinematics quality test report
106  chi2TestSummaryMap = dbe->book2D("chi2TestSummaryMap","#chi2 quality test summary",5,1,6,5,1,6);
107  chi2TestSummaryMap->setAxisTitle("track monitored",1);
108  chi2TestSummaryMap->setBinLabel(1,"GLB",1);
109  chi2TestSummaryMap->setBinLabel(2,"TKfromGLB",1);
110  chi2TestSummaryMap->setBinLabel(3,"STAfromGLB",1);
111  chi2TestSummaryMap->setBinLabel(4,"TK",1);
112  chi2TestSummaryMap->setBinLabel(5,"STA",1);
113  chi2TestSummaryMap->setAxisTitle("parameter tested",2);
114  chi2TestSummaryMap->setBinLabel(1,"#chi^{2}",2);
115  chi2TestSummaryMap->setBinLabel(2,"#eta",2);
116  chi2TestSummaryMap->setBinLabel(3,"#phi",2);
117  chi2TestSummaryMap->setBinLabel(4,"#pt",2);
118  chi2TestSummaryMap->setBinLabel(5,"#q",2);
119 
120 //Kolmogorov kinematics quality test report
121  KolmogorovTestSummaryMap = dbe->book2D("KolmogorovTestSummaryMap","Kolmogorov quality test summary",5,1,6,5,1,6);
122  KolmogorovTestSummaryMap->setAxisTitle("track monitored",1);
123  KolmogorovTestSummaryMap->setBinLabel(1,"GLB",1);
124  KolmogorovTestSummaryMap->setBinLabel(2,"TKfromGLB",1);
125  KolmogorovTestSummaryMap->setBinLabel(3,"STAfromGLB",1);
126  KolmogorovTestSummaryMap->setBinLabel(4,"TK",1);
127  KolmogorovTestSummaryMap->setBinLabel(5,"STA",1);
128  KolmogorovTestSummaryMap->setAxisTitle("parameter tested",2);
129  KolmogorovTestSummaryMap->setBinLabel(1,"#chi^{2}",2);
130  KolmogorovTestSummaryMap->setBinLabel(2,"#eta",2);
131  KolmogorovTestSummaryMap->setBinLabel(3,"#phi",2);
132  KolmogorovTestSummaryMap->setBinLabel(4,"#pt",2);
133  KolmogorovTestSummaryMap->setBinLabel(5,"#q",2);
134 
135 
136  // residuals test report
137  residualsSummaryMap = dbe->book2D("residualsSummaryMap","Residuals test summary",4,1,5,4,1,5);
138  residualsSummaryMap->setAxisTitle("residuals",1);
139  residualsSummaryMap->setBinLabel(1,"TK-GLB",1);
140  residualsSummaryMap->setBinLabel(2,"GLB-STA",1);
141  residualsSummaryMap->setBinLabel(3,"TK-STA",1);
142  residualsSummaryMap->setBinLabel(4,"TK-STA Pull",1);
143  residualsSummaryMap->setAxisTitle("parameter tested",2);
144  residualsSummaryMap->setBinLabel(1,"#eta",2);
145  residualsSummaryMap->setBinLabel(2,"#phi",2);
146  residualsSummaryMap->setBinLabel(3,"1/p",2);
147  residualsSummaryMap->setBinLabel(4,"q",2);
148 
149  // muonId test report
150  muonIdSummaryMap = dbe->book2D("muonIdSummaryMap","muonId test summary",4,1,5, 5,1,6);
151  muonIdSummaryMap->setAxisTitle("muons",1);
152  muonIdSummaryMap->setBinLabel(1,"GLB DT",1);
153  muonIdSummaryMap->setBinLabel(2,"GLB CSC",1);
154  muonIdSummaryMap->setBinLabel(3,"TK DT",1);
155  muonIdSummaryMap->setBinLabel(4,"TK CSC",1);
156  muonIdSummaryMap->setAxisTitle("tests",2);
157  muonIdSummaryMap->setBinLabel(1,"#assSeg",2);
158  muonIdSummaryMap->setBinLabel(2,"x mean",2);
159  muonIdSummaryMap->setBinLabel(3,"x rms",2);
160  muonIdSummaryMap->setBinLabel(4,"y mean",2);
161  muonIdSummaryMap->setBinLabel(5,"y rms",2);
162 
163  // energy test report
164  energySummaryMap = dbe->book2D("energySummaryMap","Energy deposits test summary",3,1,4,3,1,4);
165  energySummaryMap->setAxisTitle("muons",1);
166  energySummaryMap->setBinLabel(1,"GLB",1);
167  energySummaryMap->setBinLabel(2,"TK",1);
168  energySummaryMap->setBinLabel(3,"STA",1);
169  energySummaryMap->setAxisTitle("calorimeter tested",2);
170  energySummaryMap->setBinLabel(1,"ECAL",2);
171  energySummaryMap->setBinLabel(2,"HAD",2);
172  energySummaryMap->setBinLabel(3,"H0",2);
173 
174  // multiplicity tests report
175  multiplicitySummaryMap = dbe->book1D("multiplicitySummaryMap","muon multiplicity test summary",3,1,4);
176  multiplicitySummaryMap->setAxisTitle("muon");
177  multiplicitySummaryMap->setBinLabel(1,"GLB");
178  multiplicitySummaryMap->setBinLabel(2,"TK");
179  multiplicitySummaryMap->setBinLabel(3,"STA");
180 
181 
182  // summary test report
183  dbe->setCurrentFolder("Muons/EventInfo");
184  summaryReport = dbe->bookFloat("reportSummary");
185 
186  summaryReportMap = dbe->book2D("reportSummaryMap","Muon Report Summary Map",3,1,4,7,1,8);
187  summaryReportMap->setAxisTitle("muons",1);
188  summaryReportMap->setBinLabel(1,"GLB",1);
189  summaryReportMap->setBinLabel(2,"TK",1);
190  summaryReportMap->setBinLabel(3,"STA",1);
191  summaryReportMap->setAxisTitle("test",2);
192  summaryReportMap->setBinLabel(1,"#chi^{2}/Df",2);
193  summaryReportMap->setBinLabel(2,"#eta",2);
194  summaryReportMap->setBinLabel(3,"#phi",2);
195  summaryReportMap->setBinLabel(4,"residuals",2);
196  summaryReportMap->setBinLabel(5,"muonId",2);
197  summaryReportMap->setBinLabel(6,"energyDeposits",2);
198  summaryReportMap->setBinLabel(7,"multiplicity",2);
199 
200  dbe->setCurrentFolder("Muons/EventInfo/reportSummaryContents");
201  theSummaryContents.push_back(dbe->bookFloat("kinematics_GLB"));
202  theSummaryContents.push_back(dbe->bookFloat("muonId_GLB"));
203  theSummaryContents.push_back(dbe->bookFloat("residuals_GLB"));
204  theSummaryContents.push_back(dbe->bookFloat("GLB"));
205  theSummaryContents.push_back(dbe->bookFloat("kinematics_TK"));
206  theSummaryContents.push_back(dbe->bookFloat("muonId_TK"));
207  theSummaryContents.push_back(dbe->bookFloat("residuals_TK"));
208  theSummaryContents.push_back(dbe->bookFloat("TK"));
209  theSummaryContents.push_back(dbe->bookFloat("kinematics_STA"));
210  theSummaryContents.push_back(dbe->bookFloat("residuals_STA"));
211  theSummaryContents.push_back(dbe->bookFloat("STA"));
212  theSummaryContents.push_back(dbe->bookFloat("energyDeposits"));
213  theSummaryContents.push_back(dbe->bookFloat("multiplicity"));
214 
215  // certification report
216  dbe->setCurrentFolder("Muons/EventInfo");
217  summaryCertification = dbe->bookFloat("CertificationSummary");
218  summaryCertification->Fill(-1);
219 
220  summaryCertificationMap = dbe->book2D("CertificationSummaryMap","Muon Certification Summary Map",9,1,10,7,1,8);
221  summaryCertificationMap->setAxisTitle("muons",1);
222  summaryCertificationMap->setBinLabel(1,"GLB_Tot",1);
223  summaryCertificationMap->setBinLabel(2,"TK_Tot",1);
224  summaryCertificationMap->setBinLabel(3,"STA_tot",1);
225  summaryCertificationMap->setBinLabel(4,"GLB_B",1);
226  summaryCertificationMap->setBinLabel(5,"TK_B",1);
227  summaryCertificationMap->setBinLabel(6,"STA_B",1);
228  summaryCertificationMap->setBinLabel(7,"GLB_EC",1);
229  summaryCertificationMap->setBinLabel(8,"TK_EC",1);
230  summaryCertificationMap->setBinLabel(9,"STA_EC",1);
231  summaryCertificationMap->setAxisTitle("test",2);
232  summaryCertificationMap->setBinLabel(1,"#chi^{2}/Df",2);
233  summaryCertificationMap->setBinLabel(2,"#eta",2);
234  summaryCertificationMap->setBinLabel(3,"#phi",2);
235  summaryCertificationMap->setBinLabel(4,"residuals",2);
236  summaryCertificationMap->setBinLabel(5,"muonId",2);
237  summaryCertificationMap->setBinLabel(6,"energyDeposits",2);
238  summaryCertificationMap->setBinLabel(7,"multiplicity",2);
239 
240  dbe->setCurrentFolder("Muons/EventInfo/CertificationContents");
241  theCertificationContents.push_back(dbe->bookFloat("GLB_Tot"));
242  theCertificationContents.push_back(dbe->bookFloat("STA_Tot"));
243  theCertificationContents.push_back(dbe->bookFloat("TK_Tot"));
244  theCertificationContents.push_back(dbe->bookFloat("GLB_B"));
245  theCertificationContents.push_back(dbe->bookFloat("STA_B"));
246  theCertificationContents.push_back(dbe->bookFloat("TK_B"));
247  theCertificationContents.push_back(dbe->bookFloat("GLB_EC"));
248  theCertificationContents.push_back(dbe->bookFloat("STA_EC"));
249  theCertificationContents.push_back(dbe->bookFloat("TK_EC"));
250 
251 
252  for (unsigned int icert=0;icert <theCertificationContents.size();icert++){
253  theCertificationContents[icert]->Fill(-1);
254  }
255 
256  // initialisation of histo bins
257  for(int xBin=1; xBin<=5; xBin++){
258  for(int yBin=1; yBin<=3; yBin++){
259  kinematicsSummaryMap->Fill(xBin,yBin,1);
260  }
261  for(int yBin=1; yBin<=5; yBin++){
262  chi2TestSummaryMap->Fill(xBin,yBin,1);
263  KolmogorovTestSummaryMap->Fill(xBin,yBin,1);
264  }
265  }
266  for(int xBin=1; xBin<=residualsSummaryMap->getNbinsX(); xBin++){
267  for(int yBin=1; yBin<=residualsSummaryMap->getNbinsY(); yBin++){
268  residualsSummaryMap->Fill(xBin,yBin,1);
269  }
270  }
271  residualsSummaryMap->setBinContent(4, 4, 1); //not used for now
272 
273  for(int xBin=1; xBin<=muonIdSummaryMap->getNbinsX(); xBin++){
274  for(int yBin=1; yBin<=muonIdSummaryMap->getNbinsY(); yBin++){
275  muonIdSummaryMap->Fill(xBin,yBin,1);
276  }
277  }
278  for(int xBin=1; xBin<=3; xBin++){
279  for(int yBin=1; yBin<=3; yBin++){
280  energySummaryMap->Fill(xBin,yBin,1);
281  }
282  }
283  for(int xBin=1; xBin<=3; xBin++){
284  multiplicitySummaryMap->Fill(xBin,1);
285  }
286  for(int xBin=1; xBin<=3; xBin++){
287  for(int yBin=1; yBin<=7; yBin++){
288  summaryReportMap->Fill(xBin,yBin,1);
289  }
290  }
291  for(int xBin=1; xBin<=9; xBin++){
292  for(int yBin=1; yBin<=7; yBin++){
293  summaryCertificationMap->Fill(xBin,yBin,1);
294  }
295  }
296 }
297 
299  // LogTrace(metname)<<"[MuonTestSummary]: beginLuminosityBlock";
300 }
301 
302 void MuonTestSummary::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
303 
304  // LogTrace(metname)<<"[MuonTestSummary]: endLuminosityBlock, performing the DQM LS client operation";
305 
306 }
307 
308 void MuonTestSummary::endRun(Run const& run, EventSetup const& eSetup) {
309 
310  LogTrace(metname)<<"[MuonTestSummary]: endRun, performing the DQM end of run client operation";
311 
312  // fill the kinematics report summary
313  doKinematicsTests("GlbMuon_Glb_", 1);
314  doKinematicsTests("GlbMuon_Tk_", 2);
315  doKinematicsTests("GlbMuon_Sta_",3);
316  doKinematicsTests("TkMuon_", 4);
317  doKinematicsTests("StaMuon_", 5);
318 
319  // fill the residuals report summary
320  doResidualsTests("TkGlb", "eta", 1);
321  doResidualsTests("GlbSta", "eta", 2);
322  doResidualsTests("TkSta", "eta", 3);
323  doResidualsTests("TkGlb", "phi", 1);
324  doResidualsTests("GlbSta", "phi", 2);
325  doResidualsTests("TkSta", "phi", 3);
326  doResidualsTests("TkGlb", "oneOverp", 1);
327  doResidualsTests("GlbSta", "oneOverp", 2);
328  doResidualsTests("TkSta", "oneOverp", 3);
329  doResidualsTests("GlbMuon", "qComparison", -1);
330 
331  // fill the muonID report summary
332  doMuonIDTests();
333 
334  // fill the energy report summary
335  doEnergyTests("ecalS9PointingMuDepositedEnergy_","Glb_muons", 1);
336  doEnergyTests("hadS9PointingMuDepositedEnergy_", "Glb_muons", 1);
337  doEnergyTests("hoS9PointingMuDepositedEnergy_", "Glb_muons", 1);
338  doEnergyTests("ecalS9PointingMuDepositedEnergy_", "Tk_muons", 2);
339  doEnergyTests("hadS9PointingMuDepositedEnergy_", "Tk_muons", 2);
340  doEnergyTests("hoS9PointingMuDepositedEnergy_", "Tk_muons", 2);
341  doEnergyTests("ecalS9PointingMuDepositedEnergy_", "Sta_muons", 3);
342  doEnergyTests("hadS9PointingMuDepositedEnergy_", "Sta_muons", 3);
343  doEnergyTests("hoS9PointingMuDepositedEnergy_", "Sta_muons", 3);
344 
345  // fill the multiplicity test summary
346  doMultiplicityTests();
347 
348  // fill the final report summary
349  /*
350  summaryReportMap->setBinContent(1,1,double(kinematicsSummaryMap->getBinContent(1,1)+kinematicsSummaryMap->getBinContent(2,1)+kinematicsSummaryMap->getBinContent(3,1))/3.0);
351  summaryReportMap->setBinContent(2,1,kinematicsSummaryMap->getBinContent(4,1));
352  summaryReportMap->setBinContent(3,1,kinematicsSummaryMap->getBinContent(5,1));
353  summaryReportMap->setBinContent(1,2,double(kinematicsSummaryMap->getBinContent(1,2)+kinematicsSummaryMap->getBinContent(2,2)+kinematicsSummaryMap->getBinContent(3,2))/3.0);
354  summaryReportMap->setBinContent(2,2,kinematicsSummaryMap->getBinContent(4,2));
355  summaryReportMap->setBinContent(3,2,kinematicsSummaryMap->getBinContent(5,2));
356  summaryReportMap->setBinContent(1,3,double(kinematicsSummaryMap->getBinContent(1,3)+kinematicsSummaryMap->getBinContent(2,3)+kinematicsSummaryMap->getBinContent(3,3))/3.0);
357  summaryReportMap->setBinContent(2,3,kinematicsSummaryMap->getBinContent(4,3));
358  summaryReportMap->setBinContent(3,3,kinematicsSummaryMap->getBinContent(5,3));
359  */
360  //Changed to KolmogorovQuality test--------------------------
361  summaryReportMap->setBinContent(1,1,double(KolmogorovTestSummaryMap->getBinContent(1,1)+KolmogorovTestSummaryMap->getBinContent(2,1)+KolmogorovTestSummaryMap->getBinContent(3,1))/3.0);
362  summaryReportMap->setBinContent(2,1,KolmogorovTestSummaryMap->getBinContent(4,1));
363  summaryReportMap->setBinContent(3,1,KolmogorovTestSummaryMap->getBinContent(5,1));
364  summaryReportMap->setBinContent(1,2,double(KolmogorovTestSummaryMap->getBinContent(1,2)+KolmogorovTestSummaryMap->getBinContent(2,2)+KolmogorovTestSummaryMap->getBinContent(3,2))/3.0);
365  summaryReportMap->setBinContent(2,2,KolmogorovTestSummaryMap->getBinContent(4,2));
366  summaryReportMap->setBinContent(3,2,KolmogorovTestSummaryMap->getBinContent(5,2));
367  summaryReportMap->setBinContent(1,3,double(KolmogorovTestSummaryMap->getBinContent(1,3)+KolmogorovTestSummaryMap->getBinContent(2,3)+KolmogorovTestSummaryMap->getBinContent(3,3))/3.0);
368  summaryReportMap->setBinContent(2,3,KolmogorovTestSummaryMap->getBinContent(4,3));
369  summaryReportMap->setBinContent(3,3,KolmogorovTestSummaryMap->getBinContent(5,3));
370 
371 
372 
373  //-- modified GH
374  double residualsSummary = 0;
375  //put the TRK-STA resid & pulls in the first bin ("GLB")
376  //then the GLB-TRK and GLB-STA residuals in the 2nd and 3rd
377  for(int i=3; i<=residualsSummaryMap->getNbinsX(); i++)
378  for (int j=1; j<=residualsSummaryMap->getNbinsY(); j++)
379  residualsSummary += residualsSummaryMap->getBinContent(i,j);
380  residualsSummary /=2*residualsSummaryMap->getNbinsY();
381  summaryReportMap->setBinContent(1,4, residualsSummary);
382 
383  residualsSummary=0;
384  for(int i=1; i<=1; i++)
385  for (int j=1; j<=residualsSummaryMap->getNbinsY(); j++)
386  residualsSummary += residualsSummaryMap->getBinContent(i,j);
387  residualsSummary /=1*residualsSummaryMap->getNbinsY();
388  summaryReportMap->setBinContent(2,4,residualsSummary);
389 
390  residualsSummary=0;
391  for(int i=2; i<=2; i++)
392  for (int j=1; j<=residualsSummaryMap->getNbinsY(); j++)
393  residualsSummary += residualsSummaryMap->getBinContent(i,j);
394  residualsSummary /=1*residualsSummaryMap->getNbinsY();
395  summaryReportMap->setBinContent(3,4,residualsSummary);
396 
397  //--
398 
399 
400 
401  //-- modified GH
402  float idtest=0;
403  for(int i=1; i<=2; i++)
404  for(int j=1; j<=5; j++) {
405  if(j==3 || j==5) continue; //ignore pull widths for now
406  idtest+=muonIdSummaryMap->getBinContent(i,j);
407  }
408  // idtest/=10.;
409  idtest/=6.;
410  summaryReportMap->setBinContent(1,5, idtest);
411  idtest=0;
412  for(int i=3; i<=4; i++)
413  for(int j=1; j<=5; j++) {
414  if(j==3 || j==5) continue; //ignore pull widths for now
415  idtest+=muonIdSummaryMap->getBinContent(i,j);
416  }
417  // idtest/=10.;
418  idtest/=6.;
419  summaryReportMap->setBinContent(2,5,idtest);
420  summaryReportMap->setBinContent(3,5,-1.0/6.0);
421  //--
422 
423 
424 
425  //summaryReportMap->setBinContent(1,6,double(energySummaryMap->getBinContent(1,1)+energySummaryMap->getBinContent(1,2)+energySummaryMap->getBinContent(1,3))/3.0);
426  //summaryReportMap->setBinContent(2,6,double(energySummaryMap->getBinContent(2,1)+energySummaryMap->getBinContent(2,2)+energySummaryMap->getBinContent(2,3))/3.0);
427  //summaryReportMap->setBinContent(3,6,double(energySummaryMap->getBinContent(3,1)+energySummaryMap->getBinContent(3,2)+energySummaryMap->getBinContent(3,3))/3.0);
428  summaryReportMap->setBinContent(1,6,double(energySummaryMap->getBinContent(1,1)+energySummaryMap->getBinContent(1,2))/2.0);
429  summaryReportMap->setBinContent(2,6,double(energySummaryMap->getBinContent(2,1)+energySummaryMap->getBinContent(2,2))/2.0);
430  summaryReportMap->setBinContent(3,6,double(energySummaryMap->getBinContent(3,1)+energySummaryMap->getBinContent(3,2))/2.0);
431  summaryReportMap->setBinContent(1,7,multiplicitySummaryMap->getBinContent(1));
432  summaryReportMap->setBinContent(2,7,multiplicitySummaryMap->getBinContent(2));
433  summaryReportMap->setBinContent(3,7,multiplicitySummaryMap->getBinContent(3));
434 
435 
436  double kinematics_GLB = double(summaryReportMap->getBinContent(1,1)+summaryReportMap->getBinContent(1,2)+summaryReportMap->getBinContent(1,3))/3.0;
437  theSummaryContents[0]->Fill(kinematics_GLB);
438  double muonId_GLB = double(summaryReportMap->getBinContent(1,5));
439  theSummaryContents[1]->Fill(muonId_GLB);
440  double residuals_GLB = double(summaryReportMap->getBinContent(1,4));
441  theSummaryContents[2]->Fill(residuals_GLB);
442  double GLB = (kinematics_GLB+muonId_GLB+residuals_GLB)/3.0;
443  theSummaryContents[3]->Fill(GLB);
444 
445  double kinematics_TK = double(summaryReportMap->getBinContent(2,1)+summaryReportMap->getBinContent(2,2)+summaryReportMap->getBinContent(2,3))/3.0;
446  theSummaryContents[4]->Fill(kinematics_TK);
447  double muonId_TK = double(summaryReportMap->getBinContent(2,5));
448  theSummaryContents[5]->Fill(muonId_TK);
449  double residuals_TK = double(summaryReportMap->getBinContent(2,4));
450  theSummaryContents[6]->Fill(residuals_TK);
451  double TK = double(kinematics_TK+muonId_TK+residuals_TK)/3.0;
452  theSummaryContents[7]->Fill(TK);
453 
454  double kinematics_STA = double(summaryReportMap->getBinContent(3,1)+summaryReportMap->getBinContent(3,2)+summaryReportMap->getBinContent(3,3))/3.0;
455  theSummaryContents[8]->Fill(kinematics_STA);
456  double residuals_STA = double(summaryReportMap->getBinContent(3,4));
457  theSummaryContents[9]->Fill(residuals_STA);
458  double STA = double(kinematics_STA+residuals_STA)/2.0;
459  theSummaryContents[10]->Fill(STA);
460  double energyDeposits = double(summaryReportMap->getBinContent(1,6)+summaryReportMap->getBinContent(2,6)+summaryReportMap->getBinContent(3,6))/3.0;
461  theSummaryContents[11]->Fill(energyDeposits);
462  double multiplicity = double(summaryReportMap->getBinContent(1,7)+summaryReportMap->getBinContent(2,7)+summaryReportMap->getBinContent(3,7))/3.0;
463  theSummaryContents[12]->Fill(multiplicity);
464 
465  summaryReport->Fill((GLB+TK+STA+energyDeposits+multiplicity)/5.0);
466 
467 
468  //global barrel:
469  float muonIDsummary=0;
470  // for(int i=2; i<=5; i++)
471  // muonIDsummary += muonIdSummaryMap->getBinContent(2, i);
472  // summaryCertificationMap->setBinContent(4, 5, muonIDsummary/4.);
473  //for now, just report the mean:
474  muonIDsummary += muonIdSummaryMap->getBinContent(1, 2);
475  muonIDsummary += muonIdSummaryMap->getBinContent(1, 4);
476  summaryCertificationMap->setBinContent(4, 5, muonIDsummary/2.);
477 
478  //global EC:
479  muonIDsummary=0;
480  // for(int i=2; i<=5; i++)
481  // muonIDsummary += muonIdSummaryMap->getBinContent(2, i);
482  // summaryCertificationMap->setBinContent(7, 5, muonIDsummary/4.);
483  muonIDsummary += muonIdSummaryMap->getBinContent(2, 2);
484  muonIDsummary += muonIdSummaryMap->getBinContent(2, 4);
485  summaryCertificationMap->setBinContent(7, 5, muonIDsummary/2.);
486 
487  //tracker barrel:
488  muonIDsummary=0;
489  // for(int i=2; i<=5; i++)
490  // muonIDsummary += muonIdSummaryMap->getBinContent(3, i);
491  // summaryCertificationMap->setBinContent(5, 5, muonIDsummary/4.);
492  muonIDsummary += muonIdSummaryMap->getBinContent(3, 2);
493  muonIDsummary += muonIdSummaryMap->getBinContent(3, 4);
494  summaryCertificationMap->setBinContent(5, 5, muonIDsummary/2.);
495 
496  //tracker EC:
497  muonIDsummary=0;
498  // for(int i=2; i<=5; i++)
499  // muonIDsummary += muonIdSummaryMap->getBinContent(4, i);
500  // summaryCertificationMap->setBinContent(8, 5, muonIDsummary/4.);
501  muonIDsummary += muonIdSummaryMap->getBinContent(4, 2);
502  muonIDsummary += muonIdSummaryMap->getBinContent(4, 4);
503  summaryCertificationMap->setBinContent(8, 5, muonIDsummary/2.);
504 
505 
506  double muonId_GLB_B = double(summaryCertificationMap->getBinContent(4,5));
507  theCertificationContents[3]->Fill(muonId_GLB_B);
508  double muonId_GLB_EC = double(summaryCertificationMap->getBinContent(7,5));
509  theCertificationContents[6]->Fill(muonId_GLB_EC);
510 
511  double muonId_TK_B = double(summaryCertificationMap->getBinContent(5,5));
512  theCertificationContents[5]->Fill(muonId_TK_B);
513  double muonId_TK_EC = double(summaryCertificationMap->getBinContent(8,5));
514  theCertificationContents[8]->Fill(muonId_TK_EC);
515 
516 
517 
518 
519 
520 
521 
522 }
523 
524 
525 void MuonTestSummary::doKinematicsTests(string muonType, int bin){
526 
527 
528  // chi2 test
529  string path = "Muons/MuonRecoAnalyzer/" + muonType + "chi2OverDf";
530  MonitorElement * chi2Histo = dbe->get(path);
531 
532  if(chi2Histo){
533  TH1F * chi2Histo_root = chi2Histo->getTH1F();
534  if(chi2Histo_root->GetEntries()>20){
535 
536  //Standard QT based on fraction of events below and above a cut
537  LogTrace(metname)<<"chi2 kin test based on fraction for "<<muonType<<endl;
538  int maxBin = chi2Histo_root->GetMaximumBin();
539  if(chi2Histo_root->Integral(maxBin+1,chi2Histo_root->GetNbinsX())!=0){
540  double fraction = double(chi2Histo_root->Integral(1,maxBin))/double(chi2Histo_root->Integral(maxBin+1,chi2Histo_root->GetNbinsX()));
541  LogTrace(metname)<<"chi2 fraction for "<<muonType<<" : "<<fraction<< " must be within "<< chi2Fraction-chi2Spread<<","<<chi2Fraction+chi2Spread<<endl;
542  if(fraction>(chi2Fraction-chi2Spread) && fraction<(chi2Fraction+chi2Spread))
543  kinematicsSummaryMap->setBinContent(bin,1,1);
544  else
545  kinematicsSummaryMap->setBinContent(bin,1,0);
546  }
547 
548  //QT based on comp wrt reference based on chi2
549  LogTrace(metname)<<"chi2 kin test based on comp wrt reference on terms of chi2 for "<<muonType<<endl;
550  const QReport * myQReport = chi2Histo->getQReport("Mu_Comp2RefChi2"); //get QReport associated to your ME
551  if(myQReport) {
552  LogTrace(metname) << "Chi2Report exists!!";
553  float qtresult = myQReport->getQTresult(); // get QT result value
554  int qtstatus = myQReport->getStatus() ; // get QT status value (see table below)
555  std::string qtmessage = myQReport->getMessage() ; // get the whole QT result message
556  LogTrace(metname) << "qtresult " <<qtresult << " qtstatus "<<qtstatus<<endl;
557  chi2TestSummaryMap->setBinContent(bin,1,qtresult);
558  }
559  //QT based on comp wrt reference based on kolmogorov test
560  LogTrace(metname)<<"chi2 kin test based on comp wrt reference using kolmogorov for "<<muonType<<endl;
561  const QReport * myQReportKolmo = chi2Histo->getQReport("Mu_Comp2RefKolmogorov");
562  if(myQReportKolmo) {
563  LogTrace(metname) << "Chi2Report Kolmogorov exists!!";
564  float qtresult = myQReportKolmo->getQTresult(); // get QT result value
565  int qtstatus = myQReportKolmo->getStatus() ; // get QT status value (see table below)
566  std::string qtmessage = myQReportKolmo->getMessage() ; // get the whole QT result message
567  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
568  KolmogorovTestSummaryMap->setBinContent(bin,1,qtresult);
569  }
570 
571  }
572  else{
573  LogTrace(metname) << "[MuonTestSummary]: Test of Chi2 Kin not performed for "<< muonType << " because # entries < 20 ";
574  }
575  }
576 
577 
578 
579  // pseudorapidity test
580  path = "Muons/MuonRecoAnalyzer/" + muonType + "eta";
581  MonitorElement * etaHisto = dbe->get(path);
582 
583  if(etaHisto){
584  TH1F * etaHisto_root = etaHisto->getTH1F();
585  if (etaHisto_root ->GetEntries()>20){
586 
587  //Standard QT based on fraction of events below and above a cut
588  LogTrace(metname)<<"eta kin test based on fraction for "<<muonType<<endl;
589  double binSize = (etaHisto_root->GetXaxis()->GetXmax()-etaHisto_root->GetXaxis()->GetXmin())/etaHisto_root->GetNbinsX();
590  int binZero = int((0-etaHisto_root->GetXaxis()->GetXmin())/binSize);
591  if(etaHisto_root->Integral(1,binZero-1)!=0 && etaHisto_root->Integral(binZero,etaHisto_root->GetNbinsX())!=0){
592  double symmetryFactor =
593  double(etaHisto_root->Integral(1,binZero-1)) / double(etaHisto_root->Integral(binZero,etaHisto_root->GetNbinsX()));
594  double errSymmetryFactor =
595  symmetryFactor*sqrt(1.0/double(etaHisto_root->Integral(1,binZero-1)) + 1.0/double(etaHisto_root->Integral(binZero,etaHisto_root->GetNbinsX())));
596  LogTrace(metname)<<"eta symmetryFactor for "<<muonType<<" : "<<symmetryFactor<< " (expected :" <<etaExpected <<")"<<endl;
597  LogTrace(metname)<<"eta errSymmetryFactor for "<<muonType<<" : "<<errSymmetryFactor<<endl;
598  double tParameter;
599  if((symmetryFactor-etaExpected)>0) tParameter=double(symmetryFactor-etaExpected)/errSymmetryFactor;
600  else tParameter=double(-symmetryFactor+etaExpected)/errSymmetryFactor;
601  LogTrace(metname)<<"eta tParameter for "<<muonType<<" : "<<tParameter<<" (expected < 1.95)" <<endl;
602  if (tParameter<1.95) //2sigma rejection
603  kinematicsSummaryMap->setBinContent(bin,2,1);
604  else
605  kinematicsSummaryMap->setBinContent(bin,2,0);
606  }
607 
608  //QT based on comp wrt reference based on chi2
609  LogTrace(metname)<<"eta kin test based on comp wrt reference on terms of chi2 for "<<muonType<<endl;
610  const QReport * myQReport = etaHisto->getQReport("Mu_Comp2RefChi2"); //get QReport associated to your ME
611  if(myQReport) {
612  LogTrace(metname) << "EtaReport exists!!";
613  float qtresult = myQReport->getQTresult(); // get QT result value
614  int qtstatus = myQReport->getStatus() ; // get QT status value (see table below)
615  std::string qtmessage = myQReport->getMessage() ; // get the whole QT result message
616  LogTrace(metname) << "qtresult " <<qtresult << " qtstatus "<<qtstatus<<endl;
617  chi2TestSummaryMap->setBinContent(bin,2,qtresult);
618  }
619 
620  //QT based on comp wrt reference based on kolmogorov test
621  LogTrace(metname)<<"eta kin test based on comp wrt reference using kolmogorov for "<<muonType<<endl;
622  const QReport * myQReportKolmo = etaHisto->getQReport("Mu_Comp2RefKolmogorov");
623  if(myQReportKolmo) {
624  LogTrace(metname) << "EtaReport Kolmogorov exists!!";
625  float qtresult = myQReportKolmo->getQTresult(); // get QT result value
626  int qtstatus = myQReportKolmo->getStatus() ; // get QT status value (see table below)
627  std::string qtmessage = myQReportKolmo->getMessage() ; // get the whole QT result message
628  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
629  KolmogorovTestSummaryMap->setBinContent(bin,2,qtresult);
630  }
631 
632  }
633  else{
634  LogTrace(metname) << "[MuonTestSummary]: Test of Eta Kin not performed for "<< muonType << " because # entries < 20 ";
635  }
636  }
637 
638 
639 
640  // phi test
641  path = "Muons/MuonRecoAnalyzer/" + muonType + "phi";
642  MonitorElement * phiHisto = dbe->get(path);
643 
644  if(phiHisto ){
645  TH1F * phiHisto_root = phiHisto->getTH1F();
646  if(phiHisto_root ->GetEntries()>20){
647 
648  //Standard QT based on fraction of events below and above a cut
649  LogTrace(metname)<<"phi kin test based on fraction for "<<muonType<<endl;
650  double binSize = (phiHisto_root->GetXaxis()->GetXmax()-phiHisto_root->GetXaxis()->GetXmin())/phiHisto_root->GetNbinsX();
651  int binZero = int((0-phiHisto_root->GetXaxis()->GetXmin())/binSize);
652  if(phiHisto_root->Integral(binZero+1,phiHisto_root->GetNbinsX())!=0 && phiHisto_root->Integral(1,binZero)!=0){
653  double symmetryFactor =
654  double(phiHisto_root->Integral(binZero+1,phiHisto_root->GetNbinsX())) / double(phiHisto_root->Integral(1,binZero));
655  double errSymmetryFactor =
656  symmetryFactor*sqrt(1.0/double(phiHisto_root->Integral(binZero+1,phiHisto_root->GetNbinsX())) + 1.0/double(phiHisto_root->Integral(1,binZero)));
657  LogTrace(metname)<<"phi symmetryFactor for "<<muonType<<" : "<<symmetryFactor<< "(phi expected :" <<phiExpected <<")"<<endl;
658  LogTrace(metname)<<"phi errSymmetryFactor for "<<muonType<<" : "<<errSymmetryFactor<<endl;
659  double tParameter;
660  if((symmetryFactor-phiExpected)>0) tParameter=double(symmetryFactor-phiExpected)/errSymmetryFactor;
661  else tParameter=double(-symmetryFactor+phiExpected)/errSymmetryFactor;
662  LogTrace(metname)<<"phi tParameter for "<<muonType<<" : "<<tParameter<<" (expected < 1.95)" <<endl;
663  if (tParameter<1.95) //2sigma rejection
664  kinematicsSummaryMap->setBinContent(bin,3,1);
665  else
666  kinematicsSummaryMap->setBinContent(bin,3,0);
667  }
668 
669  //QT based on comp wrt reference based on chi2
670  LogTrace(metname)<<"phi kin test based on comp wrt reference on terms of chi2 for "<<muonType<<endl;
671  const QReport * myQReport = phiHisto->getQReport("Mu_Comp2RefChi2"); //get QReport associated to your ME
672  if(myQReport) {
673  LogTrace(metname) << "PhiReport exists!!";
674  float qtresult = myQReport->getQTresult(); // get QT result value
675  int qtstatus = myQReport->getStatus() ; // get QT status value (see table below)
676  std::string qtmessage = myQReport->getMessage() ; // get the whole QT result message
677  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
678  chi2TestSummaryMap->setBinContent(bin,3,qtresult);
679  }
680 
681  //QT based on comp wrt reference based on kolmogorov test
682  LogTrace(metname)<<"phi kin test based on comp wrt reference using kolmogorov for "<<muonType<<endl;
683  const QReport * myQReportKolmo = phiHisto->getQReport("Mu_Comp2RefKolmogorov");
684  if(myQReportKolmo) {
685  LogTrace(metname) << "PhiReport Kolmogorov exists!!";
686  float qtresult = myQReportKolmo->getQTresult(); // get QT result value
687  int qtstatus = myQReportKolmo->getStatus() ; // get QT status value (see table below)
688  std::string qtmessage = myQReportKolmo->getMessage() ; // get the whole QT result message
689  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
690  KolmogorovTestSummaryMap->setBinContent(bin,3,qtresult);
691  }
692 
693  }
694  else{
695  LogTrace(metname) << "[MuonTestSummary]: Test of Phi Kin not performed for "<< muonType << " because # entries < 20 ";
696  }
697  }
698 
699  // pt test
700  path = "Muons/MuonRecoAnalyzer/" + muonType + "pt";
701  MonitorElement * ptHisto = dbe->get(path);
702 
703  if(ptHisto ){
704  TH1F * ptHisto_root = ptHisto->getTH1F();
705  if(ptHisto_root ->GetEntries()>20){
706 
707  //QT based on comp wrt reference based on chi2
708  LogTrace(metname)<<"pt kin test based on comp wrt reference on terms of chi2 for "<<muonType<<endl;
709  const QReport * myQReport = ptHisto->getQReport("Mu_Comp2RefChi2"); //get QReport associated to your ME
710  if(myQReport) {
711  LogTrace(metname) << "PtReport exists!!";
712  float qtresult = myQReport->getQTresult(); // get QT result value
713  int qtstatus = myQReport->getStatus() ; // get QT status value (see table below)
714  std::string qtmessage = myQReport->getMessage() ; // get the whole QT result message
715  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
716  chi2TestSummaryMap->setBinContent(bin,4,qtresult);
717  }
718 
719  //QT based on comp wrt reference based on kolmogorov test
720  LogTrace(metname)<<"pt kin test based on comp wrt reference using kolmogorov for "<<muonType<<endl;
721  const QReport * myQReportKolmo = ptHisto->getQReport("Mu_Comp2RefKolmogorov");
722  if(myQReportKolmo) {
723  LogTrace(metname) << "PtReport Kolmogorov exists!!";
724  float qtresult = myQReportKolmo->getQTresult(); // get QT result value
725  int qtstatus = myQReportKolmo->getStatus() ; // get QT status value (see table below)
726  std::string qtmessage = myQReportKolmo->getMessage() ; // get the whole QT result message
727  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
728  KolmogorovTestSummaryMap->setBinContent(bin,4,qtresult);
729  }
730  }
731  else{
732  LogTrace(metname) << "[MuonTestSummary]: Test of Pt Kin not performed for "<< muonType << " because # entries < 20 ";
733  }
734  }
735 
736  // q test
737  path = "Muons/MuonRecoAnalyzer/" + muonType + "q";
738  MonitorElement * qHisto = dbe->get(path);
739 
740  if(ptHisto ){
741  TH1F * qHisto_root = qHisto->getTH1F();
742  if(qHisto_root ->GetEntries()>20){
743 
744  //QT based on comp wrt reference based on chi2
745  LogTrace(metname)<<"q kin test based on comp wrt reference on terms of chi2 for "<<muonType<<endl;
746  const QReport * myQReport = qHisto->getQReport("Mu_Comp2RefChi2"); //get QReport associated to your ME
747  if(myQReport) {
748  LogTrace(metname) << "qReport exists!!";
749  float qtresult = myQReport->getQTresult(); // get QT result value
750  int qtstatus = myQReport->getStatus() ; // get QT status value (see table below)
751  std::string qtmessage = myQReport->getMessage() ; // get the whole QT result message
752  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
753  chi2TestSummaryMap->setBinContent(bin,5,qtresult);
754  }
755 
756  //QT based on comp wrt reference based on kolmogorov test
757  LogTrace(metname)<<"q kin test based on comp wrt reference using kolmogorov for "<<muonType<<endl;
758  const QReport * myQReportKolmo = qHisto->getQReport("Mu_Comp2RefKolmogorov");
759  if(myQReportKolmo) {
760  LogTrace(metname) << "qReport Kolmogorov exists!!";
761  float qtresult = myQReportKolmo->getQTresult(); // get QT result value
762  int qtstatus = myQReportKolmo->getStatus() ; // get QT status value (see table below)
763  std::string qtmessage = myQReportKolmo->getMessage() ; // get the whole QT result message
764  LogTrace(metname) << "qtresult " <<qtresult<< " qtstatus "<<qtstatus<<endl;
765  KolmogorovTestSummaryMap->setBinContent(bin,5,qtresult);
766  }
767  }
768  else{
769  LogTrace(metname) << "[MuonTestSummary]: Test of q Kin not performed for "<< muonType << " because # entries < 20 ";
770  }
771  }
772 
773 }
774 
775 
776 
777 
778 
779 
780 
781  //--GH new
782 void MuonTestSummary::GaussFit(string type, string parameter, MonitorElement * Histo, float &mean, float &mean_err, float &sigma, float &sigma_err) {
783 
784  // Gaussian Fit
785  float statMean = Histo->getMean(1);
786  float statSigma = Histo->getRMS(1);
787  TH1F * histo_root = Histo->getTH1F();
788  if(histo_root->GetEntries()>20){
789  TF1 *gfit = new TF1("Gaussian","gaus",(statMean-(2*statSigma)),(statMean+(2*statSigma)));
790  try {
791  histo_root->Fit(gfit, "Q0");
792  } catch (cms::Exception& iException) {
793  edm::LogError (metname)<< "[MuonTestSummary]: Exception when fitting Res_"<<type<<"_"<<parameter;
794  mean=1;
795  mean_err=1;
796  sigma=1;
797  sigma_err=1;
798  return;
799  }
800  if(gfit){
801  mean = gfit->GetParameter(1);
802  mean_err = gfit->GetParErrors()[2];
803  sigma = gfit->GetParameter(2);
804  sigma_err = gfit->GetParErrors()[2];
805  LogTrace(metname)<<"Gaussian fit mean: "<<mean<<" +- "<<mean_err<<" for "<<type<<"_"<<parameter<<endl;
806  LogTrace(metname)<<"Gaussina fit sigma: "<<sigma<<" +- "<<sigma_err<<" for "<<type<<"_"<<parameter<<endl;
807  }
808  }
809  else{
810  LogTrace(metname) << "[MuonTestSummary]: Test of Res_"<<type<<"_"<<parameter<< " not performed because # entries < 20 ";
811  //auto-pass if not enough events.
812  mean=1;
813  mean_err=1;
814  sigma=1;
815  sigma_err=1;
816  }
817 }
818 
819 
820 
821 
822 
823 
825 
826  // residuals test
827  if(type!="GlbMuon"){
828  string path = "Muons/MuonRecoAnalyzer/Res_" + type + "_" + parameter;
829  MonitorElement * residualsHisto = dbe->get(path);
830 
831  float mean = -1;
832  float mean_err = -1;
833  float sigma = -1;
834  float sigma_err = -1;
835 
836  if(residualsHisto){
837 
838  LogTrace(metname) << "[MuonTestSummary]: Starting Gaussian fit for Test of Res_"<<type<<"_"<<parameter<< endl;
839  GaussFit( type, parameter, residualsHisto, mean, mean_err, sigma, sigma_err);
840 
841  if(sigma!=-1 && parameter=="eta" && type=="TkGlb"){
842  if(sigma-sigma_err<resEtaSpread_tkGlb) residualsSummaryMap->setBinContent(bin, 1, 1);
843  else residualsSummaryMap->setBinContent(bin, 1, 0);
844  }
845  if(sigma!=-1 && parameter=="eta" && (type=="GlbSta" || type=="TkSta")) {
846  if(sigma-sigma_err<resEtaSpread_glbSta) residualsSummaryMap->setBinContent(bin, 1, 1);
847  else residualsSummaryMap->setBinContent(bin, 1, 0);
848  }
849  if(sigma!=-1 && parameter=="phi" && type=="TkGlb"){
850  if(sigma-sigma_err<resPhiSpread_tkGlb) residualsSummaryMap->setBinContent(bin, 2, 1);
851  else residualsSummaryMap->setBinContent(bin, 2, 0);
852  }
853  if(sigma!=-1 && parameter=="phi" && (type=="GlbSta" || type=="TkSta")){
854  if(sigma-sigma_err<resPhiSpread_glbSta) residualsSummaryMap->setBinContent(bin, 2, 1);
855  else residualsSummaryMap->setBinContent(bin, 2, 0);
856  }
857  if(sigma!=-1 && parameter=="oneOverp" && type=="TkGlb"){
858  if(sigma-sigma_err<resOneOvPSpread_tkGlb) residualsSummaryMap->setBinContent(bin, 3, 1);
859  else residualsSummaryMap->setBinContent(bin, 3, 0);
860  }
861  if(sigma!=-1 && parameter=="oneOverp" && (type=="GlbSta" || type=="TkSta")) {
862  if(sigma-sigma_err<resOneOvPSpread_glbSta) residualsSummaryMap->setBinContent(bin, 3, 1);
863  else residualsSummaryMap->setBinContent(bin, 3, 0);
864  }
865  }
866 
867 
868 
869  //--GH modified
870  if(type=="TkSta"){
871  //look at the pull:
872  string path = "Muons/MuonRecoAnalyzer/Pull_" + type + "_" + parameter;
873  MonitorElement * pullHisto = dbe->get(path);
874 
875  if(pullHisto){
876 
877  LogTrace(metname) << "[MuonTestSummary]: Starting Gaussian fit for Test of Pull_"<<type<<"_"<<parameter<< endl;
878  GaussFit( type, parameter, pullHisto, mean, mean_err, sigma, sigma_err);
879 
880  if(sigma!=-1 && parameter=="eta" ){
881  if(sigma-sigma_err<pullEtaSpread) residualsSummaryMap->setBinContent(4, 1, 1);
882  else residualsSummaryMap->setBinContent(4, 1, 0);
883  }
884  if(sigma!=-1 && parameter=="phi"){
885  if(sigma-sigma_err<pullPhiSpread) residualsSummaryMap->setBinContent(4, 2, 1);
886  else residualsSummaryMap->setBinContent(4, 2, 0);
887  }
888  if(sigma!=-1 && parameter=="oneOverp"){
889  if(sigma-sigma_err<pullOneOvPSpread) residualsSummaryMap->setBinContent(4, 3, 1);
890  else residualsSummaryMap->setBinContent(4, 3, 0);
891  }
892 
893  }//have pull histo
894  } //TkSta muons
895  }
896 
897  //this part for Global Muons:
898  else{
899  string path = "Muons/MuonRecoAnalyzer/" + type + "_" + parameter;
900  MonitorElement * residualsHisto = dbe->get(path);
901 
902  if(residualsHisto){
903  LogTrace(metname) << "[MuonTestSummary]: Test of Charge Comparison "<<type<<"_"<<parameter<< endl;
904  if((residualsHisto->getBinContent(3)+residualsHisto->getBinContent(4))!=0){
905  LogTrace(metname)<<"Charge comparison TkGlb: "<<residualsHisto->getBinContent(4)/double(residualsHisto->getBinContent(3)+residualsHisto->getBinContent(4))<<endl;
906  if(residualsHisto->getBinContent(4)/double(residualsHisto->getBinContent(3)+residualsHisto->getBinContent(4)) < resChargeLimit_tkGlb)
907  residualsSummaryMap->setBinContent(1, 4, 1);
908  else
909  residualsSummaryMap->setBinContent(1, 4, 0);
910  }
911  if((residualsHisto->getBinContent(1)+residualsHisto->getBinContent(2))!=0){
912  LogTrace(metname)<<"charge comparison GlbSta: "<<residualsHisto->getBinContent(2)/double(residualsHisto->getBinContent(1)+residualsHisto->getBinContent(2))<<endl;
913  if(residualsHisto->getBinContent(2)/double(residualsHisto->getBinContent(1)+residualsHisto->getBinContent(2)) < resChargeLimit_glbSta)
914  residualsSummaryMap->setBinContent(2, 4, 1);
915  else
916  residualsSummaryMap->setBinContent(2, 4, 0);
917  }
918  if(residualsHisto->getBinContent(5)+residualsHisto->getBinContent(6)!=0){
919  LogTrace(metname)<<"charge comparison TkSta: "<<residualsHisto->getBinContent(6)/double(residualsHisto->getBinContent(5)+residualsHisto->getBinContent(6))<<endl;
920  if(residualsHisto->getBinContent(6)/double(residualsHisto->getBinContent(5)+residualsHisto->getBinContent(6)) < resChargeLimit_tkSta)
921  residualsSummaryMap->setBinContent(3, 4, 1);
922  else
923  residualsSummaryMap->setBinContent(3, 4, 0);
924  }
925  }
926  }
927 
928 }
929 
931 
932  vector<string> muType;
933  muType.push_back("GlobalMuons");
934  muType.push_back("TrackerMuons");
935 
936  for(int i=0; i<=1; i++){
937 
938  // num matches test
939  string path = "Muons/MuonIdDQM/" + muType[i] + "/hNumMatches";
940  MonitorElement * matchesHisto = dbe->get(path);
941 
942  if(matchesHisto){
943  TH1F * matchesHisto_root = matchesHisto->getTH1F();
944  if(matchesHisto_root->GetMaximumBin() >= numMatchedExpected_min && matchesHisto_root->GetMaximumBin() <= numMatchedExpected_max)
945  muonIdSummaryMap->setBinContent(i+1,1,1);
946  else
947  muonIdSummaryMap->setBinContent(i+1,1,0);
948  }
949 
950 
951  // num of 0 associated segments
952  double numOneSegm_dt = 0;
953  int numHistos_dt=0;
954  int numHistos_csc=0;
955  MonitorElement * DT1Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hDT1NumSegments");
956  if(DT1Histo)
957  {numHistos_dt++;
958  if(DT1Histo->getEntries()!=0) numOneSegm_dt+=double(DT1Histo->getBinContent(2))/double(DT1Histo->getEntries());}
959  MonitorElement * DT2Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hDT2NumSegments");
960  if(DT2Histo)
961  {numHistos_dt++;
962  if(DT2Histo->getEntries()!=0) numOneSegm_dt+=double(DT2Histo->getBinContent(2))/double(DT2Histo->getEntries());}
963  MonitorElement * DT3Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hDT3NumSegments");
964  if(DT3Histo)
965  {numHistos_dt++;
966  if(DT3Histo->getEntries()!=0) numOneSegm_dt+=double(DT3Histo->getBinContent(2))/double(DT3Histo->getEntries());}
967  MonitorElement * DT4Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hDT4NumSegments");
968  if(DT4Histo)
969  {numHistos_dt++;
970  if(DT4Histo->getEntries()!=0) numOneSegm_dt+=double(DT4Histo->getBinContent(2))/double(DT4Histo->getEntries());}
971  double fraction_dt=0;
972  if(numOneSegm_dt!=0){
973  fraction_dt = numOneSegm_dt/double(numHistos_dt);
974  LogTrace(metname)<<"fraction_dt: "<<fraction_dt<<" for "<<muType[i]<<endl;
975  }
976 
977  double numOneSegm_csc = 0;
978  MonitorElement * CSC1Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hCSC1NumSegments");
979  if(CSC1Histo)
980  {numHistos_csc++;
981  if(CSC1Histo->getEntries()!=0) numOneSegm_csc+=double(CSC1Histo->getBinContent(2))/double(CSC1Histo->getEntries());}
982  MonitorElement * CSC2Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hCSC2NumSegments");
983  if(CSC2Histo)
984  {numHistos_csc++;
985  if(CSC2Histo->getEntries()!=0) numOneSegm_csc+=double(CSC2Histo->getBinContent(2))/double(CSC2Histo->getEntries());}
986  MonitorElement * CSC3Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hCSC3NumSegments");
987  if(CSC3Histo)
988  {numHistos_csc++;
989  if(CSC3Histo->getEntries()!=0) numOneSegm_csc+=double(CSC3Histo->getBinContent(2))/double(CSC3Histo->getEntries());}
990  MonitorElement * CSC4Histo = dbe->get("Muons/MuonIdDQM/" + muType[i] + "/hCSC4NumSegments");
991  if(CSC4Histo)
992  {numHistos_csc++;
993  if(CSC4Histo->getEntries()!=0) numOneSegm_csc+=double(CSC4Histo->getBinContent(2))/double(CSC4Histo->getEntries());}
994  double fraction_csc=0;
995  if(numOneSegm_csc!=0){
996  fraction_csc = numOneSegm_csc/double(numHistos_csc);
997  LogTrace(metname)<<"fraction_csc: "<<fraction_csc<<" for "<<muType[i]<<endl;
998  }
999 
1000 
1001 
1002  //--GH modified
1003 
1004  if(fraction_dt>matchesFractionDt_min && fraction_dt<matchesFractionDt_max)
1005  muonIdSummaryMap->setBinContent(2*i+1,1,1);
1006  else
1007  muonIdSummaryMap->setBinContent(2*i+1,1,0);
1008 
1009  if(fraction_csc>matchesFractionCsc_min && fraction_csc<matchesFractionCsc_max)
1010  muonIdSummaryMap->setBinContent(2*i+2,1,1);
1011  else
1012  muonIdSummaryMap->setBinContent(2*i+2,1,0);
1013 
1014 
1015 
1016  //--GH modified
1017 
1018  // residuals test
1019  vector<string> DTXresHistos, DTYresHistos, CSCXresHistos, CSCYresHistos;
1020  DTXresHistos.push_back("hDT1Pullx");
1021  DTXresHistos.push_back("hDT2Pullx");
1022  DTXresHistos.push_back("hDT3Pullx");
1023  DTXresHistos.push_back("hDT4Pullx");
1024 
1025  DTYresHistos.push_back("hDT1Pully");
1026  DTYresHistos.push_back("hDT2Pully");
1027  DTYresHistos.push_back("hDT3Pully");
1028 
1029  CSCXresHistos.push_back("hCSC1Pullx");
1030  CSCXresHistos.push_back("hCSC2Pullx");
1031  CSCXresHistos.push_back("hCSC3Pullx");
1032  CSCXresHistos.push_back("hCSC4Pullx");
1033 
1034  CSCYresHistos.push_back("hCSC1Pully");
1035  CSCYresHistos.push_back("hCSC2Pully");
1036  CSCYresHistos.push_back("hCSC3Pully");
1037  CSCYresHistos.push_back("hCSC4Pully");
1038 
1039  int numPlot_dtX, numPlot_dtY, numPlot_cscX, numPlot_cscY;
1040  double dtSigmaX, dtSigmaY, cscSigmaX, cscSigmaY;
1041  double dtSigmaX_err, dtSigmaY_err, cscSigmaX_err, cscSigmaY_err;
1042  double dtMeanX, dtMeanY, cscMeanX, cscMeanY;
1043  double dtMeanX_err, dtMeanY_err, cscMeanX_err, cscMeanY_err;
1044  MuonTestSummary::ResidualCheck(muType[i], DTXresHistos, numPlot_dtX, dtMeanX, dtMeanX_err, dtSigmaX, dtSigmaX_err);
1045  MuonTestSummary::ResidualCheck(muType[i], DTYresHistos, numPlot_dtY, dtMeanY, dtMeanY_err, dtSigmaY, dtSigmaY_err);
1046  MuonTestSummary::ResidualCheck(muType[i], CSCXresHistos, numPlot_cscX, cscMeanX, cscMeanX_err, cscSigmaX, cscSigmaX_err);
1047  MuonTestSummary::ResidualCheck(muType[i], CSCYresHistos, numPlot_cscY, cscMeanY, cscMeanY_err, cscSigmaY, cscSigmaY_err);
1048 
1049 
1050  LogTrace(metname)<<"DT mean must be between: "<<resSegmTrack_mean_min <<" and "<<resSegmTrack_mean_max<<endl;
1051  LogTrace(metname)<<"DT rms must be between: "<<resSegmTrack_rms_min <<" and "<<resSegmTrack_rms_max<<endl;
1052  LogTrace(metname)<<"DT X residual "<< muType[i]<<" mean: " << dtMeanX<<" +- "<< dtMeanX_err
1053  <<", sigma: "<< dtSigmaX <<" +- "<<dtSigmaX_err<< endl;
1054  LogTrace(metname)<<"DT Y residual "<< muType[i]<<" mean: " << dtMeanY<<" +- "<< dtMeanY_err
1055  <<", sigma: "<< dtSigmaY <<" +- "<<dtSigmaY_err<< endl;
1056  LogTrace(metname)<<"CSC X residual "<< muType[i]<<" mean: " << cscMeanX<<" +- "<< cscMeanX_err
1057  <<", sigma: "<< cscSigmaX <<" +- "<<cscSigmaX_err<< endl;
1058  LogTrace(metname)<<"CSC Y residual "<< muType[i]<<" mean: " << cscMeanY<<" +- "<< cscMeanY_err
1059  <<", sigma: "<< cscSigmaY <<" +- "<<cscSigmaY_err<< endl;
1060 
1061 
1062  //require the mean and rms to be within nsig sigma of preferred range;
1063  const int nsig=2;
1064  if(numPlot_dtX > 0 ) {
1065  if( dtMeanX + nsig*dtMeanX_err>resSegmTrack_mean_min &&
1066  dtMeanX - nsig*dtMeanX_err<resSegmTrack_mean_max)
1067  muonIdSummaryMap->setBinContent(2*i+1,2,1);
1068  else
1069  muonIdSummaryMap->setBinContent(2*i+1,2,0);
1070 
1071  if( dtSigmaX + nsig*dtSigmaX_err>resSegmTrack_rms_min &&
1072  dtSigmaX - nsig*dtSigmaX_err<resSegmTrack_rms_max)
1073  muonIdSummaryMap->setBinContent(2*i+1,3,1);
1074  else
1075  muonIdSummaryMap->setBinContent(2*i+1,3,0);
1076  }
1077  if(numPlot_dtY > 0 ){
1078  if( dtMeanY + nsig*dtMeanY_err>resSegmTrack_mean_min &&
1079  dtMeanY - nsig*dtMeanY_err<resSegmTrack_mean_max)
1080  muonIdSummaryMap->setBinContent(2*i+1,4,1);
1081  else
1082  muonIdSummaryMap->setBinContent(2*i+1,4,0);
1083 
1084  if( dtSigmaY + nsig*dtSigmaY_err>resSegmTrack_rms_min &&
1085  dtSigmaY - nsig*dtSigmaX_err<resSegmTrack_rms_max)
1086  muonIdSummaryMap->setBinContent(2*i+1,5,1);
1087  else
1088  muonIdSummaryMap->setBinContent(2*i+1,5,0);
1089  }
1090 
1091 
1092  if(numPlot_cscX > 0 ) {
1093  if( cscMeanX + nsig*cscMeanX_err>resSegmTrack_mean_min &&
1094  cscMeanX - nsig*cscMeanX_err<resSegmTrack_mean_max)
1095  muonIdSummaryMap->setBinContent(2*i+2,2,1);
1096  else
1097  muonIdSummaryMap->setBinContent(2*i+2,2,0);
1098 
1099  if( cscSigmaX + nsig*cscSigmaX_err>resSegmTrack_rms_min &&
1100  cscSigmaX - nsig*cscSigmaX_err<resSegmTrack_rms_max)
1101  muonIdSummaryMap->setBinContent(2*i+2,3,1);
1102  else
1103  muonIdSummaryMap->setBinContent(2*i+2,3,0);
1104  }
1105  if(numPlot_cscY > 0 ){
1106  if( cscMeanY + nsig*cscMeanY_err>resSegmTrack_mean_min &&
1107  cscMeanY - nsig*cscMeanY_err<resSegmTrack_mean_max)
1108  muonIdSummaryMap->setBinContent(2*i+2,4,1);
1109  else
1110  muonIdSummaryMap->setBinContent(2*i+2,4,0);
1111 
1112  if( cscSigmaY + nsig*cscSigmaY_err>resSegmTrack_rms_min &&
1113  cscSigmaY - nsig*cscSigmaY_err<resSegmTrack_rms_max)
1114  muonIdSummaryMap->setBinContent(2*i+2,5,1);
1115  else
1116  muonIdSummaryMap->setBinContent(2*i+2,5,0);
1117  }
1118 
1119  //---- end of modification
1120 
1121 
1122  }
1123 
1124 }
1125 
1126 void MuonTestSummary::ResidualCheck(std::string muType, const std::vector<std::string>& resHistos, int &numPlot, double &Mean, double &Mean_err, double &Sigma, double &Sigma_err){
1127 
1128  numPlot=0;
1129  Mean=0;
1130  Mean_err=0;
1131  Sigma=0;
1132  Sigma_err=0;
1133  for(uint name=0; name<resHistos.size(); name++){
1134  MonitorElement * resHisto = dbe->get("Muons/MuonIdDQM/" + muType + "/"+resHistos[name]);
1135 
1136  if(resHisto){
1137  TH1F * resHisto_root = resHisto->getTH1F();
1138  if(resHisto_root->GetEntries() < 20) {
1139  LogTrace(metname) << "[MuonTestSummary]: Test of "<< muType<<" for " <<resHistos[name]<< " not performed because # entries < 20 ";
1140  continue;
1141  }
1142 
1143  //we also want to check if the peak is away from zero.
1144  //so, try fitting in 3 sigma around the histogram mean.
1145  //alternatively, could use the maximum bin (less sensitive to 1-sided tails).
1146  // float mean = resHisto_root->GetMean();
1147  float mean = resHisto_root->GetBinLowEdge(resHisto_root->GetMaximumBin());
1148  TF1 *gfit = new TF1("Gaussian","gaus",mean-3,mean+3);
1149 
1150 
1151  try {
1152  resHisto_root->Fit(gfit, "Q0");
1153  } catch (cms::Exception& iException) {
1154  edm::LogError (metname)<< "[MuonTestSummary]: Exception when fitting "<<resHistos[name];
1155  continue;
1156  }
1157  if(gfit){
1158  double mean = gfit->GetParameter(1);
1159  double mean_err = gfit->GetParError(1);
1160  double sigma = gfit->GetParameter(2);
1161  double sigma_err = gfit->GetParError(2);
1162  LogTrace(metname)<<"meanRes: "<<mean<<" +- "<<mean_err<<" for "<<resHistos[name]<<endl;
1163  LogTrace(metname)<<"sigmaRes: "<<sigma<<" +- "<<sigma_err<<" for "<<resHistos[name]<<endl;
1164 
1165  Mean+=mean;
1166  Mean_err +=mean_err * mean_err;
1167  Sigma+=sigma;
1168  Sigma_err +=sigma_err * sigma_err;
1169  numPlot++;
1170  } //if gfit? why would we not have gfit?
1171 
1172  }//histogram exists...
1173  } // loop over residuals histos
1174 
1175 
1176  if(numPlot==0){ //eg no stats
1177  Mean_err = 1;
1178  Mean=1;
1179  Sigma_err =1;
1180  Sigma = 1;
1181  }
1182  else{
1183  Mean_err = sqrt(Mean_err);
1184  Mean_err/=numPlot;
1185  Mean/=numPlot;
1186 
1187  Sigma_err = sqrt(Sigma_err);
1188  Sigma_err/=numPlot;
1189  Sigma/=numPlot;
1190  }
1191  return;
1192 
1193 }
1194 
1195 
1196 
1197 
1198 
1199 void MuonTestSummary::doEnergyTests(string histname, string muonType, int binNumber){
1200 
1201  // num matches test
1202  string path = "Muons/MuonEnergyDepositAnalyzer/"+histname+muonType;
1203  MonitorElement * energyHisto = dbe->get(path);
1204  Double_t hPeak=-1, hFWHM=-1;
1205  if(energyHisto){
1206  TH1F * energyHisto_root = energyHisto->getTH1F();
1207 
1208  // Setting fit range and start values
1209  Double_t fitRange[2];
1210  Double_t startValues[4], parlimitslo[4], parlimitshi[4], fitPar[4], fitParErr[4];
1211 
1212  if (energyHisto->getEntries()>20){
1213  if(histname=="ecalS9PointingMuDepositedEnergy_"){
1214  fitRange[0]=0.04;
1215  fitRange[1]=3.0;
1216 
1217  startValues[0]=0.036; startValues[1]=0.193; startValues[2]=110.0; startValues[3]=0.06;
1218  parlimitslo[0]=0.0; parlimitslo[1]=0.; parlimitslo[2]=1.0; parlimitslo[3]=0.;
1219  parlimitshi[0]=0.05; parlimitshi[1]=0.5; parlimitshi[2]=80000.0; parlimitshi[3]=0.1;
1220 
1221  Double_t chisqr;
1222  Int_t ndf;
1223  TF1 *fit = langaufit(energyHisto_root,fitRange,startValues,parlimitslo,parlimitshi,fitPar,fitParErr,&chisqr,&ndf);
1224  if(fit){
1225  langaupro(fitPar,hPeak,hFWHM);
1226  LogTrace(metname)<<"hPeak from langau fit: "<<hPeak<<" for: "<<histname+muonType<<endl;
1227  LogTrace(metname)<<"hFWHM from langau fit: "<<hFWHM<<" for: "<<histname+muonType<<endl;
1228  }
1229  }
1230 
1231  if(histname=="hadS9PointingMuDepositedEnergy_"){
1232  fitRange[0]=0.0;
1233  fitRange[1]=7.0;
1234 
1235  startValues[0]=2.0; startValues[1]=2.4; startValues[2]=110.0; startValues[3]=4.0;
1236  parlimitslo[0]=0.0; parlimitslo[1]=0.; parlimitslo[2]=1.0; parlimitslo[3]=0.;
1237  parlimitshi[0]=4.0; parlimitshi[1]=4.0; parlimitshi[2]=80000.0; parlimitshi[3]=8.0;
1238 
1239  Double_t chisqr;
1240  Int_t ndf;
1241  TF1 *fit = langaufit(energyHisto_root,fitRange,startValues,parlimitslo,parlimitshi,fitPar,fitParErr,&chisqr,&ndf);
1242  if(fit){
1243  langaupro(fitPar,hPeak,hFWHM);
1244  LogTrace(metname)<<"hPeak from langau fit: "<<hPeak<<" for: "<<histname+muonType<<endl;
1245  LogTrace(metname)<<"hFWHM from langau fit: "<<hFWHM<<" for: "<<histname+muonType<<endl;
1246  }
1247  }
1248  }
1249  else{
1250  LogTrace(metname) << "[MuonTestSummary]: Test of Energy for "<< histname+muonType << " not performed because # entries < 20 ";
1251  }
1252  }
1253 
1254  if(histname=="ecalS9PointingMuDepositedEnergy_" && hPeak>expPeakEcalS9_min && hPeak<expPeakEcalS9_max)
1255  energySummaryMap->setBinContent(binNumber,1, 1);
1256  if(histname=="ecalS9PointingMuDepositedEnergy_" && (hPeak!=-1) &&!(hPeak>expPeakEcalS9_min && hPeak<expPeakEcalS9_max))
1257  energySummaryMap->setBinContent(binNumber,1, 0);
1258 
1259  if(histname=="hadS9PointingMuDepositedEnergy_" && hPeak>expPeakHadS9_min && hPeak<expPeakHadS9_max)
1260  energySummaryMap->setBinContent(binNumber,2, 1);
1261  if(histname=="hadS9PointingMuDepositedEnergy_" && (hPeak!=-1) && !(hPeak>expPeakHadS9_min && hPeak<expPeakHadS9_max))
1262  energySummaryMap->setBinContent(binNumber,2, 0);
1263 
1264  //missing test on ho distributions
1265 }
1266 
1267 
1269 
1270  MonitorElement* multiplicityHisto = dbe->get("Muons/MuonRecoAnalyzer/muReco");
1271 
1272  if(multiplicityHisto){
1273  if(multiplicityHisto->getEntries()>20){
1274  double multiplicity_GLB = double(multiplicityHisto->getBinContent(1)+multiplicityHisto->getBinContent(2))/double(multiplicityHisto->getEntries());
1275  LogTrace(metname)<<"multiplicity_GLB: "<<multiplicity_GLB<< " ExpMultiplicityGlb_min " <<expMultiplicityGlb_min <<" ExpMultiplicityGlb_max " <<expMultiplicityGlb_max<<endl;
1276  double multiplicity_TK = double(multiplicityHisto->getBinContent(3)+multiplicityHisto->getBinContent(4))/double(multiplicityHisto->getEntries());
1277  LogTrace(metname)<<"multiplicity_TK: "<<multiplicity_TK<< " ExpMultiplicityTk_min " <<expMultiplicityTk_min <<" ExpMultiplicityTk_max " <<expMultiplicityTk_max<<endl;
1278  double multiplicity_STA = double(multiplicityHisto->getBinContent(3)+multiplicityHisto->getBinContent(5))/double(multiplicityHisto->getEntries());
1279  LogTrace(metname)<<"multiplicity_STA: "<<multiplicity_STA<< " ExpMultiplicitySta_min " <<expMultiplicitySta_min <<" ExpMultiplicitySta_max " <<expMultiplicitySta_max<<endl;
1280 
1281  if(multiplicity_GLB>expMultiplicityGlb_min && multiplicity_GLB<expMultiplicityGlb_max)
1282  multiplicitySummaryMap->setBinContent(1,1);
1283  else
1284  multiplicitySummaryMap->setBinContent(1,0);
1285 
1286  if(multiplicity_TK>expMultiplicityTk_min && multiplicity_TK<expMultiplicityTk_max)
1287  multiplicitySummaryMap->setBinContent(2,1);
1288  else
1289  multiplicitySummaryMap->setBinContent(2,0);
1290 
1291  if(multiplicity_STA>expMultiplicitySta_min && multiplicity_STA<expMultiplicitySta_max)
1292  multiplicitySummaryMap->setBinContent(3,1);
1293  else
1294  multiplicitySummaryMap->setBinContent(3,0);
1295  }
1296  else{
1297  LogTrace(metname) << "[MuonTestSummary]: Test of Multiplicity not performed because # entries < 20 ";
1298  }
1299  }
1300 
1301 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
const std::string metname
tuple yBin
Definition: cuy.py:891
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
const std::string & getMessage(void) const
get message attached to test
Definition: QReport.h:24
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
Diagnostic.
virtual ~MuonTestSummary()
Destructor.
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
int getStatus(void) const
get test status (see Core/interface/QTestStatus.h)
Definition: QReport.h:16
#define LogTrace(id)
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
Histograms initialisation.
int32_t langaupro(double *params, double &maxx, double &FWHM)
Definition: fitUtilities.h:120
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
TH1F * getTH1F(void) const
void doEnergyTests(std::string nameHisto, std::string muonType, int bin)
float getQTresult(void) const
get test result i.e. prob value
Definition: QReport.h:20
void doResidualsTests(std::string type, std::string parameter, int bin)
double getBinContent(int binx) const
get content of bin (1-D)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void GaussFit(std::string type, std::string parameter, MonitorElement *Histo, float &mean, float &mean_err, float &sigma, float &sigma_err)
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
void ResidualCheck(std::string muType, const std::vector< std::string > &resHistos, int &numPlot, double &Mean, double &Mean_err, double &Sigma, double &Sigma_err)
void beginJob(void)
BeginJob.
MuonTestSummary(const edm::ParameterSet &ps)
Constructor.
Definition: Run.h:41
void doKinematicsTests(std::string muonType, int bin)
test operations