CMS 3D CMS Logo

SiPixelHitEfficiencyModule.cc
Go to the documentation of this file.
1 // Package: SiPixelMonitorTrack
2 // Class: SiPixelHitEfficiencyModule
3 //
4 // class SiPixelHitEfficiencyModule SiPixelHitEfficiencyModule.cc
5 // DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc
6 //
7 // Description: SiPixel hit efficiency data quality monitoring modules
8 // Implementation: prototype -> improved -> never final - end of the 1st step
9 //
10 // Original Authors: Romain Rougny & Luca Mucibello
11 // Created: Mar Nov 10 13:29:00 CET nbinangle9
12 
13 #include <iostream>
14 #include <string>
15 
23 
24 // Data Formats
35 
36 using namespace std;
37 
39 
41 
43 
45  edm::EventSetup const &iSetup,
46  DQMStore::IBooker &iBooker,
47  int type,
48  bool isUpgrade) {
50  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
51  const TrackerTopology *pTT = tTopoHandle.product();
52 
53  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
54  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
55  bool isHalfModule = false;
56  if (barrel) {
57  isHalfModule = PixelBarrelName(DetId(id_), pTT, isUpgrade).isHalfModule();
58  }
59 
60  edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
61  debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
62  updateEfficiencies = iConfig.getUntrackedParameter<bool>("updateEfficiencies", false);
63  std::string hisID;
64 
65  int nbinangle = 28;
66  int nbinX = 45;
67  int nbinY = 40;
68 
69  if (type == 0) {
70  SiPixelHistogramId *theHistogramId = new SiPixelHistogramId(src.label());
71 
72  if (updateEfficiencies) {
73  // EFFICIENCY
74  hisID = theHistogramId->setHistoId("efficiency", id_);
75  meEfficiency_ = iBooker.book1D(hisID, "Hit efficiency", 1, 0, 1.);
76  meEfficiency_->setAxisTitle("Hit efficiency", 1);
77 
78  hisID = theHistogramId->setHistoId("efficiencyX", id_);
79  meEfficiencyX_ = iBooker.book1D(hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
80  meEfficiencyX_->setAxisTitle("Hit efficiency in X", 1);
81 
82  hisID = theHistogramId->setHistoId("efficiencyY", id_);
83  meEfficiencyY_ = iBooker.book1D(hisID, "Hit efficiency in Y", nbinY, -4., 4.);
84  meEfficiencyY_->setAxisTitle("Hit efficiency in Y", 1);
85 
86  hisID = theHistogramId->setHistoId("efficiencyAlpha", id_);
87  meEfficiencyAlpha_ = iBooker.book1D(hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
88  meEfficiencyAlpha_->setAxisTitle("Hit efficiency in Alpha", 1);
89 
90  hisID = theHistogramId->setHistoId("efficiencyBeta", id_);
91  meEfficiencyBeta_ = iBooker.book1D(hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
92  meEfficiencyBeta_->setAxisTitle("Hit efficiency in Beta", 1);
93  }
94 
95  // VALID
96  hisID = theHistogramId->setHistoId("valid", id_);
97  meValid_ = iBooker.book1D(hisID, "# Valid hits", 1, 0, 1.);
98  meValid_->setAxisTitle("# Valid hits", 1);
99 
100  // MISSING
101  hisID = theHistogramId->setHistoId("missing", id_);
102  meMissing_ = iBooker.book1D(hisID, "# Missing hits", 1, 0, 1.);
103  meMissing_->setAxisTitle("# Missing hits", 1);
104 
105  delete theHistogramId;
106  }
107 
108  if (type == 1 && barrel) {
109  uint32_t DBladder;
110  DBladder = PixelBarrelName(DetId(id_), pTT, isUpgrade).ladderName();
111  char sladder[80];
112  sprintf(sladder, "Ladder_%02i", DBladder);
113  hisID = src.label() + "_" + sladder;
114  if (isHalfModule)
115  hisID += "H";
116  else
117  hisID += "F";
118 
119  if (updateEfficiencies) {
120  // EFFICIENCY
121  meEfficiencyLad_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
122  meEfficiencyLad_->setAxisTitle("Hit efficiency", 1);
123 
124  meEfficiencyXLad_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
125  meEfficiencyXLad_->setAxisTitle("Hit efficiency in X", 1);
126 
127  meEfficiencyYLad_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
128  meEfficiencyYLad_->setAxisTitle("Hit efficiency in Y", 1);
129 
131  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
132  meEfficiencyAlphaLad_->setAxisTitle("Hit efficiency in Alpha", 1);
133 
134  meEfficiencyBetaLad_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
135  meEfficiencyBetaLad_->setAxisTitle("Hit efficiency in Beta", 1);
136  }
137 
138  // VALID
139  meValidLad_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
140  meValidLad_->setAxisTitle("# Valid hits", 1);
141 
142  meValidXLad_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
143  meValidXLad_->setAxisTitle("# Valid hits in X", 1);
144 
145  meValidYLad_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
146  meValidYLad_->setAxisTitle("# Valid hits in Y", 1);
147 
148  meValidModLad_ = iBooker.book1D("validMod_" + hisID, "# Valid hits on Module", 4, 0.5, 4.5);
149  meValidModLad_->setAxisTitle("# Valid hits on Module", 1);
150 
151  meValidAlphaLad_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
152  meValidAlphaLad_->setAxisTitle("# Valid hits in Alpha", 1);
153 
154  meValidBetaLad_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
155  meValidBetaLad_->setAxisTitle("# Valid hits in Beta", 1);
156 
157  // MISSING
158  meMissingLad_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
159  meMissingLad_->setAxisTitle("# Missing hits", 1);
160 
161  meMissingXLad_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
162  meMissingXLad_->setAxisTitle("# Missing hits in X", 1);
163 
164  meMissingYLad_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
165  meMissingYLad_->setAxisTitle("# Missing hits in Y", 1);
166 
167  meMissingModLad_ = iBooker.book1D("missingMod_" + hisID, "# Missing hits on Module", 4, 0.5, 4.5);
168  meMissingModLad_->setAxisTitle("# Missing hits on Module", 1);
169 
170  meMissingAlphaLad_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
171  meMissingAlphaLad_->setAxisTitle("# Missing hits in Alpha", 1);
172 
173  meMissingBetaLad_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
174  meMissingBetaLad_->setAxisTitle("# Missing hits in Beta", 1);
175  }
176 
177  if (type == 2 && barrel) {
178  uint32_t DBlayer;
179  DBlayer = PixelBarrelName(DetId(id_), pTT, isUpgrade).layerName();
180  char slayer[80];
181  sprintf(slayer, "Layer_%i", DBlayer);
182  hisID = src.label() + "_" + slayer;
183 
184  if (updateEfficiencies) {
185  // EFFICIENCY
186  meEfficiencyLay_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
187  meEfficiencyLay_->setAxisTitle("Hit efficiency", 1);
188 
189  meEfficiencyXLay_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
190  meEfficiencyXLay_->setAxisTitle("Hit efficiency in X", 1);
191 
192  meEfficiencyYLay_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
193  meEfficiencyYLay_->setAxisTitle("Hit efficiency in Y", 1);
194 
196  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
197  meEfficiencyAlphaLay_->setAxisTitle("Hit efficiency in Alpha", 1);
198 
199  meEfficiencyBetaLay_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
200  meEfficiencyBetaLay_->setAxisTitle("Hit efficiency in Beta", 1);
201  }
202 
203  // VALID
204  meValidLay_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
205  meValidLay_->setAxisTitle("# Valid hits", 1);
206 
207  meValidXLay_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
208  meValidXLay_->setAxisTitle("# Valid hits in X", 1);
209 
210  meValidYLay_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
211  meValidYLay_->setAxisTitle("# Valid hits in Y", 1);
212 
213  meValidAlphaLay_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
214  meValidAlphaLay_->setAxisTitle("# Valid hits in Alpha", 1);
215 
216  meValidBetaLay_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
217  meValidBetaLay_->setAxisTitle("# Valid hits in Beta", 1);
218 
219  // MISSING
220  meMissingLay_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
221  meMissingLay_->setAxisTitle("# Missing hits", 1);
222 
223  meMissingXLay_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
224  meMissingXLay_->setAxisTitle("# Missing hits in X", 1);
225 
226  meMissingYLay_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
227  meMissingYLay_->setAxisTitle("# Missing hits in Y", 1);
228 
229  meMissingAlphaLay_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
230  meMissingAlphaLay_->setAxisTitle("# Missing hits in Alpha", 1);
231 
232  meMissingBetaLay_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
233  meMissingBetaLay_->setAxisTitle("# Missing hits in Beta", 1);
234  }
235 
236  if (type == 3 && barrel) {
237  uint32_t DBmodule;
238  DBmodule = PixelBarrelName(DetId(id_), pTT, isUpgrade).moduleName();
239  char smodule[80];
240  sprintf(smodule, "Ring_%i", DBmodule);
241  hisID = src.label() + "_" + smodule;
242 
243  if (updateEfficiencies) {
244  // EFFICIENCY
245  meEfficiencyPhi_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
246  meEfficiencyPhi_->setAxisTitle("Hit efficiency", 1);
247 
248  meEfficiencyXPhi_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
249  meEfficiencyXPhi_->setAxisTitle("Hit efficiency in X", 1);
250 
251  meEfficiencyYPhi_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
252  meEfficiencyYPhi_->setAxisTitle("Hit efficiency in Y", 1);
253 
255  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
256  meEfficiencyAlphaPhi_->setAxisTitle("Hit efficiency in Alpha", 1);
257 
258  meEfficiencyBetaPhi_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
259  meEfficiencyBetaPhi_->setAxisTitle("Hit efficiency in Beta", 1);
260  }
261 
262  // VALID
263  meValidPhi_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
264  meValidPhi_->setAxisTitle("# Valid hits", 1);
265 
266  meValidXPhi_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
267  meValidXPhi_->setAxisTitle("# Valid hits in X", 1);
268 
269  meValidYPhi_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
270  meValidYPhi_->setAxisTitle("# Valid hits in Y", 1);
271 
272  meValidAlphaPhi_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
273  meValidAlphaPhi_->setAxisTitle("# Valid hits in Alpha", 1);
274 
275  meValidBetaPhi_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
276  meValidBetaPhi_->setAxisTitle("# Valid hits in Beta", 1);
277 
278  // MISSING
279  meMissingPhi_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
280  meMissingPhi_->setAxisTitle("# Missing hits", 1);
281 
282  meMissingXPhi_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
283  meMissingXPhi_->setAxisTitle("# Missing hits in X", 1);
284 
285  meMissingYPhi_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
286  meMissingYPhi_->setAxisTitle("# Missing hits in Y", 1);
287 
288  meMissingAlphaPhi_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
289  meMissingAlphaPhi_->setAxisTitle("# Missing hits in Alpha", 1);
290 
291  meMissingBetaPhi_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
292  meMissingBetaPhi_->setAxisTitle("# Missing hits in Beta", 1);
293  }
294 
295  if (type == 4 && endcap) {
296  uint32_t blade;
297  blade = PixelEndcapName(DetId(id_), pTT, isUpgrade).bladeName();
298 
299  char sblade[80];
300  sprintf(sblade, "Blade_%02i", blade);
301  hisID = src.label() + "_" + sblade;
302 
303  if (updateEfficiencies) {
304  // EFFICIENCY
305  meEfficiencyBlade_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
306  meEfficiencyBlade_->setAxisTitle("Hit efficiency", 1);
307 
308  meEfficiencyXBlade_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
309  meEfficiencyXBlade_->setAxisTitle("Hit efficiency in X", 1);
310 
311  meEfficiencyYBlade_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
312  meEfficiencyYBlade_->setAxisTitle("Hit efficiency in Y", 1);
313 
315  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
316  meEfficiencyAlphaBlade_->setAxisTitle("Hit efficiency in Alpha", 1);
317 
319  iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
320  meEfficiencyBetaBlade_->setAxisTitle("Hit efficiency in Beta", 1);
321  }
322 
323  // VALID
324  meValidBlade_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 2, 0.5, 2.5);
325  meValidBlade_->setAxisTitle("# Valid hits", 1);
326 
327  meValidXBlade_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
328  meValidXBlade_->setAxisTitle("# Valid hits in X", 1);
329 
330  meValidYBlade_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
331  meValidYBlade_->setAxisTitle("# Valid hits in Y", 1);
332 
333  meValidAlphaBlade_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
334  meValidAlphaBlade_->setAxisTitle("# Valid hits in Alpha", 1);
335 
336  meValidBetaBlade_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
337  meValidBetaBlade_->setAxisTitle("# Valid hits in Beta", 1);
338 
339  // MISSING
340  meMissingBlade_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 2, 0.5, 2.5);
341  meMissingBlade_->setAxisTitle("# Missing hits", 1);
342 
343  meMissingXBlade_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
344  meMissingXBlade_->setAxisTitle("# Missing hits in X", 1);
345 
346  meMissingYBlade_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
347  meMissingYBlade_->setAxisTitle("# Missing hits in Y", 1);
348 
349  meMissingAlphaBlade_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
350  meMissingAlphaBlade_->setAxisTitle("# Missing hits in Alpha", 1);
351 
352  meMissingBetaBlade_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
353  meMissingBetaBlade_->setAxisTitle("# Missing hits in Beta", 1);
354  }
355 
356  if (type == 5 && endcap) {
357  uint32_t disk;
358  disk = PixelEndcapName(DetId(id_), pTT, isUpgrade).diskName();
359 
360  char sdisk[80];
361  sprintf(sdisk, "Disk_%i", disk);
362  hisID = src.label() + "_" + sdisk;
363 
364  if (updateEfficiencies) {
365  // EFFICIENCY
366  meEfficiencyDisk_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
367  meEfficiencyDisk_->setAxisTitle("Hit efficiency", 1);
368 
369  meEfficiencyXDisk_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
370  meEfficiencyXDisk_->setAxisTitle("Hit efficiency in X", 1);
371 
372  meEfficiencyYDisk_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
373  meEfficiencyYDisk_->setAxisTitle("Hit efficiency in Y", 1);
374 
376  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
377  meEfficiencyAlphaDisk_->setAxisTitle("Hit efficiency in Alpha", 1);
378 
379  meEfficiencyBetaDisk_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
380  meEfficiencyBetaDisk_->setAxisTitle("Hit efficiency in Beta", 1);
381  }
382 
383  // VALID
384  meValidDisk_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
385  meValidDisk_->setAxisTitle("# Valid hits", 1);
386 
387  meValidXDisk_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
388  meValidXDisk_->setAxisTitle("# Valid hits in X", 1);
389 
390  meValidYDisk_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
391  meValidYDisk_->setAxisTitle("# Valid hits in Y", 1);
392 
393  meValidAlphaDisk_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
394  meValidAlphaDisk_->setAxisTitle("# Valid hits in Alpha", 1);
395 
396  meValidBetaDisk_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
397  meValidBetaDisk_->setAxisTitle("# Valid hits in Beta", 1);
398 
399  // MISSING
400  meMissingDisk_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
401  meMissingDisk_->setAxisTitle("# Missing hits", 1);
402 
403  meMissingXDisk_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
404  meMissingXDisk_->setAxisTitle("# Missing hits in X", 1);
405 
406  meMissingYDisk_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
407  meMissingYDisk_->setAxisTitle("# Missing hits in Y", 1);
408 
409  meMissingAlphaDisk_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
410  meMissingAlphaDisk_->setAxisTitle("# Missing hits in Alpha", 1);
411 
412  meMissingBetaDisk_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
413  meMissingBetaDisk_->setAxisTitle("# Missing hits in Beta", 1);
414  }
415 
416  if (type == 6 && endcap) {
417  uint32_t panel;
418  uint32_t module;
419  panel = PixelEndcapName(DetId(id_), pTT, isUpgrade).pannelName();
420  module = PixelEndcapName(DetId(id_), pTT, isUpgrade).plaquetteName();
421 
422  char slab[80];
423  sprintf(slab, "Panel_%i_Ring_%i", panel, module);
424  hisID = src.label() + "_" + slab;
425 
426  if (updateEfficiencies) {
427  // EFFICIENCY
428  meEfficiencyRing_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
429  meEfficiencyRing_->setAxisTitle("Hit efficiency", 1);
430 
431  meEfficiencyXRing_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
432  meEfficiencyXRing_->setAxisTitle("Hit efficiency in X", 1);
433 
434  meEfficiencyYRing_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
435  meEfficiencyYRing_->setAxisTitle("Hit efficiency in Y", 1);
436 
438  iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
439  meEfficiencyAlphaRing_->setAxisTitle("Hit efficiency in Alpha", 1);
440 
441  meEfficiencyBetaRing_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
442  meEfficiencyBetaRing_->setAxisTitle("Hit efficiency in Beta", 1);
443  }
444 
445  // VALID
446  meValidRing_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
447  meValidRing_->setAxisTitle("# Valid hits", 1);
448 
449  meValidXRing_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
450  meValidXRing_->setAxisTitle("# Valid hits in X", 1);
451 
452  meValidYRing_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
453  meValidYRing_->setAxisTitle("# Valid hits in Y", 1);
454 
455  meValidAlphaRing_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
456  meValidAlphaRing_->setAxisTitle("# Valid hits in Alpha", 1);
457 
458  meValidBetaRing_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
459  meValidBetaRing_->setAxisTitle("# Valid hits in Beta", 1);
460 
461  // MISSING
462  meMissingRing_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
463  meMissingRing_->setAxisTitle("# Missing hits", 1);
464 
465  meMissingXRing_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
466  meMissingXRing_->setAxisTitle("# Missing hits in X", 1);
467 
468  meMissingYRing_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
469  meMissingYRing_->setAxisTitle("# Missing hits in Y", 1);
470 
471  meMissingAlphaRing_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
472  meMissingAlphaRing_->setAxisTitle("# Missing hits in Alpha", 1);
473 
474  meMissingBetaRing_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
475  meMissingBetaRing_->setAxisTitle("# Missing hits in Beta", 1);
476  }
477 }
478 
480  const LocalTrajectoryParameters &ltp,
481  bool isHitValid,
482  bool modon,
483  bool ladon,
484  bool layon,
485  bool phion,
486  bool bladeon,
487  bool diskon,
488  bool ringon) {
489  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
490  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
491 
492  LocalVector localDir = ltp.momentum() / ltp.momentum().mag();
493  float prediction_alpha = atan2(localDir.z(), localDir.x());
494  float prediction_beta = atan2(localDir.z(), localDir.y());
495  float prediction_x = ltp.position().x();
496  float prediction_y = ltp.position().y();
497 
499  int imod = PBN.moduleName();
501  int ipan = PEN.pannelName();
502 
503  if (isHitValid) {
504  if (modon) {
505  meValid_->Fill(0.5);
506  }
507  if (barrel && ladon) {
508  meValidLad_->Fill(0.5);
509  meValidXLad_->Fill(prediction_x);
510  meValidYLad_->Fill(prediction_y);
511  meValidModLad_->Fill(imod);
512  meValidAlphaLad_->Fill(prediction_alpha);
513  meValidBetaLad_->Fill(prediction_beta);
514  }
515  if (barrel && layon) {
516  meValidLay_->Fill(0.5);
517  meValidXLay_->Fill(prediction_x);
518  meValidYLay_->Fill(prediction_y);
519  meValidAlphaLay_->Fill(prediction_alpha);
520  meValidBetaLay_->Fill(prediction_beta);
521  }
522  if (barrel && phion) {
523  meValidPhi_->Fill(0.5);
524  meValidXPhi_->Fill(prediction_x);
525  meValidYPhi_->Fill(prediction_y);
526  meValidAlphaPhi_->Fill(prediction_alpha);
527  meValidBetaPhi_->Fill(prediction_beta);
528  }
529  if (endcap && bladeon) {
530  meValidBlade_->Fill(ipan);
531  meValidXBlade_->Fill(prediction_x);
532  meValidYBlade_->Fill(prediction_y);
533  meValidAlphaBlade_->Fill(prediction_alpha);
534  meValidBetaBlade_->Fill(prediction_beta);
535  }
536  if (endcap && diskon) {
537  meValidDisk_->Fill(0.5);
538  meValidXDisk_->Fill(prediction_x);
539  meValidYDisk_->Fill(prediction_y);
540  meValidAlphaDisk_->Fill(prediction_alpha);
541  meValidBetaDisk_->Fill(prediction_beta);
542  }
543  if (endcap && ringon) {
544  meValidRing_->Fill(0.5);
545  meValidXRing_->Fill(prediction_x);
546  meValidYRing_->Fill(prediction_y);
547  meValidAlphaRing_->Fill(prediction_alpha);
548  meValidBetaRing_->Fill(prediction_beta);
549  }
550  } else {
551  if (modon) {
552  meMissing_->Fill(0.5);
553  }
554  if (barrel && ladon) {
555  meMissingLad_->Fill(0.5);
556  meMissingXLad_->Fill(prediction_x);
557  meMissingYLad_->Fill(prediction_y);
558  meMissingModLad_->Fill(imod);
559  meMissingAlphaLad_->Fill(prediction_alpha);
560  meMissingBetaLad_->Fill(prediction_beta);
561  }
562  if (barrel && layon) {
563  meMissingLay_->Fill(0.5);
564  meMissingXLay_->Fill(prediction_x);
565  meMissingYLay_->Fill(prediction_y);
566  meMissingAlphaLay_->Fill(prediction_alpha);
567  meMissingBetaLay_->Fill(prediction_beta);
568  }
569  if (barrel && phion) {
570  meMissingPhi_->Fill(0.5);
571  meMissingXPhi_->Fill(prediction_x);
572  meMissingYPhi_->Fill(prediction_y);
573  meMissingAlphaPhi_->Fill(prediction_alpha);
574  meMissingBetaPhi_->Fill(prediction_beta);
575  }
576  if (endcap && bladeon) {
577  meMissingBlade_->Fill(ipan);
578  meMissingXBlade_->Fill(prediction_x);
579  meMissingYBlade_->Fill(prediction_y);
580  meMissingAlphaBlade_->Fill(prediction_alpha);
581  meMissingBetaBlade_->Fill(prediction_beta);
582  }
583  if (endcap && diskon) {
584  meMissingDisk_->Fill(0.5);
585  meMissingXDisk_->Fill(prediction_x);
586  meMissingYDisk_->Fill(prediction_y);
587  meMissingAlphaDisk_->Fill(prediction_alpha);
588  meMissingBetaDisk_->Fill(prediction_beta);
589  }
590  if (endcap && ringon) {
591  meMissingRing_->Fill(0.5);
592  meMissingXRing_->Fill(prediction_x);
593  meMissingYRing_->Fill(prediction_y);
594  meMissingAlphaRing_->Fill(prediction_alpha);
595  meMissingBetaRing_->Fill(prediction_beta);
596  }
597  }
598 
599  if (updateEfficiencies)
600  computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
601 }
602 
604  bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
605  if (debug_)
606  std::cout << "Now Filling histos for detid " << id_ << std::endl;
607 
608  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
609  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
610 
611  if (modon) {
614  }
615  if (ladon && barrel) {
618  for (int i = 1; i <= meValidXLad_->getNbinsX(); ++i) {
622  }
623  for (int i = 1; i <= meValidYLad_->getNbinsX(); ++i) {
627  }
628  for (int i = 1; i <= meValidAlphaLad_->getNbinsX(); ++i) {
633  }
634  for (int i = 1; i <= meValidBetaLad_->getNbinsX(); ++i) {
639  }
640  }
641 
642  if (layon && barrel) {
645  for (int i = 1; i <= meValidXLay_->getNbinsX(); ++i) {
649  }
650  for (int i = 1; i <= meValidYLay_->getNbinsX(); ++i) {
654  }
655  for (int i = 1; i <= meValidAlphaLay_->getNbinsX(); ++i) {
660  }
661  for (int i = 1; i <= meValidBetaLay_->getNbinsX(); ++i) {
666  }
667  }
668 
669  if (phion && barrel) {
672  for (int i = 1; i <= meValidXPhi_->getNbinsX(); ++i) {
676  }
677  for (int i = 1; i <= meValidYPhi_->getNbinsX(); ++i) {
681  }
682  for (int i = 1; i <= meValidAlphaPhi_->getNbinsX(); ++i) {
687  }
688  for (int i = 1; i <= meValidBetaPhi_->getNbinsX(); ++i) {
693  }
694  }
695  if (bladeon && endcap) {
700  for (int i = 1; i <= meValidXBlade_->getNbinsX(); ++i) {
705  }
706  for (int i = 1; i <= meValidYBlade_->getNbinsX(); ++i) {
711  }
712  for (int i = 1; i <= meValidAlphaBlade_->getNbinsX(); ++i) {
717  }
718  for (int i = 1; i <= meValidBetaBlade_->getNbinsX(); ++i) {
723  }
724  }
725  if (diskon && endcap) {
728  for (int i = 1; i <= meValidXDisk_->getNbinsX(); ++i) {
733  }
734  for (int i = 1; i <= meValidYDisk_->getNbinsX(); ++i) {
739  }
740  for (int i = 1; i <= meValidAlphaDisk_->getNbinsX(); ++i) {
745  }
746  for (int i = 1; i <= meValidBetaDisk_->getNbinsX(); ++i) {
751  }
752  }
753  if (ringon && endcap) {
756  for (int i = 1; i <= meValidXRing_->getNbinsX(); ++i) {
761  }
762  for (int i = 1; i <= meValidYRing_->getNbinsX(); ++i) {
767  }
768  for (int i = 1; i <= meValidAlphaRing_->getNbinsX(); ++i) {
773  }
774  for (int i = 1; i <= meValidBetaRing_->getNbinsX(); ++i) {
779  }
780  }
781 }
782 
783 std::pair<double, double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing) {
784  double efficiency = 0, error = 0;
785  if (nValid + nMissing != 0) {
786  efficiency = nValid / (nValid + nMissing);
787  error = sqrt(efficiency * (1. - efficiency) / (nValid + nMissing));
788  }
789  return make_pair(efficiency, error);
790 }
int plaquetteName() const
plaquetteId (in pannel)
void book(const edm::ParameterSet &, edm::EventSetup const &, DQMStore::IBooker &, int type=0, bool isUpgrade=false)
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
int moduleName() const
module id (index in z)
LocalPoint position() const
Local x and y position coordinates.
std::pair< double, double > eff(double nValid, double nMissing)
T y() const
Definition: PV3DBase.h:63
void Fill(long long x)
int bladeName() const
blade id
T mag() const
Definition: PV3DBase.h:67
bool isHalfModule() const
full or half module
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
LocalVector momentum() const
Momentum vector in the local frame.
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
Definition: DetId.h:18
int ladderName() const
ladder id (index in phi)
void fill(const TrackerTopology *pTT, const LocalTrajectoryParameters &ltp, bool isHitValid, bool modon=true, bool ladon=true, bool layon=true, bool phion=true, bool bladeon=true, bool diskon=true, bool ringon=true)
void computeEfficiencies(bool modon=true, bool ladon=true, bool layon=true, bool phion=true, bool bladeon=true, bool diskon=true, bool ringon=true)
int layerName() const
layer id
std::string const & label() const
Definition: InputTag.h:36
double getBinContent(int binx) const
get content of bin (1-D)
int pannelName() const
pannel id
T get() const
Definition: EventSetup.h:71
int diskName() const
disk id
int getNbinsX() const
get # of bins in X-axis
T x() const
Definition: PV3DBase.h:62
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208