CMS 3D CMS Logo

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