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