CMS 3D CMS Logo

MuonTrackResidualsTest.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 
9 
10 // Framework
17 
21 
22 #include <iostream>
23 #include <cstdio>
24 #include <string>
25 #include <cmath>
26 #include "TF1.h"
27 
28 using namespace edm;
29 using namespace std;
30 
32  parameters = ps;
33 
34  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
35 
36  GaussianCriterionName =
37  parameters.getUntrackedParameter<string>("resDistributionTestName", "ResidualsDistributionGaussianTest");
38  SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName", "ResidualsSigmaInRange");
39  MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName", "ResidualsMeanInRange");
40 }
42  DQMStore::IGetter& igetter,
43  edm::Run const&,
44  edm::EventSetup const&) {
48  ibooker.setCurrentFolder("Muons/Tests/trackResidualsTest");
49 
50  string histName, MeanHistoName, SigmaHistoName, MeanHistoTitle, SigmaHistoTitle;
51  vector<string> type;
52  type.push_back("eta");
53  type.push_back("theta");
54  type.push_back("phi");
55 
56  for (unsigned int c = 0; c < type.size(); c++) {
57  MeanHistoName = "MeanTest_" + type[c];
58  SigmaHistoName = "SigmaTest_" + type[c];
59 
60  MeanHistoTitle = "Mean of the #" + type[c] + " residuals distribution";
61  SigmaHistoTitle = "Sigma of the #" + type[c] + " residuals distribution";
62 
63  histName = "Res_GlbSta_" + type[c];
64  histoNames[type[c]].push_back(histName);
65  histName = "Res_TkGlb_" + type[c];
66  histoNames[type[c]].push_back(histName);
67  histName = "Res_TkSta_" + type[c];
68  histoNames[type[c]].push_back(histName);
69 
70  MeanHistos[type[c]] = ibooker.book1D(MeanHistoName.c_str(), MeanHistoTitle.c_str(), 3, 0.5, 3.5);
71  (MeanHistos[type[c]])->setBinLabel(1, "Res_StaGlb", 1);
72  (MeanHistos[type[c]])->setBinLabel(2, "Res_TkGlb", 1);
73  (MeanHistos[type[c]])->setBinLabel(3, "Res_TkSta", 1);
74 
75  SigmaHistos[type[c]] = ibooker.book1D(SigmaHistoName.c_str(), SigmaHistoTitle.c_str(), 3, 0.5, 3.5);
76  (SigmaHistos[type[c]])->setBinLabel(1, "Res_StaGlb", 1);
77  (SigmaHistos[type[c]])->setBinLabel(2, "Res_TkGlb", 1);
78  (SigmaHistos[type[c]])->setBinLabel(3, "Res_TkSta", 1);
79  }
80 
84  for (map<string, vector<string> >::const_iterator histo = histoNames.begin(); histo != histoNames.end(); histo++) {
85  for (unsigned int type = 0; type < (*histo).second.size(); type++) {
86  string path = "Muons/MuonRecoAnalyzer/" + (*histo).second[type];
87  MonitorElement* res_histo = igetter.get(path);
88  if (res_histo) {
89  // gaussian test
90  // const QReport *GaussianReport = res_histo->getQReport(GaussianCriterionName);
91  int BinNumber = type + 1;
92  float mean = (*res_histo).getMean(1);
93  float sigma = (*res_histo).getRMS(1);
94  MeanHistos.find((*histo).first)->second->setBinContent(BinNumber, mean);
95  SigmaHistos.find((*histo).first)->second->setBinContent(BinNumber, sigma);
96  }
97  }
98  }
99 }
void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MuonTrackResidualsTest(const edm::ParameterSet &ps)
Constructor.
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
HLT enums.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45