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 
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<IdealGeometryRecord>().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",1,0,1.);
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",1,0,1.);
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();
490 
491  if(isHitValid){
492  if(modon){
493  meValid_->Fill(0.5);
494  }
495  if(barrel && ladon){
496  meValidLad_->Fill(0.5);
497  meValidXLad_->Fill(prediction_x);
498  meValidYLad_->Fill(prediction_y);
499  meValidModLad_->Fill(imod);
500  meValidAlphaLad_->Fill(prediction_alpha);
501  meValidBetaLad_->Fill(prediction_beta);
502  }
503  if(barrel && layon){
504  meValidLay_->Fill(0.5);
505  meValidXLay_->Fill(prediction_x);
506  meValidYLay_->Fill(prediction_y);
507  meValidAlphaLay_->Fill(prediction_alpha);
508  meValidBetaLay_->Fill(prediction_beta);
509  }
510  if(barrel && phion){
511  meValidPhi_->Fill(0.5);
512  meValidXPhi_->Fill(prediction_x);
513  meValidYPhi_->Fill(prediction_y);
514  meValidAlphaPhi_->Fill(prediction_alpha);
515  meValidBetaPhi_->Fill(prediction_beta);
516  }
517  if(endcap && bladeon){
518  meValidBlade_->Fill(0.5);
519  meValidXBlade_->Fill(prediction_x);
520  meValidYBlade_->Fill(prediction_y);
521  meValidAlphaBlade_->Fill(prediction_alpha);
522  meValidBetaBlade_->Fill(prediction_beta);
523  }
524  if(endcap && diskon){
525  meValidDisk_->Fill(0.5);
526  meValidXDisk_->Fill(prediction_x);
527  meValidYDisk_->Fill(prediction_y);
528  meValidAlphaDisk_->Fill(prediction_alpha);
529  meValidBetaDisk_->Fill(prediction_beta);
530  }
531  if(endcap && ringon){
532  meValidRing_->Fill(0.5);
533  meValidXRing_->Fill(prediction_x);
534  meValidYRing_->Fill(prediction_y);
535  meValidAlphaRing_->Fill(prediction_alpha);
536  meValidBetaRing_->Fill(prediction_beta);
537  }
538  }
539  else {
540  if(modon){
541  meMissing_->Fill(0.5);
542  }
543  if(barrel && ladon){
544  meMissingLad_->Fill(0.5);
545  meMissingXLad_->Fill(prediction_x);
546  meMissingYLad_->Fill(prediction_y);
547  meMissingModLad_->Fill(imod);
548  meMissingAlphaLad_->Fill(prediction_alpha);
549  meMissingBetaLad_->Fill(prediction_beta);
550  }
551  if(barrel && layon){
552  meMissingLay_->Fill(0.5);
553  meMissingXLay_->Fill(prediction_x);
554  meMissingYLay_->Fill(prediction_y);
555  meMissingAlphaLay_->Fill(prediction_alpha);
556  meMissingBetaLay_->Fill(prediction_beta);
557  }
558  if(barrel && phion){
559  meMissingPhi_->Fill(0.5);
560  meMissingXPhi_->Fill(prediction_x);
561  meMissingYPhi_->Fill(prediction_y);
562  meMissingAlphaPhi_->Fill(prediction_alpha);
563  meMissingBetaPhi_->Fill(prediction_beta);
564  }
565  if(endcap && bladeon){
566  meMissingBlade_->Fill(0.5);
567  meMissingXBlade_->Fill(prediction_x);
568  meMissingYBlade_->Fill(prediction_y);
569  meMissingAlphaBlade_->Fill(prediction_alpha);
570  meMissingBetaBlade_->Fill(prediction_beta);
571  }
572  if(endcap && diskon){
573  meMissingDisk_->Fill(0.5);
574  meMissingXDisk_->Fill(prediction_x);
575  meMissingYDisk_->Fill(prediction_y);
576  meMissingAlphaDisk_->Fill(prediction_alpha);
577  meMissingBetaDisk_->Fill(prediction_beta);
578  }
579  if(endcap && ringon){
580  meMissingRing_->Fill(0.5);
581  meMissingXRing_->Fill(prediction_x);
582  meMissingYRing_->Fill(prediction_y);
583  meMissingAlphaRing_->Fill(prediction_alpha);
584  meMissingBetaRing_->Fill(prediction_beta);
585  }
586  }
587 
589  computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
590 }
591 
592 void SiPixelHitEfficiencyModule::computeEfficiencies(bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
593 
594  if(debug_)
595  std::cout<<"Now Filling histos for detid "<<id_<<std::endl;
596 
597  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
598  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
599 
600  if(modon){
603  }
604  if(ladon && barrel){
607  for(int i=1;i<=meValidXLad_->getNbinsX();++i){
610  }
611  for(int i=1;i<=meValidYLad_->getNbinsX();++i){
614  }
615  for(int i=1;i<=meValidAlphaLad_->getNbinsX();++i){
618  }
619  for(int i=1;i<=meValidBetaLad_->getNbinsX();++i){
622  }
623  }
624 
625  if(layon && barrel){
628  for(int i=1;i<=meValidXLay_->getNbinsX();++i){
631  }
632  for(int i=1;i<=meValidYLay_->getNbinsX();++i){
635  }
636  for(int i=1;i<=meValidAlphaLay_->getNbinsX();++i){
639  }
640  for(int i=1;i<=meValidBetaLay_->getNbinsX();++i){
643  }
644  }
645 
646  if(phion && barrel){
649  for(int i=1;i<=meValidXPhi_->getNbinsX();++i){
652  }
653  for(int i=1;i<=meValidYPhi_->getNbinsX();++i){
656  }
657  for(int i=1;i<=meValidAlphaPhi_->getNbinsX();++i){
660  }
661  for(int i=1;i<=meValidBetaPhi_->getNbinsX();++i){
664  }
665  }
666  if(bladeon && endcap){
669  for(int i=1;i<=meValidXBlade_->getNbinsX();++i){
672  }
673  for(int i=1;i<=meValidYBlade_->getNbinsX();++i){
676  }
677  for(int i=1;i<=meValidAlphaBlade_->getNbinsX();++i){
680  }
681  for(int i=1;i<=meValidBetaBlade_->getNbinsX();++i){
684  }
685  }
686  if(diskon && endcap){
689  for(int i=1;i<=meValidXDisk_->getNbinsX();++i){
692  }
693  for(int i=1;i<=meValidYDisk_->getNbinsX();++i){
696  }
697  for(int i=1;i<=meValidAlphaDisk_->getNbinsX();++i){
700  }
701  for(int i=1;i<=meValidBetaDisk_->getNbinsX();++i){
704  }
705  }
706  if(ringon && endcap){
709  for(int i=1;i<=meValidXRing_->getNbinsX();++i){
712  }
713  for(int i=1;i<=meValidYRing_->getNbinsX();++i){
716  }
717  for(int i=1;i<=meValidAlphaRing_->getNbinsX();++i){
720  }
721  for(int i=1;i<=meValidBetaRing_->getNbinsX();++i){
724  }
725  }
726 
727 }
728 
729 std::pair<double,double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing){
730  double efficiency = 0, error = 0 ;
731  if(nValid+nMissing!=0){
732  efficiency=nValid/(nValid+nMissing);
733  error=sqrt(efficiency*(1.-efficiency)/(nValid+nMissing));
734  }
735  return make_pair(efficiency,error);
736 }
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
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
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:115
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
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:55
int layerName() const
layer id
T const * product() const
Definition: ESHandle.h:86
std::string const & label() const
Definition: InputTag.h:42
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
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)