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 
8 
10 
11 // Framework
18 
19 
24 
25 #include <iostream>
26 #include <cstdio>
27 #include <string>
28 #include <cmath>
29 #include "TF1.h"
30 
31 using namespace edm;
32 using namespace std;
33 
34 
36  parameters = ps;
37 
38  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
39 
40  GaussianCriterionName = parameters.getUntrackedParameter<string>("resDistributionTestName","ResidualsDistributionGaussianTest");
41  SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName","ResidualsSigmaInRange");
42  MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","ResidualsMeanInRange");
43 }
45 
49  ibooker.setCurrentFolder("Muons/Tests/trackResidualsTest");
50 
51  string histName, MeanHistoName, SigmaHistoName, MeanHistoTitle, SigmaHistoTitle;
52  vector<string> type;
53  type.push_back("eta");
54  type.push_back("theta");
55  type.push_back("phi");
56 
57 
58  for(unsigned int c=0; c<type.size(); c++){
59 
60  MeanHistoName = "MeanTest_" + type[c];
61  SigmaHistoName = "SigmaTest_" + type[c];
62 
63  MeanHistoTitle = "Mean of the #" + type[c] + " residuals distribution";
64  SigmaHistoTitle = "Sigma of the #" + type[c] + " residuals distribution";
65 
66  histName = "Res_GlbSta_"+type[c];
67  histoNames[type[c]].push_back(histName);
68  histName = "Res_TkGlb_"+type[c];
69  histoNames[type[c]].push_back(histName);
70  histName = "Res_TkSta_"+type[c];
71  histoNames[type[c]].push_back(histName);
72 
73 
74  MeanHistos[type[c]] = ibooker.book1D(MeanHistoName.c_str(),MeanHistoTitle.c_str(),3,0.5,3.5);
75  (MeanHistos[type[c]])->setBinLabel(1,"Res_StaGlb",1);
76  (MeanHistos[type[c]])->setBinLabel(2,"Res_TkGlb",1);
77  (MeanHistos[type[c]])->setBinLabel(3,"Res_TkSta",1);
78 
79 
80  SigmaHistos[type[c]] = ibooker.book1D(SigmaHistoName.c_str(),SigmaHistoTitle.c_str(),3,0.5,3.5);
81  (SigmaHistos[type[c]])->setBinLabel(1,"Res_StaGlb",1);
82  (SigmaHistos[type[c]])->setBinLabel(2,"Res_TkGlb",1);
83  (SigmaHistos[type[c]])->setBinLabel(3,"Res_TkSta",1);
84 
85  }
86 
90  for(map<string, vector<string> > ::const_iterator histo = histoNames.begin();
91  histo != histoNames.end();
92  histo++) {
93 
94  for (unsigned int type=0; type< (*histo).second.size(); type++){
95 
96  string path = "Muons/MuonRecoAnalyzer/" + (*histo).second[type];
97  MonitorElement * res_histo = igetter.get(path);
98  if (res_histo) {
99 
100  // gaussian test
101  // const QReport *GaussianReport = res_histo->getQReport(GaussianCriterionName);
102  int BinNumber = type+1;
103  float mean = (*res_histo).getMean(1);
104  float sigma = (*res_histo).getRMS(1);
105  MeanHistos.find((*histo).first)->second->setBinContent(BinNumber, mean);
106  SigmaHistos.find((*histo).first)->second->setBinContent(BinNumber, sigma);
107  }
108  }
109  }
110 
111 
112  // Mean test
113  for(map<string, MonitorElement*>::const_iterator hMean = MeanHistos.begin();
114  hMean != MeanHistos.end();
115  hMean++) {
116  const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
117  if(theMeanQReport) {
118  vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
119  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
120  channel != badChannels.end(); channel++) {
121  }
122  }
123  }
124 
125  // Sigma test
126  for(map<string, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin();
127  hSigma != SigmaHistos.end();
128  hSigma++) {
129  const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName);
130  if(theSigmaQReport) {
131  vector<dqm::me_util::Channel> badChannels = theSigmaQReport->getBadChannels();
132  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
133  channel != badChannels.end(); channel++) {
134  }
135  }
136  }
137 }
138 
139 
140 
type
Definition: HCALResponse.h:21
const std::vector< DQMChannel > & getBadChannels() const
Definition: QReport.h:33
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MuonTrackResidualsTest(const edm::ParameterSet &ps)
Constructor.
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
HLT enums.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override