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