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
30 
31 
32 using namespace std;
33 
34 
36  bBookTracks = true;
37 }
38 
39 
41  bBookTracks = true;
42 }
43 
44 
46 
47 }
48 
49 
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_)).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_ = dbe->book1D(hisID,"Hit efficiency",1,0,1.);
76  meEfficiency_->setAxisTitle("Hit efficiency",1);
77 
78  hisID = theHistogramId->setHistoId("efficiencyX",id_);
79  meEfficiencyX_ = dbe->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_ = dbe->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_ = dbe->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_ = dbe->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_ = dbe->book1D(hisID,"# Valid hits",1,0,1.);
98  meValid_->setAxisTitle("# Valid hits",1);
99 
100  /*hisID = theHistogramId->setHistoId("validX",id_);
101  meValidX_ = dbe->book1D(hisID,"# Valid hits in X",nbinX,-1.5,1.5);
102  meValidX_->setAxisTitle("# Valid hits in X",1);
103 
104  hisID = theHistogramId->setHistoId("validY",id_);
105  meValidY_ = dbe->book1D(hisID,"# Valid hits in Y",nbinY,-4.,4.);
106  meValidY_->setAxisTitle("# Valid hits in Y",1);
107 
108  hisID = theHistogramId->setHistoId("validAlpha",id_);
109  meValidAlpha_ = dbe->book1D(hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
110  meValidAlpha_->setAxisTitle("# Valid hits in Alpha",1);
111 
112  hisID = theHistogramId->setHistoId("validBeta",id_);
113  meValidBeta_ = dbe->book1D(hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
114  meValidBeta_->setAxisTitle("# Valid hits in Beta",1);*/
115 
116  //MISSING
117  hisID = theHistogramId->setHistoId("missing",id_);
118  meMissing_ = dbe->book1D(hisID,"# Missing hits",1,0,1.);
119  meMissing_->setAxisTitle("# Missing hits",1);
120 
121  /*hisID = theHistogramId->setHistoId("missingX",id_);
122  meMissingX_ = dbe->book1D(hisID,"# Missing hits in X",nbinX,-1.5,1.5);
123  meMissingX_->setAxisTitle("# Missing hits in X",1);
124 
125  hisID = theHistogramId->setHistoId("missingY",id_);
126  meMissingY_ = dbe->book1D(hisID,"# Missing hits in Y",nbinY,-4.,4.);
127  meMissingY_->setAxisTitle("# Missing hits in Y",1);
128 
129  hisID = theHistogramId->setHistoId("missingAlpha",id_);
130  meMissingAlpha_ = dbe->book1D(hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
131  meMissingAlpha_->setAxisTitle("# Missing hits in Alpha",1);
132 
133  hisID = theHistogramId->setHistoId("missingBeta",id_);
134  meMissingBeta_ = dbe->book1D(hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
135  meMissingBeta_->setAxisTitle("# Missing hits in Beta",1);*/
136 
137  delete theHistogramId;
138  }
139 
140  if(type==1 && barrel){
141  uint32_t DBladder = PixelBarrelName(DetId(id_)).ladderName();
142  char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
143  hisID = src.label() + "_" + sladder;
144  if(isHalfModule) hisID += "H";
145  else hisID += "F";
146 
147  if(updateEfficiencies){
148  //EFFICIENCY
149  meEfficiencyLad_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
150  meEfficiencyLad_->setAxisTitle("Hit efficiency",1);
151 
152  meEfficiencyXLad_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
153  meEfficiencyXLad_->setAxisTitle("Hit efficiency in X",1);
154 
155  meEfficiencyYLad_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
156  meEfficiencyYLad_->setAxisTitle("Hit efficiency in Y",1);
157 
158  meEfficiencyAlphaLad_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
159  meEfficiencyAlphaLad_->setAxisTitle("Hit efficiency in Alpha",1);
160 
161  meEfficiencyBetaLad_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
162  meEfficiencyBetaLad_->setAxisTitle("Hit efficiency in Beta",1);
163  }
164 
165  //VALID
166  meValidLad_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
167  meValidLad_->setAxisTitle("# Valid hits",1);
168 
169  meValidXLad_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
170  meValidXLad_->setAxisTitle("# Valid hits in X",1);
171 
172  meValidYLad_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
173  meValidYLad_->setAxisTitle("# Valid hits in Y",1);
174 
175  meValidAlphaLad_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
176  meValidAlphaLad_->setAxisTitle("# Valid hits in Alpha",1);
177 
178  meValidBetaLad_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
179  meValidBetaLad_->setAxisTitle("# Valid hits in Beta",1);
180 
181  //MISSING
182  meMissingLad_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
183  meMissingLad_->setAxisTitle("# Missing hits",1);
184 
185  meMissingXLad_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
186  meMissingXLad_->setAxisTitle("# Missing hits in X",1);
187 
188  meMissingYLad_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
189  meMissingYLad_->setAxisTitle("# Missing hits in Y",1);
190 
191  meMissingAlphaLad_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
192  meMissingAlphaLad_->setAxisTitle("# Missing hits in Alpha",1);
193 
194  meMissingBetaLad_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
195  meMissingBetaLad_->setAxisTitle("# Missing hits in Beta",1);
196  }
197 
198  if(type==2 && barrel){
199  uint32_t DBlayer = PixelBarrelName(DetId(id_)).layerName();
200  char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
201  hisID = src.label() + "_" + slayer;
202 
203 
204  if(updateEfficiencies){
205  //EFFICIENCY
206  meEfficiencyLay_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
207  meEfficiencyLay_->setAxisTitle("Hit efficiency",1);
208 
209  meEfficiencyXLay_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
210  meEfficiencyXLay_->setAxisTitle("Hit efficiency in X",1);
211 
212  meEfficiencyYLay_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
213  meEfficiencyYLay_->setAxisTitle("Hit efficiency in Y",1);
214 
215  meEfficiencyAlphaLay_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
216  meEfficiencyAlphaLay_->setAxisTitle("Hit efficiency in Alpha",1);
217 
218  meEfficiencyBetaLay_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
219  meEfficiencyBetaLay_->setAxisTitle("Hit efficiency in Beta",1);
220  }
221 
222  //VALID
223  meValidLay_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
224  meValidLay_->setAxisTitle("# Valid hits",1);
225 
226  meValidXLay_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
227  meValidXLay_->setAxisTitle("# Valid hits in X",1);
228 
229  meValidYLay_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
230  meValidYLay_->setAxisTitle("# Valid hits in Y",1);
231 
232  meValidAlphaLay_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
233  meValidAlphaLay_->setAxisTitle("# Valid hits in Alpha",1);
234 
235  meValidBetaLay_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
236  meValidBetaLay_->setAxisTitle("# Valid hits in Beta",1);
237 
238  //MISSING
239  meMissingLay_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
240  meMissingLay_->setAxisTitle("# Missing hits",1);
241 
242  meMissingXLay_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
243  meMissingXLay_->setAxisTitle("# Missing hits in X",1);
244 
245  meMissingYLay_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
246  meMissingYLay_->setAxisTitle("# Missing hits in Y",1);
247 
248  meMissingAlphaLay_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
249  meMissingAlphaLay_->setAxisTitle("# Missing hits in Alpha",1);
250 
251  meMissingBetaLay_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
252  meMissingBetaLay_->setAxisTitle("# Missing hits in Beta",1);
253  }
254 
255  if(type==3 && barrel){
256  uint32_t DBmodule = PixelBarrelName(DetId(id_)).moduleName();
257  char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
258  hisID = src.label() + "_" + smodule;
259 
260  if(updateEfficiencies){
261  //EFFICIENCY
262  meEfficiencyPhi_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
263  meEfficiencyPhi_->setAxisTitle("Hit efficiency",1);
264 
265  meEfficiencyXPhi_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
266  meEfficiencyXPhi_->setAxisTitle("Hit efficiency in X",1);
267 
268  meEfficiencyYPhi_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
269  meEfficiencyYPhi_->setAxisTitle("Hit efficiency in Y",1);
270 
271  meEfficiencyAlphaPhi_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
272  meEfficiencyAlphaPhi_->setAxisTitle("Hit efficiency in Alpha",1);
273 
274  meEfficiencyBetaPhi_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
275  meEfficiencyBetaPhi_->setAxisTitle("Hit efficiency in Beta",1);
276  }
277 
278  //VALID
279  meValidPhi_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
280  meValidPhi_->setAxisTitle("# Valid hits",1);
281 
282  meValidXPhi_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
283  meValidXPhi_->setAxisTitle("# Valid hits in X",1);
284 
285  meValidYPhi_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
286  meValidYPhi_->setAxisTitle("# Valid hits in Y",1);
287 
288  meValidAlphaPhi_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
289  meValidAlphaPhi_->setAxisTitle("# Valid hits in Alpha",1);
290 
291  meValidBetaPhi_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
292  meValidBetaPhi_->setAxisTitle("# Valid hits in Beta",1);
293 
294  //MISSING
295  meMissingPhi_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
296  meMissingPhi_->setAxisTitle("# Missing hits",1);
297 
298  meMissingXPhi_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
299  meMissingXPhi_->setAxisTitle("# Missing hits in X",1);
300 
301  meMissingYPhi_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
302  meMissingYPhi_->setAxisTitle("# Missing hits in Y",1);
303 
304  meMissingAlphaPhi_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
305  meMissingAlphaPhi_->setAxisTitle("# Missing hits in Alpha",1);
306 
307  meMissingBetaPhi_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
308  meMissingBetaPhi_->setAxisTitle("# Missing hits in Beta",1);
309  }
310 
311  if(type==4 && endcap){
312  uint32_t blade= PixelEndcapName(DetId(id_)).bladeName();
313 
314  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
315  hisID = src.label() + "_" + sblade;
316 
317  if(updateEfficiencies){
318  //EFFICIENCY
319  meEfficiencyBlade_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
320  meEfficiencyBlade_->setAxisTitle("Hit efficiency",1);
321 
322  meEfficiencyXBlade_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
323  meEfficiencyXBlade_->setAxisTitle("Hit efficiency in X",1);
324 
325  meEfficiencyYBlade_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
326  meEfficiencyYBlade_->setAxisTitle("Hit efficiency in Y",1);
327 
328  meEfficiencyAlphaBlade_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
329  meEfficiencyAlphaBlade_->setAxisTitle("Hit efficiency in Alpha",1);
330 
331  meEfficiencyBetaBlade_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
332  meEfficiencyBetaBlade_->setAxisTitle("Hit efficiency in Beta",1);
333  }
334 
335  //VALID
336  meValidBlade_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
337  meValidBlade_->setAxisTitle("# Valid hits",1);
338 
339  meValidXBlade_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
340  meValidXBlade_->setAxisTitle("# Valid hits in X",1);
341 
342  meValidYBlade_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
343  meValidYBlade_->setAxisTitle("# Valid hits in Y",1);
344 
345  meValidAlphaBlade_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
346  meValidAlphaBlade_->setAxisTitle("# Valid hits in Alpha",1);
347 
348  meValidBetaBlade_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
349  meValidBetaBlade_->setAxisTitle("# Valid hits in Beta",1);
350 
351  //MISSING
352  meMissingBlade_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
353  meMissingBlade_->setAxisTitle("# Missing hits",1);
354 
355  meMissingXBlade_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
356  meMissingXBlade_->setAxisTitle("# Missing hits in X",1);
357 
358  meMissingYBlade_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
359  meMissingYBlade_->setAxisTitle("# Missing hits in Y",1);
360 
361  meMissingAlphaBlade_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
362  meMissingAlphaBlade_->setAxisTitle("# Missing hits in Alpha",1);
363 
364  meMissingBetaBlade_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
365  meMissingBetaBlade_->setAxisTitle("# Missing hits in Beta",1);
366  }
367 
368  if(type==5 && endcap){
369  uint32_t disk = PixelEndcapName(DetId(id_)).diskName();
370 
371  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
372  hisID = src.label() + "_" + sdisk;
373 
374  if(updateEfficiencies){
375  //EFFICIENCY
376  meEfficiencyDisk_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
377  meEfficiencyDisk_->setAxisTitle("Hit efficiency",1);
378 
379  meEfficiencyXDisk_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
380  meEfficiencyXDisk_->setAxisTitle("Hit efficiency in X",1);
381 
382  meEfficiencyYDisk_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
383  meEfficiencyYDisk_->setAxisTitle("Hit efficiency in Y",1);
384 
385  meEfficiencyAlphaDisk_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
386  meEfficiencyAlphaDisk_->setAxisTitle("Hit efficiency in Alpha",1);
387 
388  meEfficiencyBetaDisk_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
389  meEfficiencyBetaDisk_->setAxisTitle("Hit efficiency in Beta",1);
390  }
391 
392  //VALID
393  meValidDisk_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
394  meValidDisk_->setAxisTitle("# Valid hits",1);
395 
396  meValidXDisk_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
397  meValidXDisk_->setAxisTitle("# Valid hits in X",1);
398 
399  meValidYDisk_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
400  meValidYDisk_->setAxisTitle("# Valid hits in Y",1);
401 
402  meValidAlphaDisk_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
403  meValidAlphaDisk_->setAxisTitle("# Valid hits in Alpha",1);
404 
405  meValidBetaDisk_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
406  meValidBetaDisk_->setAxisTitle("# Valid hits in Beta",1);
407 
408  //MISSING
409  meMissingDisk_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
410  meMissingDisk_->setAxisTitle("# Missing hits",1);
411 
412  meMissingXDisk_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
413  meMissingXDisk_->setAxisTitle("# Missing hits in X",1);
414 
415  meMissingYDisk_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
416  meMissingYDisk_->setAxisTitle("# Missing hits in Y",1);
417 
418  meMissingAlphaDisk_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
419  meMissingAlphaDisk_->setAxisTitle("# Missing hits in Alpha",1);
420 
421  meMissingBetaDisk_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
422  meMissingBetaDisk_->setAxisTitle("# Missing hits in Beta",1);
423  }
424 
425 
426  if(type==6 && endcap){
427  uint32_t panel= PixelEndcapName(DetId(id_)).pannelName();
429  char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
430  hisID = src.label() + "_" + slab;
431 
432  if(updateEfficiencies){
433  //EFFICIENCY
434  meEfficiencyRing_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
435  meEfficiencyRing_->setAxisTitle("Hit efficiency",1);
436 
437  meEfficiencyXRing_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
438  meEfficiencyXRing_->setAxisTitle("Hit efficiency in X",1);
439 
440  meEfficiencyYRing_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
441  meEfficiencyYRing_->setAxisTitle("Hit efficiency in Y",1);
442 
443  meEfficiencyAlphaRing_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
444  meEfficiencyAlphaRing_->setAxisTitle("Hit efficiency in Alpha",1);
445 
446  meEfficiencyBetaRing_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
447  meEfficiencyBetaRing_->setAxisTitle("Hit efficiency in Beta",1);
448  }
449 
450  //VALID
451  meValidRing_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
452  meValidRing_->setAxisTitle("# Valid hits",1);
453 
454  meValidXRing_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
455  meValidXRing_->setAxisTitle("# Valid hits in X",1);
456 
457  meValidYRing_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
458  meValidYRing_->setAxisTitle("# Valid hits in Y",1);
459 
460  meValidAlphaRing_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
461  meValidAlphaRing_->setAxisTitle("# Valid hits in Alpha",1);
462 
463  meValidBetaRing_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
464  meValidBetaRing_->setAxisTitle("# Valid hits in Beta",1);
465 
466  //MISSING
467  meMissingRing_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
468  meMissingRing_->setAxisTitle("# Missing hits",1);
469 
470  meMissingXRing_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
471  meMissingXRing_->setAxisTitle("# Missing hits in X",1);
472 
473  meMissingYRing_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
474  meMissingYRing_->setAxisTitle("# Missing hits in Y",1);
475 
476  meMissingAlphaRing_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
477  meMissingAlphaRing_->setAxisTitle("# Missing hits in Alpha",1);
478 
479  meMissingBetaRing_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
480  meMissingBetaRing_->setAxisTitle("# Missing hits in Beta",1);
481  }
482 }
483 
484 
485 void SiPixelHitEfficiencyModule::fill(LocalTrajectoryParameters ltp, bool isHitValid, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
486 
487  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
488  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
489 
490  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
491  float prediction_alpha = atan2(localDir.z(), localDir.x());
492  float prediction_beta = atan2(localDir.z(), localDir.y());
493  float prediction_x = ltp.position().x();
494  float prediction_y = ltp.position().y();
495 
496  if(isHitValid){
497  if(modon){
498  meValid_->Fill(0.5);
499  /*meValidX_->Fill(prediction_x);
500  meValidY_->Fill(prediction_y);
501  meValidAlpha_->Fill(prediction_alpha);
502  meValidBeta_->Fill(prediction_beta);*/
503  }
504  if(barrel && ladon){
505  meValidLad_->Fill(0.5);
506  meValidXLad_->Fill(prediction_x);
507  meValidYLad_->Fill(prediction_y);
508  meValidAlphaLad_->Fill(prediction_alpha);
509  meValidBetaLad_->Fill(prediction_beta);
510  }
511  if(barrel && layon){
512  meValidLay_->Fill(0.5);
513  meValidXLay_->Fill(prediction_x);
514  meValidYLay_->Fill(prediction_y);
515  meValidAlphaLay_->Fill(prediction_alpha);
516  meValidBetaLay_->Fill(prediction_beta);
517  }
518  if(barrel && phion){
519  meValidPhi_->Fill(0.5);
520  meValidXPhi_->Fill(prediction_x);
521  meValidYPhi_->Fill(prediction_y);
522  meValidAlphaPhi_->Fill(prediction_alpha);
523  meValidBetaPhi_->Fill(prediction_beta);
524  }
525  if(endcap && bladeon){
526  meValidBlade_->Fill(0.5);
527  meValidXBlade_->Fill(prediction_x);
528  meValidYBlade_->Fill(prediction_y);
529  meValidAlphaBlade_->Fill(prediction_alpha);
530  meValidBetaBlade_->Fill(prediction_beta);
531  }
532  if(endcap && diskon){
533  meValidDisk_->Fill(0.5);
534  meValidXDisk_->Fill(prediction_x);
535  meValidYDisk_->Fill(prediction_y);
536  meValidAlphaDisk_->Fill(prediction_alpha);
537  meValidBetaDisk_->Fill(prediction_beta);
538  }
539  if(endcap && ringon){
540  meValidRing_->Fill(0.5);
541  meValidXRing_->Fill(prediction_x);
542  meValidYRing_->Fill(prediction_y);
543  meValidAlphaRing_->Fill(prediction_alpha);
544  meValidBetaRing_->Fill(prediction_beta);
545  }
546  }
547  else {
548  if(modon){
549  meMissing_->Fill(0.5);
550  /*meMissingX_->Fill(prediction_x);
551  meMissingY_->Fill(prediction_y);
552  meMissingAlpha_->Fill(prediction_alpha);
553  meMissingBeta_->Fill(prediction_beta);*/
554  }
555  if(barrel && ladon){
556  meMissingLad_->Fill(0.5);
557  meMissingXLad_->Fill(prediction_x);
558  meMissingYLad_->Fill(prediction_y);
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(0.5);
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 
600  computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
601 }
602 
603 void SiPixelHitEfficiencyModule::computeEfficiencies(bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
604 
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  /*for(int i=1;i<=meValidX_->getNbinsX();++i){
615  meEfficiencyX_->setBinContent(i,(eff(meValidX_->getBinContent(i),meMissingX_->getBinContent(i))).first);
616  meEfficiencyX_->setBinError(i,(eff(meValidX_->getBinContent(i),meMissingX_->getBinContent(i))).second);
617  }
618  for(int i=1;i<=meValidY_->getNbinsX();++i){
619  meEfficiencyY_->setBinContent(i,(eff(meValidY_->getBinContent(i),meMissingY_->getBinContent(i))).first);
620  meEfficiencyY_->setBinError(i,(eff(meValidY_->getBinContent(i),meMissingY_->getBinContent(i))).second);
621  }
622  for(int i=1;i<=meValidAlpha_->getNbinsX();++i){
623  meEfficiencyAlpha_->setBinContent(i,(eff(meValidAlpha_->getBinContent(i),meMissingAlpha_->getBinContent(i))).first);
624  meEfficiencyAlpha_->setBinError(i,(eff(meValidAlpha_->getBinContent(i),meMissingAlpha_->getBinContent(i))).second);
625  }
626  for(int i=1;i<=meValidBeta_->getNbinsX();++i){
627  meEfficiencyBeta_->setBinContent(i,(eff(meValidBeta_->getBinContent(i),meMissingBeta_->getBinContent(i))).first);
628  meEfficiencyBeta_->setBinError(i,(eff(meValidBeta_->getBinContent(i),meMissingBeta_->getBinContent(i))).second);
629  }*/
630  }
631  if(ladon && barrel){
634  for(int i=1;i<=meValidXLad_->getNbinsX();++i){
637  }
638  for(int i=1;i<=meValidYLad_->getNbinsX();++i){
641  }
642  for(int i=1;i<=meValidAlphaLad_->getNbinsX();++i){
645  }
646  for(int i=1;i<=meValidBetaLad_->getNbinsX();++i){
649  }
650  }
651 
652  if(layon && barrel){
655  for(int i=1;i<=meValidXLay_->getNbinsX();++i){
658  }
659  for(int i=1;i<=meValidYLay_->getNbinsX();++i){
662  }
663  for(int i=1;i<=meValidAlphaLay_->getNbinsX();++i){
666  }
667  for(int i=1;i<=meValidBetaLay_->getNbinsX();++i){
670  }
671  }
672 
673  if(phion && barrel){
676  for(int i=1;i<=meValidXPhi_->getNbinsX();++i){
679  }
680  for(int i=1;i<=meValidYPhi_->getNbinsX();++i){
683  }
684  for(int i=1;i<=meValidAlphaPhi_->getNbinsX();++i){
687  }
688  for(int i=1;i<=meValidBetaPhi_->getNbinsX();++i){
691  }
692  }
693  if(bladeon && endcap){
696  for(int i=1;i<=meValidXBlade_->getNbinsX();++i){
699  }
700  for(int i=1;i<=meValidYBlade_->getNbinsX();++i){
703  }
704  for(int i=1;i<=meValidAlphaBlade_->getNbinsX();++i){
707  }
708  for(int i=1;i<=meValidBetaBlade_->getNbinsX();++i){
711  }
712  }
713  if(diskon && endcap){
716  for(int i=1;i<=meValidXDisk_->getNbinsX();++i){
719  }
720  for(int i=1;i<=meValidYDisk_->getNbinsX();++i){
723  }
724  for(int i=1;i<=meValidAlphaDisk_->getNbinsX();++i){
727  }
728  for(int i=1;i<=meValidBetaDisk_->getNbinsX();++i){
731  }
732  }
733  if(ringon && endcap){
736  for(int i=1;i<=meValidXRing_->getNbinsX();++i){
739  }
740  for(int i=1;i<=meValidYRing_->getNbinsX();++i){
743  }
744  for(int i=1;i<=meValidAlphaRing_->getNbinsX();++i){
747  }
748  for(int i=1;i<=meValidBetaRing_->getNbinsX();++i){
751  }
752  }
753 
754 }
755 
756 std::pair<double,double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing){
757  double efficiency = 0, error = 0 ;
758  if(nValid+nMissing!=0){
759  efficiency=nValid/(nValid+nMissing);
760  error=sqrt(efficiency*(1.-efficiency)/(nValid+nMissing));
761  }
762  return make_pair(efficiency,error);
763 }
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:519
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:57
void Fill(long long x)
int bladeName() const
blade id
T mag() const
Definition: PV3DBase.h:61
bool isHalfModule() const
full or half module
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
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:41
int diskName() const
disk id
void book(const edm::ParameterSet &, int type=0)
T x() const
Definition: PV3DBase.h:56
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
tuple src
Definition: align_tpl.py:87