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
34 
35 
36 using namespace std;
37 
38 
40  bBookTracks = true;
41 }
42 
43 
45  bBookTracks = true;
46 }
47 
48 
50 
51 }
52 
53 
54 void SiPixelHitEfficiencyModule::book(const edm::ParameterSet& iConfig, DQMStore::IBooker & iBooker,int type, bool isUpgrade) {
55 
56  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
57  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
58  bool isHalfModule = false;
59  if(barrel){
60  if (!isUpgrade) {
61  isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule();
62  } else if (isUpgrade) {
63  isHalfModule = PixelBarrelNameUpgrade(DetId(id_)).isHalfModule();
64  }
65  }
66 
67  edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
68  debug_ = iConfig.getUntrackedParameter<bool>("debug",false);
69  updateEfficiencies = iConfig.getUntrackedParameter<bool>("updateEfficiencies",false);
70  std::string hisID;
71 
72  int nbinangle = 28;
73  int nbinX = 45;
74  int nbinY = 40;
75 
76  if(type==0){
77  SiPixelHistogramId* theHistogramId = new SiPixelHistogramId(src.label());
78 
79  if(updateEfficiencies){
80  //EFFICIENCY
81  hisID = theHistogramId->setHistoId("efficiency",id_);
82  meEfficiency_ = iBooker.book1D(hisID,"Hit efficiency",1,0,1.);
83  meEfficiency_->setAxisTitle("Hit efficiency",1);
84 
85  hisID = theHistogramId->setHistoId("efficiencyX",id_);
86  meEfficiencyX_ = iBooker.book1D(hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
87  meEfficiencyX_->setAxisTitle("Hit efficiency in X",1);
88 
89  hisID = theHistogramId->setHistoId("efficiencyY",id_);
90  meEfficiencyY_ = iBooker.book1D(hisID,"Hit efficiency in Y",nbinY,-4.,4.);
91  meEfficiencyY_->setAxisTitle("Hit efficiency in Y",1);
92 
93  hisID = theHistogramId->setHistoId("efficiencyAlpha",id_);
94  meEfficiencyAlpha_ = iBooker.book1D(hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
95  meEfficiencyAlpha_->setAxisTitle("Hit efficiency in Alpha",1);
96 
97  hisID = theHistogramId->setHistoId("efficiencyBeta",id_);
98  meEfficiencyBeta_ = iBooker.book1D(hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
99  meEfficiencyBeta_->setAxisTitle("Hit efficiency in Beta",1);
100  }
101 
102  //VALID
103  hisID = theHistogramId->setHistoId("valid",id_);
104  meValid_ = iBooker.book1D(hisID,"# Valid hits",1,0,1.);
105  meValid_->setAxisTitle("# Valid hits",1);
106 
107  //MISSING
108  hisID = theHistogramId->setHistoId("missing",id_);
109  meMissing_ = iBooker.book1D(hisID,"# Missing hits",1,0,1.);
110  meMissing_->setAxisTitle("# Missing hits",1);
111 
112  delete theHistogramId;
113  }
114 
115  if(type==1 && barrel){
116  uint32_t DBladder;
117  if (!isUpgrade) { DBladder = PixelBarrelName(DetId(id_)).ladderName(); }
118  else { DBladder = PixelBarrelNameUpgrade(DetId(id_)).ladderName(); }
119  char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
120  hisID = src.label() + "_" + sladder;
121  if(isHalfModule) hisID += "H";
122  else hisID += "F";
123 
124  if(updateEfficiencies){
125  //EFFICIENCY
126  meEfficiencyLad_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
127  meEfficiencyLad_->setAxisTitle("Hit efficiency",1);
128 
129  meEfficiencyXLad_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
130  meEfficiencyXLad_->setAxisTitle("Hit efficiency in X",1);
131 
132  meEfficiencyYLad_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
133  meEfficiencyYLad_->setAxisTitle("Hit efficiency in Y",1);
134 
135  meEfficiencyAlphaLad_ = iBooker.book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
136  meEfficiencyAlphaLad_->setAxisTitle("Hit efficiency in Alpha",1);
137 
138  meEfficiencyBetaLad_ = iBooker.book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
139  meEfficiencyBetaLad_->setAxisTitle("Hit efficiency in Beta",1);
140  }
141 
142  //VALID
143  meValidLad_ = iBooker.book1D("valid_"+hisID,"# Valid hits",1,0,1.);
144  meValidLad_->setAxisTitle("# Valid hits",1);
145 
146  meValidXLad_ = iBooker.book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
147  meValidXLad_->setAxisTitle("# Valid hits in X",1);
148 
149  meValidYLad_ = iBooker.book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
150  meValidYLad_->setAxisTitle("# Valid hits in Y",1);
151 
152  meValidModLad_ = iBooker.book1D("validMod_"+hisID,"# Valid hits on Module",20,1,21.);
153  meValidModLad_->setAxisTitle("# Valid hits on Module",1);
154 
155  meValidAlphaLad_ = iBooker.book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
156  meValidAlphaLad_->setAxisTitle("# Valid hits in Alpha",1);
157 
158  meValidBetaLad_ = iBooker.book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
159  meValidBetaLad_->setAxisTitle("# Valid hits in Beta",1);
160 
161  //MISSING
162  meMissingLad_ = iBooker.book1D("missing_"+hisID,"# Missing hits",1,0,1.);
163  meMissingLad_->setAxisTitle("# Missing hits",1);
164 
165  meMissingXLad_ = iBooker.book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
166  meMissingXLad_->setAxisTitle("# Missing hits in X",1);
167 
168  meMissingYLad_ = iBooker.book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
169  meMissingYLad_->setAxisTitle("# Missing hits in Y",1);
170 
171  meMissingModLad_ = iBooker.book1D("missingMod_"+hisID,"# Missing hits on Module",20,1,21.);
172  meMissingModLad_->setAxisTitle("# Missing hits on Module",1);
173 
174  meMissingAlphaLad_ = iBooker.book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
175  meMissingAlphaLad_->setAxisTitle("# Missing hits in Alpha",1);
176 
177  meMissingBetaLad_ = iBooker.book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
178  meMissingBetaLad_->setAxisTitle("# Missing hits in Beta",1);
179  }
180 
181  if(type==2 && barrel){
182  uint32_t DBlayer;
183  if (!isUpgrade) { DBlayer = PixelBarrelName(DetId(id_)).layerName(); }
184  else { DBlayer = PixelBarrelNameUpgrade(DetId(id_)).layerName(); }
185  char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
186  hisID = src.label() + "_" + slayer;
187 
188 
189  if(updateEfficiencies){
190  //EFFICIENCY
191  meEfficiencyLay_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
192  meEfficiencyLay_->setAxisTitle("Hit efficiency",1);
193 
194  meEfficiencyXLay_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
195  meEfficiencyXLay_->setAxisTitle("Hit efficiency in X",1);
196 
197  meEfficiencyYLay_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
198  meEfficiencyYLay_->setAxisTitle("Hit efficiency in Y",1);
199 
200  meEfficiencyAlphaLay_ = iBooker.book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
201  meEfficiencyAlphaLay_->setAxisTitle("Hit efficiency in Alpha",1);
202 
203  meEfficiencyBetaLay_ = iBooker.book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
204  meEfficiencyBetaLay_->setAxisTitle("Hit efficiency in Beta",1);
205  }
206 
207  //VALID
208  meValidLay_ = iBooker.book1D("valid_"+hisID,"# Valid hits",1,0,1.);
209  meValidLay_->setAxisTitle("# Valid hits",1);
210 
211  meValidXLay_ = iBooker.book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
212  meValidXLay_->setAxisTitle("# Valid hits in X",1);
213 
214  meValidYLay_ = iBooker.book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
215  meValidYLay_->setAxisTitle("# Valid hits in Y",1);
216 
217  meValidAlphaLay_ = iBooker.book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
218  meValidAlphaLay_->setAxisTitle("# Valid hits in Alpha",1);
219 
220  meValidBetaLay_ = iBooker.book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
221  meValidBetaLay_->setAxisTitle("# Valid hits in Beta",1);
222 
223  //MISSING
224  meMissingLay_ = iBooker.book1D("missing_"+hisID,"# Missing hits",1,0,1.);
225  meMissingLay_->setAxisTitle("# Missing hits",1);
226 
227  meMissingXLay_ = iBooker.book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
228  meMissingXLay_->setAxisTitle("# Missing hits in X",1);
229 
230  meMissingYLay_ = iBooker.book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
231  meMissingYLay_->setAxisTitle("# Missing hits in Y",1);
232 
233  meMissingAlphaLay_ = iBooker.book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
234  meMissingAlphaLay_->setAxisTitle("# Missing hits in Alpha",1);
235 
236  meMissingBetaLay_ = iBooker.book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
237  meMissingBetaLay_->setAxisTitle("# Missing hits in Beta",1);
238  }
239 
240  if(type==3 && barrel){
241  uint32_t DBmodule;
242  if (!isUpgrade) { DBmodule = PixelBarrelName(DetId(id_)).moduleName(); }
243  else { DBmodule = PixelBarrelNameUpgrade(DetId(id_)).moduleName(); }
244  char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
245  hisID = src.label() + "_" + smodule;
246 
247  if(updateEfficiencies){
248  //EFFICIENCY
249  meEfficiencyPhi_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
250  meEfficiencyPhi_->setAxisTitle("Hit efficiency",1);
251 
252  meEfficiencyXPhi_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
253  meEfficiencyXPhi_->setAxisTitle("Hit efficiency in X",1);
254 
255  meEfficiencyYPhi_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
256  meEfficiencyYPhi_->setAxisTitle("Hit efficiency in Y",1);
257 
258  meEfficiencyAlphaPhi_ = iBooker.book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
259  meEfficiencyAlphaPhi_->setAxisTitle("Hit efficiency in Alpha",1);
260 
261  meEfficiencyBetaPhi_ = iBooker.book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
262  meEfficiencyBetaPhi_->setAxisTitle("Hit efficiency in Beta",1);
263  }
264 
265  //VALID
266  meValidPhi_ = iBooker.book1D("valid_"+hisID,"# Valid hits",1,0,1.);
267  meValidPhi_->setAxisTitle("# Valid hits",1);
268 
269  meValidXPhi_ = iBooker.book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
270  meValidXPhi_->setAxisTitle("# Valid hits in X",1);
271 
272  meValidYPhi_ = iBooker.book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
273  meValidYPhi_->setAxisTitle("# Valid hits in Y",1);
274 
275  meValidAlphaPhi_ = iBooker.book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
276  meValidAlphaPhi_->setAxisTitle("# Valid hits in Alpha",1);
277 
278  meValidBetaPhi_ = iBooker.book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
279  meValidBetaPhi_->setAxisTitle("# Valid hits in Beta",1);
280 
281  //MISSING
282  meMissingPhi_ = iBooker.book1D("missing_"+hisID,"# Missing hits",1,0,1.);
283  meMissingPhi_->setAxisTitle("# Missing hits",1);
284 
285  meMissingXPhi_ = iBooker.book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
286  meMissingXPhi_->setAxisTitle("# Missing hits in X",1);
287 
288  meMissingYPhi_ = iBooker.book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
289  meMissingYPhi_->setAxisTitle("# Missing hits in Y",1);
290 
291  meMissingAlphaPhi_ = iBooker.book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
292  meMissingAlphaPhi_->setAxisTitle("# Missing hits in Alpha",1);
293 
294  meMissingBetaPhi_ = iBooker.book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
295  meMissingBetaPhi_->setAxisTitle("# Missing hits in Beta",1);
296  }
297 
298  if(type==4 && endcap){
299  uint32_t blade;
300  if (!isUpgrade) { blade= PixelEndcapName(DetId(id_)).bladeName(); }
301  else { blade= PixelEndcapNameUpgrade(DetId(id_)).bladeName(); }
302 
303  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
304  hisID = src.label() + "_" + sblade;
305 
306  if(updateEfficiencies){
307  //EFFICIENCY
308  meEfficiencyBlade_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
309  meEfficiencyBlade_->setAxisTitle("Hit efficiency",1);
310 
311  meEfficiencyXBlade_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
312  meEfficiencyXBlade_->setAxisTitle("Hit efficiency in X",1);
313 
314  meEfficiencyYBlade_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
315  meEfficiencyYBlade_->setAxisTitle("Hit efficiency in Y",1);
316 
317  meEfficiencyAlphaBlade_ = iBooker.book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
318  meEfficiencyAlphaBlade_->setAxisTitle("Hit efficiency in Alpha",1);
319 
320  meEfficiencyBetaBlade_ = iBooker.book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
321  meEfficiencyBetaBlade_->setAxisTitle("Hit efficiency in Beta",1);
322  }
323 
324  //VALID
325  meValidBlade_ = iBooker.book1D("valid_"+hisID,"# Valid hits",1,0,1.);
326  meValidBlade_->setAxisTitle("# Valid hits",1);
327 
328  meValidXBlade_ = iBooker.book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
329  meValidXBlade_->setAxisTitle("# Valid hits in X",1);
330 
331  meValidYBlade_ = iBooker.book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
332  meValidYBlade_->setAxisTitle("# Valid hits in Y",1);
333 
334  meValidAlphaBlade_ = iBooker.book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
335  meValidAlphaBlade_->setAxisTitle("# Valid hits in Alpha",1);
336 
337  meValidBetaBlade_ = iBooker.book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
338  meValidBetaBlade_->setAxisTitle("# Valid hits in Beta",1);
339 
340  //MISSING
341  meMissingBlade_ = iBooker.book1D("missing_"+hisID,"# Missing hits",1,0,1.);
342  meMissingBlade_->setAxisTitle("# Missing hits",1);
343 
344  meMissingXBlade_ = iBooker.book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
345  meMissingXBlade_->setAxisTitle("# Missing hits in X",1);
346 
347  meMissingYBlade_ = iBooker.book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
348  meMissingYBlade_->setAxisTitle("# Missing hits in Y",1);
349 
350  meMissingAlphaBlade_ = iBooker.book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
351  meMissingAlphaBlade_->setAxisTitle("# Missing hits in Alpha",1);
352 
353  meMissingBetaBlade_ = iBooker.book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
354  meMissingBetaBlade_->setAxisTitle("# Missing hits in Beta",1);
355  }
356 
357  if(type==5 && endcap){
358  uint32_t disk;
359  if (!isUpgrade) { disk = PixelEndcapName(DetId(id_)).diskName(); }
360  else { disk = PixelEndcapNameUpgrade(DetId(id_)).diskName(); }
361 
362  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
363  hisID = src.label() + "_" + sdisk;
364 
365  if(updateEfficiencies){
366  //EFFICIENCY
367  meEfficiencyDisk_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
368  meEfficiencyDisk_->setAxisTitle("Hit efficiency",1);
369 
370  meEfficiencyXDisk_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
371  meEfficiencyXDisk_->setAxisTitle("Hit efficiency in X",1);
372 
373  meEfficiencyYDisk_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
374  meEfficiencyYDisk_->setAxisTitle("Hit efficiency in Y",1);
375 
376  meEfficiencyAlphaDisk_ = 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 
417  if(type==6 && endcap){
418  uint32_t panel;
419  uint32_t module;
420  if (!isUpgrade) {
421  panel= PixelEndcapName(DetId(id_)).pannelName();
423  } else {
426  }
427 
428  char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
429  hisID = src.label() + "_" + slab;
430 
431  if(updateEfficiencies){
432  //EFFICIENCY
433  meEfficiencyRing_ = iBooker.book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
434  meEfficiencyRing_->setAxisTitle("Hit efficiency",1);
435 
436  meEfficiencyXRing_ = iBooker.book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
437  meEfficiencyXRing_->setAxisTitle("Hit efficiency in X",1);
438 
439  meEfficiencyYRing_ = iBooker.book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
440  meEfficiencyYRing_->setAxisTitle("Hit efficiency in Y",1);
441 
442  meEfficiencyAlphaRing_ = iBooker.book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
443  meEfficiencyAlphaRing_->setAxisTitle("Hit efficiency in Alpha",1);
444 
445  meEfficiencyBetaRing_ = iBooker.book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
446  meEfficiencyBetaRing_->setAxisTitle("Hit efficiency in Beta",1);
447  }
448 
449  //VALID
450  meValidRing_ = iBooker.book1D("valid_"+hisID,"# Valid hits",1,0,1.);
451  meValidRing_->setAxisTitle("# Valid hits",1);
452 
453  meValidXRing_ = iBooker.book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
454  meValidXRing_->setAxisTitle("# Valid hits in X",1);
455 
456  meValidYRing_ = iBooker.book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
457  meValidYRing_->setAxisTitle("# Valid hits in Y",1);
458 
459  meValidAlphaRing_ = iBooker.book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
460  meValidAlphaRing_->setAxisTitle("# Valid hits in Alpha",1);
461 
462  meValidBetaRing_ = iBooker.book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
463  meValidBetaRing_->setAxisTitle("# Valid hits in Beta",1);
464 
465  //MISSING
466  meMissingRing_ = iBooker.book1D("missing_"+hisID,"# Missing hits",1,0,1.);
467  meMissingRing_->setAxisTitle("# Missing hits",1);
468 
469  meMissingXRing_ = iBooker.book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
470  meMissingXRing_->setAxisTitle("# Missing hits in X",1);
471 
472  meMissingYRing_ = iBooker.book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
473  meMissingYRing_->setAxisTitle("# Missing hits in Y",1);
474 
475  meMissingAlphaRing_ = iBooker.book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
476  meMissingAlphaRing_->setAxisTitle("# Missing hits in Alpha",1);
477 
478  meMissingBetaRing_ = iBooker.book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
479  meMissingBetaRing_->setAxisTitle("# Missing hits in Beta",1);
480  }
481 }
482 
483 
484 void SiPixelHitEfficiencyModule::fill(const LocalTrajectoryParameters& ltp, bool isHitValid, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
485 
486  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
487  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
488 
489  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
490  float prediction_alpha = atan2(localDir.z(), localDir.x());
491  float prediction_beta = atan2(localDir.z(), localDir.y());
492  float prediction_x = ltp.position().x();
493  float prediction_y = ltp.position().y();
494  //CS - this will probably break with isUpgrade
495  int imod = PXBDetId(DetId(id_)).module();
496 
497  if(isHitValid){
498  if(modon){
499  meValid_->Fill(0.5);
500  }
501  if(barrel && ladon){
502  meValidLad_->Fill(0.5);
503  meValidXLad_->Fill(prediction_x);
504  meValidYLad_->Fill(prediction_y);
505  meValidModLad_->Fill(imod);
506  meValidAlphaLad_->Fill(prediction_alpha);
507  meValidBetaLad_->Fill(prediction_beta);
508  }
509  if(barrel && layon){
510  meValidLay_->Fill(0.5);
511  meValidXLay_->Fill(prediction_x);
512  meValidYLay_->Fill(prediction_y);
513  meValidAlphaLay_->Fill(prediction_alpha);
514  meValidBetaLay_->Fill(prediction_beta);
515  }
516  if(barrel && phion){
517  meValidPhi_->Fill(0.5);
518  meValidXPhi_->Fill(prediction_x);
519  meValidYPhi_->Fill(prediction_y);
520  meValidAlphaPhi_->Fill(prediction_alpha);
521  meValidBetaPhi_->Fill(prediction_beta);
522  }
523  if(endcap && bladeon){
524  meValidBlade_->Fill(0.5);
525  meValidXBlade_->Fill(prediction_x);
526  meValidYBlade_->Fill(prediction_y);
527  meValidAlphaBlade_->Fill(prediction_alpha);
528  meValidBetaBlade_->Fill(prediction_beta);
529  }
530  if(endcap && diskon){
531  meValidDisk_->Fill(0.5);
532  meValidXDisk_->Fill(prediction_x);
533  meValidYDisk_->Fill(prediction_y);
534  meValidAlphaDisk_->Fill(prediction_alpha);
535  meValidBetaDisk_->Fill(prediction_beta);
536  }
537  if(endcap && ringon){
538  meValidRing_->Fill(0.5);
539  meValidXRing_->Fill(prediction_x);
540  meValidYRing_->Fill(prediction_y);
541  meValidAlphaRing_->Fill(prediction_alpha);
542  meValidBetaRing_->Fill(prediction_beta);
543  }
544  }
545  else {
546  if(modon){
547  meMissing_->Fill(0.5);
548  }
549  if(barrel && ladon){
550  meMissingLad_->Fill(0.5);
551  meMissingXLad_->Fill(prediction_x);
552  meMissingYLad_->Fill(prediction_y);
553  meMissingModLad_->Fill(imod);
554  meMissingAlphaLad_->Fill(prediction_alpha);
555  meMissingBetaLad_->Fill(prediction_beta);
556  }
557  if(barrel && layon){
558  meMissingLay_->Fill(0.5);
559  meMissingXLay_->Fill(prediction_x);
560  meMissingYLay_->Fill(prediction_y);
561  meMissingAlphaLay_->Fill(prediction_alpha);
562  meMissingBetaLay_->Fill(prediction_beta);
563  }
564  if(barrel && phion){
565  meMissingPhi_->Fill(0.5);
566  meMissingXPhi_->Fill(prediction_x);
567  meMissingYPhi_->Fill(prediction_y);
568  meMissingAlphaPhi_->Fill(prediction_alpha);
569  meMissingBetaPhi_->Fill(prediction_beta);
570  }
571  if(endcap && bladeon){
572  meMissingBlade_->Fill(0.5);
573  meMissingXBlade_->Fill(prediction_x);
574  meMissingYBlade_->Fill(prediction_y);
575  meMissingAlphaBlade_->Fill(prediction_alpha);
576  meMissingBetaBlade_->Fill(prediction_beta);
577  }
578  if(endcap && diskon){
579  meMissingDisk_->Fill(0.5);
580  meMissingXDisk_->Fill(prediction_x);
581  meMissingYDisk_->Fill(prediction_y);
582  meMissingAlphaDisk_->Fill(prediction_alpha);
583  meMissingBetaDisk_->Fill(prediction_beta);
584  }
585  if(endcap && ringon){
586  meMissingRing_->Fill(0.5);
587  meMissingXRing_->Fill(prediction_x);
588  meMissingYRing_->Fill(prediction_y);
589  meMissingAlphaRing_->Fill(prediction_alpha);
590  meMissingBetaRing_->Fill(prediction_beta);
591  }
592  }
593 
595  computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
596 }
597 
598 void SiPixelHitEfficiencyModule::computeEfficiencies(bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
599 
600  if(debug_)
601  std::cout<<"Now Filling histos for detid "<<id_<<std::endl;
602 
603  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
604  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
605 
606  if(modon){
609  }
610  if(ladon && barrel){
613  for(int i=1;i<=meValidXLad_->getNbinsX();++i){
616  }
617  for(int i=1;i<=meValidYLad_->getNbinsX();++i){
620  }
621  for(int i=1;i<=meValidAlphaLad_->getNbinsX();++i){
624  }
625  for(int i=1;i<=meValidBetaLad_->getNbinsX();++i){
628  }
629  }
630 
631  if(layon && barrel){
634  for(int i=1;i<=meValidXLay_->getNbinsX();++i){
637  }
638  for(int i=1;i<=meValidYLay_->getNbinsX();++i){
641  }
642  for(int i=1;i<=meValidAlphaLay_->getNbinsX();++i){
645  }
646  for(int i=1;i<=meValidBetaLay_->getNbinsX();++i){
649  }
650  }
651 
652  if(phion && barrel){
655  for(int i=1;i<=meValidXPhi_->getNbinsX();++i){
658  }
659  for(int i=1;i<=meValidYPhi_->getNbinsX();++i){
662  }
663  for(int i=1;i<=meValidAlphaPhi_->getNbinsX();++i){
666  }
667  for(int i=1;i<=meValidBetaPhi_->getNbinsX();++i){
670  }
671  }
672  if(bladeon && endcap){
675  for(int i=1;i<=meValidXBlade_->getNbinsX();++i){
678  }
679  for(int i=1;i<=meValidYBlade_->getNbinsX();++i){
682  }
683  for(int i=1;i<=meValidAlphaBlade_->getNbinsX();++i){
686  }
687  for(int i=1;i<=meValidBetaBlade_->getNbinsX();++i){
690  }
691  }
692  if(diskon && endcap){
695  for(int i=1;i<=meValidXDisk_->getNbinsX();++i){
698  }
699  for(int i=1;i<=meValidYDisk_->getNbinsX();++i){
702  }
703  for(int i=1;i<=meValidAlphaDisk_->getNbinsX();++i){
706  }
707  for(int i=1;i<=meValidBetaDisk_->getNbinsX();++i){
710  }
711  }
712  if(ringon && endcap){
715  for(int i=1;i<=meValidXRing_->getNbinsX();++i){
718  }
719  for(int i=1;i<=meValidYRing_->getNbinsX();++i){
722  }
723  for(int i=1;i<=meValidAlphaRing_->getNbinsX();++i){
726  }
727  for(int i=1;i<=meValidBetaRing_->getNbinsX();++i){
730  }
731  }
732 
733 }
734 
735 std::pair<double,double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing){
736  double efficiency = 0, error = 0 ;
737  if(nValid+nMissing!=0){
738  efficiency=nValid/(nValid+nMissing);
739  error=sqrt(efficiency*(1.-efficiency)/(nValid+nMissing));
740  }
741  return make_pair(efficiency,error);
742 }
int plaquetteName() const
plaquetteId (in pannel)
type
Definition: HCALResponse.h:21
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)
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
bool isHalfModule() const
full or half module
void book(const edm::ParameterSet &, DQMStore::IBooker &, int type=0, bool isUpgrade=false)
int plaquetteName() const
plaquetteId (in pannel)
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:48
T z() const
Definition: PV3DBase.h:64
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
unsigned int module() const
det id
Definition: PXBDetId.h:43
int bladeName() const
blade id
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:37
int diskName() const
disk id
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 computeEfficiencies(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)
int moduleName() const
module id (index in z)
int layerName() const
layer id
std::string const & label() const
Definition: InputTag.h:42
double getBinContent(int binx) const
get content of bin (1-D)
void fill(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)
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
int pannelName() const
pannel id
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)
int layerName() const
layer id