CMS 3D CMS Logo

HcalNoiseInfoProducer.cc
Go to the documentation of this file.
2 
3 //
4 // HcalNoiseInfoProducer.cc
5 //
6 // description: Implementation of the producer for the HCAL noise information
7 //
8 // author: J.P. Chou, Brown
9 //
10 //
11 
19 
20 using namespace reco;
21 
22 //
23 // constructors and destructor
24 //
25 
27  // set the parameters
28  fillDigis_ = iConfig.getParameter<bool>("fillDigis");
29  fillRecHits_ = iConfig.getParameter<bool>("fillRecHits");
30  fillCaloTowers_ = iConfig.getParameter<bool>("fillCaloTowers");
31  fillTracks_ = iConfig.getParameter<bool>("fillTracks");
32  fillLaserMonitor_ = iConfig.getParameter<bool>("fillLaserMonitor");
33 
34  maxProblemRBXs_ = iConfig.getParameter<int>("maxProblemRBXs");
35 
36  maxCaloTowerIEta_ = iConfig.getParameter<int>("maxCaloTowerIEta");
37  maxTrackEta_ = iConfig.getParameter<double>("maxTrackEta");
38  minTrackPt_ = iConfig.getParameter<double>("minTrackPt");
39 
40  digiCollName_ = iConfig.getParameter<std::string>("digiCollName");
41  recHitCollName_ = iConfig.getParameter<std::string>("recHitCollName");
42  caloTowerCollName_ = iConfig.getParameter<std::string>("caloTowerCollName");
43  trackCollName_ = iConfig.getParameter<std::string>("trackCollName");
44 
45  jetCollName_ = iConfig.getParameter<std::string>("jetCollName");
46  maxNHF_ = iConfig.getParameter<double>("maxNHF");
47  maxjetindex_ = iConfig.getParameter<int>("maxjetindex");
48  jet_token_ = consumes<reco::PFJetCollection>(edm::InputTag(jetCollName_));
49 
50  minRecHitE_ = iConfig.getParameter<double>("minRecHitE");
51  minLowHitE_ = iConfig.getParameter<double>("minLowHitE");
52  minHighHitE_ = iConfig.getParameter<double>("minHighHitE");
53 
54  minR45HitE_ = iConfig.getParameter<double>("minR45HitE");
55 
56  HcalAcceptSeverityLevel_ = iConfig.getParameter<uint32_t>("HcalAcceptSeverityLevel");
57  HcalRecHitFlagsToBeExcluded_ = iConfig.getParameter<std::vector<int>>("HcalRecHitFlagsToBeExcluded");
58 
59  // Digi threshold and time slices to use for HBHE and HF calibration digis
61  calibdigiHBHEtimeslices_ = std::vector<int>();
63  calibdigiHFtimeslices_ = std::vector<int>();
64 
65  calibdigiHBHEthreshold_ = iConfig.getParameter<double>("calibdigiHBHEthreshold");
66  calibdigiHBHEtimeslices_ = iConfig.getParameter<std::vector<int>>("calibdigiHBHEtimeslices");
67  calibdigiHFthreshold_ = iConfig.getParameter<double>("calibdigiHFthreshold");
68  calibdigiHFtimeslices_ = iConfig.getParameter<std::vector<int>>("calibdigiHFtimeslices");
69 
70  TS4TS5EnergyThreshold_ = iConfig.getParameter<double>("TS4TS5EnergyThreshold");
71 
72  std::vector<double> TS4TS5UpperThresholdTemp = iConfig.getParameter<std::vector<double>>("TS4TS5UpperThreshold");
73  std::vector<double> TS4TS5UpperCutTemp = iConfig.getParameter<std::vector<double>>("TS4TS5UpperCut");
74  std::vector<double> TS4TS5LowerThresholdTemp = iConfig.getParameter<std::vector<double>>("TS4TS5LowerThreshold");
75  std::vector<double> TS4TS5LowerCutTemp = iConfig.getParameter<std::vector<double>>("TS4TS5LowerCut");
76 
77  for (int i = 0; i < (int)TS4TS5UpperThresholdTemp.size() && i < (int)TS4TS5UpperCutTemp.size(); i++)
78  TS4TS5UpperCut_.push_back(std::pair<double, double>(TS4TS5UpperThresholdTemp[i], TS4TS5UpperCutTemp[i]));
79  sort(TS4TS5UpperCut_.begin(), TS4TS5UpperCut_.end());
80 
81  for (int i = 0; i < (int)TS4TS5LowerThresholdTemp.size() && i < (int)TS4TS5LowerCutTemp.size(); i++)
82  TS4TS5LowerCut_.push_back(std::pair<double, double>(TS4TS5LowerThresholdTemp[i], TS4TS5LowerCutTemp[i]));
83  sort(TS4TS5LowerCut_.begin(), TS4TS5LowerCut_.end());
84 
85  // if digis are filled, then rechits must also be filled
86  if (fillDigis_ && !fillRecHits_) {
87  fillRecHits_ = true;
88  edm::LogWarning("HCalNoiseInfoProducer") << " forcing fillRecHits to be true if fillDigis is true.\n";
89  }
90 
91  // get the fiber configuration vectors
92  laserMonCBoxList_ = iConfig.getParameter<std::vector<int>>("laserMonCBoxList");
93  laserMonIPhiList_ = iConfig.getParameter<std::vector<int>>("laserMonIPhiList");
94  laserMonIEtaList_ = iConfig.getParameter<std::vector<int>>("laserMonIEtaList");
95 
96  // check that the vectors have the same size, if not
97  // disable the laser monitor
98  if (!((laserMonCBoxList_.size() == laserMonIEtaList_.size()) &&
99  (laserMonCBoxList_.size() == laserMonIPhiList_.size()))) {
100  edm::LogWarning("MisConfiguration") << "Must provide equally sized lists for laserMonCBoxList, laserMonIEtaList, "
101  "and laserMonIPhiList. Will not fill LaserMon\n";
102  fillLaserMonitor_ = false;
103  }
104 
105  // get the integration region with defaults
106  laserMonitorTSStart_ = iConfig.getParameter<int>("laserMonTSStart");
107  laserMonitorTSEnd_ = iConfig.getParameter<int>("laserMonTSEnd");
108  laserMonitorSamples_ = iConfig.getParameter<unsigned>("laserMonSamples");
109 
110  adc2fC = std::vector<float>{
111  -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5,
112  12.5, 13.5, 15., 17., 19., 21., 23., 25., 27., 29.5, 32.5, 35.5, 38.5,
113  42., 46., 50., 54.5, 59.5, 64.5, 59.5, 64.5, 69.5, 74.5, 79.5, 84.5, 89.5,
114  94.5, 99.5, 104.5, 109.5, 114.5, 119.5, 124.5, 129.5, 137., 147., 157., 167., 177.,
115  187., 197., 209.5, 224.5, 239.5, 254.5, 272., 292., 312., 334.5, 359.5, 384.5, 359.5,
116  384.5, 409.5, 434.5, 459.5, 484.5, 509.5, 534.5, 559.5, 584.5, 609.5, 634.5, 659.5, 684.5,
117  709.5, 747., 797., 847., 897., 947., 997., 1047., 1109.5, 1184.5, 1259.5, 1334.5, 1422.,
118  1522., 1622., 1734.5, 1859.5, 1984.5, 1859.5, 1984.5, 2109.5, 2234.5, 2359.5, 2484.5, 2609.5, 2734.5,
119  2859.5, 2984.5, 3109.5, 3234.5, 3359.5, 3484.5, 3609.5, 3797., 4047., 4297., 4547., 4797., 5047.,
120  5297., 5609.5, 5984.5, 6359.5, 6734.5, 7172., 7672., 8172., 8734.5, 9359.5, 9984.5};
121 
122  // adc -> fC for qie10, for laser monitor
123  // Taken from page 3 in
124  // https://cms-docdb.cern.ch/cgi-bin/DocDB/RetrieveFile?docid=12570&filename=QIE10_final.pdf&version=5
125  adc2fCHF = std::vector<float>{// - - - - - - - range 0 - - - - - - - -
126  //subrange0
127  1.58,
128  4.73,
129  7.88,
130  11.0,
131  14.2,
132  17.3,
133  20.5,
134  23.6,
135  26.8,
136  29.9,
137  33.1,
138  36.2,
139  39.4,
140  42.5,
141  45.7,
142  48.8,
143  //subrange1
144  53.6,
145  60.1,
146  66.6,
147  73.0,
148  79.5,
149  86.0,
150  92.5,
151  98.9,
152  105,
153  112,
154  118,
155  125,
156  131,
157  138,
158  144,
159  151,
160  //subrange2
161  157,
162  164,
163  170,
164  177,
165  186,
166  199,
167  212,
168  225,
169  238,
170  251,
171  264,
172  277,
173  289,
174  302,
175  315,
176  328,
177  //subrange3
178  341,
179  354,
180  367,
181  380,
182  393,
183  406,
184  418,
185  431,
186  444,
187  464,
188  490,
189  516,
190  542,
191  568,
192  594,
193  620,
194 
195  // - - - - - - - range 1 - - - - - - - -
196  //subrange0
197  569,
198  594,
199  619,
200  645,
201  670,
202  695,
203  720,
204  745,
205  771,
206  796,
207  821,
208  846,
209  871,
210  897,
211  922,
212  947,
213  //subrange1
214  960,
215  1010,
216  1060,
217  1120,
218  1170,
219  1220,
220  1270,
221  1320,
222  1370,
223  1430,
224  1480,
225  1530,
226  1580,
227  1630,
228  1690,
229  1740,
230  //subrange2
231  1790,
232  1840,
233  1890,
234  1940,
235  2020,
236  2120,
237  2230,
238  2330,
239  2430,
240  2540,
241  2640,
242  2740,
243  2850,
244  2950,
245  3050,
246  3150,
247  //subrange3
248  3260,
249  3360,
250  3460,
251  3570,
252  3670,
253  3770,
254  3880,
255  3980,
256  4080,
257  4240,
258  4450,
259  4650,
260  4860,
261  5070,
262  5280,
263  5490,
264 
265  // - - - - - - - range 2 - - - - - - - -
266  //subrange0
267  5080,
268  5280,
269  5480,
270  5680,
271  5880,
272  6080,
273  6280,
274  6480,
275  6680,
276  6890,
277  7090,
278  7290,
279  7490,
280  7690,
281  7890,
282  8090,
283  //subrange1
284  8400,
285  8810,
286  9220,
287  9630,
288  10000,
289  10400,
290  10900,
291  11300,
292  11700,
293  12100,
294  12500,
295  12900,
296  13300,
297  13700,
298  14100,
299  14500,
300  //subrange2
301  15000,
302  15400,
303  15800,
304  16200,
305  16800,
306  17600,
307  18400,
308  19300,
309  20100,
310  20900,
311  21700,
312  22500,
313  23400,
314  24200,
315  25000,
316  25800,
317  //subrange3
318  26600,
319  27500,
320  28300,
321  29100,
322  29900,
323  30700,
324  31600,
325  32400,
326  33200,
327  34400,
328  36100,
329  37700,
330  39400,
331  41000,
332  42700,
333  44300,
334 
335  // - - - - - - - range 3 - - - - - - - - -
336  //subrange0
337  41100,
338  42700,
339  44300,
340  45900,
341  47600,
342  49200,
343  50800,
344  52500,
345  54100,
346  55700,
347  57400,
348  59000,
349  60600,
350  62200,
351  63900,
352  65500,
353  //subrange1
354  68000,
355  71300,
356  74700,
357  78000,
358  81400,
359  84700,
360  88000,
361  91400,
362  94700,
363  98100,
364  101000,
365  105000,
366  108000,
367  111000,
368  115000,
369  118000,
370  //subrange2
371  121000,
372  125000,
373  128000,
374  131000,
375  137000,
376  145000,
377  152000,
378  160000,
379  168000,
380  176000,
381  183000,
382  191000,
383  199000,
384  206000,
385  214000,
386  222000,
387  //subrange3
388  230000,
389  237000,
390  245000,
391  253000,
392  261000,
393  268000,
394  276000,
395  284000,
396  291000,
397  302000,
398  316000,
399  329000,
400  343000,
401  356000,
402  370000,
403  384000};
404 
405  hbhedigi_token_ = consumes<HBHEDigiCollection>(edm::InputTag(digiCollName_));
406  hcalcalibdigi_token_ = consumes<HcalCalibDigiCollection>(edm::InputTag("hcalDigis"));
407  lasermondigi_token_ = consumes<QIE10DigiCollection>(iConfig.getParameter<edm::InputTag>("lasermonDigis"));
408  hbherechit_token_ = consumes<HBHERecHitCollection>(edm::InputTag(recHitCollName_));
409  calotower_token_ = consumes<CaloTowerCollection>(edm::InputTag(caloTowerCollName_));
410  track_token_ = consumes<reco::TrackCollection>(edm::InputTag(trackCollName_));
411  hcaltopo_token_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
412  service_token_ = esConsumes<HcalDbService, HcalDbRecord>();
413  quality_token_ = esConsumes<HcalChannelQuality, HcalChannelQualityRcd>(edm::ESInputTag("", "withTopo"));
414  severitycomputer_token_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
415  calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
416 
417  // we produce a vector of HcalNoiseRBXs
418  produces<HcalNoiseRBXCollection>();
419  // we also produce a noise summary
420  produces<HcalNoiseSummary>();
421 }
422 
424 
427  // define hit energy thesholds
428  desc.add<double>("minRecHitE", 1.5);
429  desc.add<double>("minLowHitE", 10.0);
430  desc.add<double>("minHighHitE", 25.0);
431  desc.add<double>("minR45HitE", 5.0);
432 
433  // define energy threshold for "problematic" cuts
434  desc.add<double>("pMinERatio", 25.0);
435  desc.add<double>("pMinEZeros", 5.0);
436  desc.add<double>("pMinEEMF", 10.0);
437 
438  // define energy threshold for loose/tight/high level cuts
439  desc.add<double>("minERatio", 50.0);
440  desc.add<double>("minEZeros", 10.0);
441  desc.add<double>("minEEMF", 50.0);
442 
443  // define problematic RBX
444  desc.add<double>("pMinE", 40.0);
445  desc.add<double>("pMinRatio", 0.75);
446  desc.add<double>("pMaxRatio", 0.85);
447  desc.add<int>("pMinHPDHits", 10);
448  desc.add<int>("pMinRBXHits", 20);
449  desc.add<int>("pMinHPDNoOtherHits", 7);
450  desc.add<int>("pMinZeros", 4);
451  desc.add<double>("pMinLowEHitTime", -6.0);
452  desc.add<double>("pMaxLowEHitTime", 6.0);
453  desc.add<double>("pMinHighEHitTime", -4.0);
454  desc.add<double>("pMaxHighEHitTime", 5.0);
455  desc.add<double>("pMaxHPDEMF", -0.02);
456  desc.add<double>("pMaxRBXEMF", 0.02);
457  desc.add<int>("pMinRBXRechitR45Count", 1);
458  desc.add<double>("pMinRBXRechitR45Fraction", 0.1);
459  desc.add<double>("pMinRBXRechitR45EnergyFraction", 0.1);
460 
461  // define loose noise cuts
462  desc.add<double>("lMinRatio", -999.0);
463  desc.add<double>("lMaxRatio", 999.0);
464  desc.add<int>("lMinHPDHits", 17);
465  desc.add<int>("lMinRBXHits", 999);
466  desc.add<int>("lMinHPDNoOtherHits", 10);
467  desc.add<int>("lMinZeros", 10);
468  desc.add<double>("lMinLowEHitTime", -9999.0);
469  desc.add<double>("lMaxLowEHitTime", 9999.0);
470  desc.add<double>("lMinHighEHitTime", -9999.0);
471  desc.add<double>("lMaxHighEHitTime", 9999.0);
472 
473  // define tight noise cuts
474  desc.add<double>("tMinRatio", -999.0);
475  desc.add<double>("tMaxRatio", 999.0);
476  desc.add<int>("tMinHPDHits", 16);
477  desc.add<int>("tMinRBXHits", 50);
478  desc.add<int>("tMinHPDNoOtherHits", 9);
479  desc.add<int>("tMinZeros", 8);
480  desc.add<double>("tMinLowEHitTime", -9999.0);
481  desc.add<double>("tMaxLowEHitTime", 9999.0);
482  desc.add<double>("tMinHighEHitTime", -7.0);
483  desc.add<double>("tMaxHighEHitTime", 6.0);
484 
485  // define high level noise cuts
486  desc.add<double>("hlMaxHPDEMF", -9999.0);
487  desc.add<double>("hlMaxRBXEMF", 0.01);
488 
489  // Calibration digi noise variables (used for finding laser noise events)
490  desc.add<double>("calibdigiHBHEthreshold", 15)
491  ->setComment(
492  "minimum threshold in fC of any HBHE \
493  calib digi to be counted in summary");
494  desc.add<std::vector<int>>("calibdigiHBHEtimeslices",
495  {
496  3,
497  4,
498  5,
499  6,
500  })
501  ->setComment("time slices to use when determining charge of HBHE calib digis");
502  desc.add<double>("calibdigiHFthreshold", -999)
503  ->setComment("minimum threshold in fC of any HF calib digi to be counted in summary");
504  desc.add<std::vector<int>>("calibdigiHFtimeslices",
505  {
506  0,
507  1,
508  2,
509  3,
510  4,
511  5,
512  6,
513  7,
514  8,
515  9,
516  })
517  ->setComment("time slices to use when determining charge of HF calib digis");
518 
519  // RBX-wide TS4TS5 variable
520  desc.add<double>("TS4TS5EnergyThreshold", 50);
521  desc.add<std::vector<double>>("TS4TS5UpperThreshold",
522  {
523  70,
524  90,
525  100,
526  400,
527  4000,
528  });
529  desc.add<std::vector<double>>("TS4TS5UpperCut",
530  {
531  1,
532  0.8,
533  0.75,
534  0.72,
535  0.72,
536  });
537  desc.add<std::vector<double>>("TS4TS5LowerThreshold",
538  {
539  100,
540  120,
541  150,
542  200,
543  300,
544  400,
545  500,
546  });
547  desc.add<std::vector<double>>("TS4TS5LowerCut",
548  {
549  -1,
550  -0.7,
551  -0.4,
552  -0.2,
553  -0.08,
554  0,
555  0.1,
556  });
557 
558  // rechit R45 population filter variables
559  // this comes in groups of four: (a_Count, a_Fraction, a_EnergyFraction, const)
560  // flag as noise if (count * a_count + fraction * a_fraction + energyfraction * a_energyfraction + const) > 0
561  desc.add<std::vector<double>>("lRBXRecHitR45Cuts",
562  {
563  0.0,
564  1.0,
565  0.0,
566  -0.5,
567  0.0,
568  0.0,
569  1.0,
570  -0.5,
571  })
572  ->setComment(
573  "first 4 entries : equivalent to 'fraction > 0.5' \
574  last 4 entries : equivalent to 'energy fraction > 0.5'");
575  desc.add<std::vector<double>>("tRBXRecHitR45Cuts",
576  {
577  0.0,
578  1.0,
579  0.0,
580  -0.2,
581  0.0,
582  0.0,
583  1.0,
584  -0.2,
585  })
586  ->setComment(
587  "first 4 entries : equivalent to 'fraction > 0.2' \
588  last 4 entries : equivalent to 'energy fraction > 0.2'");
589 
590  // define the channels used for laser monitoring
591  // note that the order here indicates the time order
592  // of the channels
593  desc.add<std::vector<int>>("laserMonCBoxList",
594  {
595  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
596  })
597  ->setComment("time ordered list of the cBox values of laser monitor channels");
598  desc.add<std::vector<int>>("laserMonIPhiList",
599  {23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0})
600  ->setComment("time ordered list of the iPhi values of laser monitor channels");
601  desc.add<std::vector<int>>("laserMonIEtaList",
602  {
603  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
604  })
605  ->setComment("time ordered list of the iEta values of laser monitor channels");
606 
607  // boundaries for total charge integration
608  desc.add<int>("laserMonTSStart", 0)->setComment("lower bound of laser monitor charge integration window");
609  desc.add<int>("laserMonTSEnd", -1)
610  ->setComment("upper bound of laser monitor charge integration window (-1 = no bound)");
611  desc.add<unsigned>("laserMonSamples", 4)->setComment("Number of laser monitor samples to take per channel");
612 
613  // what to fill
614  desc.add<bool>("fillDigis", true);
615  desc.add<bool>("fillRecHits", true);
616  desc.add<bool>("fillCaloTowers", true);
617  desc.add<bool>("fillTracks", true);
618  desc.add<bool>("fillLaserMonitor", true);
619 
620  // maximum number of RBXs to fill
621  // if you want to record all RBXs above some energy threshold,
622  // change maxProblemRBXs to 999 and pMinE (above) to the threshold you want
623  desc.add<int>("maxProblemRBXs", 72)
624  ->setComment(
625  "maximum number of RBXs to fill. if you want to record \
626  all RBXs above some energy threshold,change maxProblemRBXs to \
627  999 and pMinE (above) to the threshold you want");
628  ;
629 
630  // parameters for calculating summary variables
631  desc.add<int>("maxCaloTowerIEta", 20);
632  desc.add<double>("maxTrackEta", 2.0);
633  desc.add<double>("minTrackPt", 1.0);
634  desc.add<double>("maxNHF", 0.9);
635  desc.add<int>("maxjetindex", 0);
636 
637  // collection names
638  desc.add<std::string>("digiCollName", "hcalDigis");
639  desc.add<std::string>("recHitCollName", "hbhereco");
640  desc.add<std::string>("caloTowerCollName", "towerMaker");
641  desc.add<std::string>("trackCollName", "generalTracks");
642  desc.add<std::string>("jetCollName", "ak4PFJets");
643  desc.add<edm::InputTag>("lasermonDigis", edm::InputTag("hcalDigis", "LASERMON"));
644 
645  // severity level
646  desc.add<unsigned int>("HcalAcceptSeverityLevel", 9);
647 
648  // which hcal calo flags to mask
649  // (HBHEIsolatedNoise=11, HBHEFlatNoise=12, HBHESpikeNoise=13,
650  // HBHETriangleNoise=14, HBHETS4TS5Noise=15, HBHENegativeNoise=27)
651  desc.add<std::vector<int>>("HcalRecHitFlagsToBeExcluded",
652  {
653  11,
654  12,
655  13,
656  14,
657  15,
658  27,
659  })
660  ->setComment(
661  "which hcal calo flags to mask (HBHEIsolatedNoise=11, \
662  HBHEFlatNoise=12, HBHESpikeNoise=13, \
663  HBHETriangleNoise=14, HBHETS4TS5Noise=15, HBHENegativeNoise=27)");
664  ;
665 
666  descriptions.add("hcalnoise", desc);
667 }
668 
669 //
670 // member functions
671 //
672 
673 // ------------ method called to produce the data ------------
675  // this is what we're going to actually write to the EDM
676  auto result1 = std::make_unique<HcalNoiseRBXCollection>();
677  auto result2 = std::make_unique<HcalNoiseSummary>();
678 
679  // define an empty HcalNoiseRBXArray that we're going to fill
680  HcalNoiseRBXArray rbxarray;
681  HcalNoiseSummary& summary = *result2;
682 
683  // Get topology class to use later
685  theHcalTopology_ = topo.product();
686 
687  // fill them with the various components
688  // digi assumes that rechit information is available
689  if (fillRecHits_)
690  fillrechits(iEvent, iSetup, rbxarray, summary);
691  if (fillDigis_)
692  filldigis(iEvent, iSetup, rbxarray, summary);
693  if (fillCaloTowers_)
694  fillcalotwrs(iEvent, iSetup, rbxarray, summary);
695  if (fillTracks_)
696  filltracks(iEvent, iSetup, summary);
697 
698  filljetinfo(iEvent, iSetup, summary);
699 
700  // select those RBXs which are interesting
701  // also look for the highest energy RBX
702  HcalNoiseRBXArray::iterator maxit = rbxarray.begin();
703  double maxenergy = -999;
704  bool maxwritten = false;
705  for (HcalNoiseRBXArray::iterator rit = rbxarray.begin(); rit != rbxarray.end(); ++rit) {
706  HcalNoiseRBX& rbx = (*rit);
708  minRecHitE_,
709  minLowHitE_,
710  minHighHitE_,
714  minR45HitE_);
715 
716  // find the highest energy rbx
717  if (data.energy() > maxenergy) {
718  maxenergy = data.energy();
719  maxit = rit;
720  maxwritten = false;
721  }
722 
723  // find out if the rbx is problematic/noisy/etc.
724  bool writerbx = algo_.isProblematic(data) || !algo_.passLooseNoiseFilter(data) ||
726 
727  // fill variables in the summary object not filled elsewhere
729 
730  if (writerbx) {
731  summary.nproblemRBXs_++;
732  if (summary.nproblemRBXs_ <= maxProblemRBXs_) {
733  result1->push_back(rbx);
734  if (maxit == rit)
735  maxwritten = true;
736  }
737  }
738  } // end loop over rbxs
739 
740  // if we still haven't written the maximum energy rbx, write it now
741  if (!maxwritten) {
742  HcalNoiseRBX& rbx = (*maxit);
743 
744  // add the RBX to the event
745  result1->push_back(rbx);
746  }
747 
748  // put the rbxcollection and summary into the EDM
749  iEvent.put(std::move(result1));
750  iEvent.put(std::move(result2));
751 
752  return;
753 }
754 
755 // ------------ here we fill specific variables in the summary object not already accounted for earlier
757  const CommonHcalNoiseRBXData& data) const {
758  // charge ratio
759  if (algo_.passRatioThreshold(data) && data.validRatio()) {
760  if (data.ratio() < summary.minE2Over10TS()) {
761  summary.mine2ts_ = data.e2ts();
762  summary.mine10ts_ = data.e10ts();
763  }
764  if (data.ratio() > summary.maxE2Over10TS()) {
765  summary.maxe2ts_ = data.e2ts();
766  summary.maxe10ts_ = data.e10ts();
767  }
768  }
769 
770  // ADC zeros
772  if (data.numZeros() > summary.maxZeros()) {
773  summary.maxzeros_ = data.numZeros();
774  }
775  }
776 
777  // hits count
778  if (data.numHPDHits() > summary.maxHPDHits()) {
779  summary.maxhpdhits_ = data.numHPDHits();
780  }
781  if (data.numRBXHits() > summary.maxRBXHits()) {
782  summary.maxrbxhits_ = data.numRBXHits();
783  }
784  if (data.numHPDNoOtherHits() > summary.maxHPDNoOtherHits()) {
785  summary.maxhpdhitsnoother_ = data.numHPDNoOtherHits();
786  }
787 
788  // TS4TS5
789  if (data.PassTS4TS5() == false)
790  summary.hasBadRBXTS4TS5_ = true;
791 
792  if (algo_.passLooseRBXRechitR45(data) == false)
793  summary.hasBadRBXRechitR45Loose_ = true;
794  if (algo_.passTightRBXRechitR45(data) == false)
795  summary.hasBadRBXRechitR45Tight_ = true;
796 
797  // hit timing
798  if (data.minLowEHitTime() < summary.min10GeVHitTime()) {
799  summary.min10_ = data.minLowEHitTime();
800  }
801  if (data.maxLowEHitTime() > summary.max10GeVHitTime()) {
802  summary.max10_ = data.maxLowEHitTime();
803  }
804  summary.rms10_ += data.lowEHitTimeSqrd();
805  summary.cnthit10_ += data.numLowEHits();
806  if (data.minHighEHitTime() < summary.min25GeVHitTime()) {
807  summary.min25_ = data.minHighEHitTime();
808  }
809  if (data.maxHighEHitTime() > summary.max25GeVHitTime()) {
810  summary.max25_ = data.maxHighEHitTime();
811  }
812  summary.rms25_ += data.highEHitTimeSqrd();
813  summary.cnthit25_ += data.numHighEHits();
814 
815  // EMF
816  if (algo_.passEMFThreshold(data)) {
817  if (summary.minHPDEMF() > data.HPDEMF()) {
818  summary.minhpdemf_ = data.HPDEMF();
819  }
820  if (summary.minRBXEMF() > data.RBXEMF()) {
821  summary.minrbxemf_ = data.RBXEMF();
822  }
823  }
824 
825  // summary flag
826  if (!algo_.passLooseRatio(data))
827  summary.filterstatus_ |= 0x1;
829  summary.filterstatus_ |= 0x2;
831  summary.filterstatus_ |= 0x4;
833  summary.filterstatus_ |= 0x8;
834 
836  summary.filterstatus_ |= 0x100;
838  summary.filterstatus_ |= 0x200;
840  summary.filterstatus_ |= 0x400;
842  summary.filterstatus_ |= 0x800;
843 
845  summary.filterstatus_ |= 0x10000;
846 
847  // summary refvectors
850  join(summary.loosenoisetwrs_, data.rbxTowers());
852  join(summary.tightnoisetwrs_, data.rbxTowers());
854  join(summary.hlnoisetwrs_, data.rbxTowers());
855 
856  return;
857 }
858 
859 // ------------ fill the array with digi information
861  const edm::EventSetup& iSetup,
864  // Some initialization
865  totalCalibCharge = 0;
866  totalLasmonCharge = 0;
867 
868  // Starting with this version (updated by Jeff Temple on Dec. 6, 2012), the "TS45" names in the variables are mis-nomers. The actual time slices used are determined from the digiTimeSlices_ variable, which may not be limited to only time slices 4 and 5. For now, "TS45" name kept, because that is what is used in HcalNoiseSummary object (in GetCalibCountTS45, etc.). Likewise, the charge value in 'gt15' is now configurable, though the name remains the same. For HBHE, we track both the number of calibration channels (NcalibTS45) and the number of calibration channels above threshold (NcalibTS45gt15). For HF, we track only the number of channels above the given threshold in the given time window (NcalibHFgtX). Default for HF in 2012 is to use the full time sample with effectively no threshold (threshold=-999)
869  int NcalibTS45 = 0;
870  int NcalibTS45gt15 = 0;
871  int NcalibHFgtX = 0;
872 
873  double chargecalibTS45 = 0;
874  double chargecalibgt15TS45 = 0;
875 
876  // get the conditions and channel quality
879  const HcalChannelQuality* myqual = qualhandle.product();
881  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
882 
883  // get the digis
885  // iEvent.getByLabel(digiCollName_, handle);
886  iEvent.getByToken(hbhedigi_token_, handle);
887 
888  if (!handle.isValid()) {
890  << " could not find HBHEDigiCollection named " << digiCollName_ << "\n.";
891  return;
892  }
893 
894  // loop over all of the digi information
895  for (HBHEDigiCollection::const_iterator it = handle->begin(); it != handle->end(); ++it) {
896  const HBHEDataFrame& digi = (*it);
897  HcalDetId cell = digi.id();
898  DetId detcell = (DetId)cell;
899 
900  // check on cells to be ignored and dropped
901  const HcalChannelStatus* mydigistatus = myqual->getValues(detcell.rawId());
902  if (mySeverity->dropChannel(mydigistatus->getValue()))
903  continue;
904  if (digi.zsMarkAndPass())
905  continue;
906  // Drop if exclude bit set
908  continue;
909 
910  // get the calibrations and coder
911  const HcalCalibrations& calibrations = conditions->getHcalCalibrations(cell);
912  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
913  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
914  HcalCoderDb coder(*channelCoder, *shape);
915 
916  // match the digi to an rbx and hpd
917  HcalNoiseRBX& rbx = (*array.findRBX(digi));
918  HcalNoiseHPD& hpd = (*array.findHPD(digi));
919 
920  // determine if the digi is one the highest energy hits in the HPD
921  // this works because the rechits are sorted by energy (see fillrechits() below)
922  bool isBig = false, isBig5 = false, isRBX = false;
923  int counter = 0;
926  ++rit, ++counter) {
927  const HcalDetId& detid = (*rit)->idFront();
928  if (DetId(detid) == digi.id()) {
929  if (counter == 0)
930  isBig = isBig5 = true; // digi is also the highest energy rechit
931  if (counter < 5)
932  isBig5 = true; // digi is one of 5 highest energy rechits
933  isRBX = true;
934  }
935  }
936 
937  // loop over each of the digi's time slices
938  int totalzeros = 0;
939  CaloSamples tool;
940  coder.adc2fC(digi, tool);
941  for (int ts = 0; ts < tool.size(); ++ts) {
942  // count zero's
943  if (digi[ts].adc() == 0) {
944  ++hpd.totalZeros_;
945  ++totalzeros;
946  }
947 
948  // get the fC's
949  double corrfc = tool[ts] - calibrations.pedestal(digi[ts].capid());
950 
951  // fill the relevant digi arrays
952  if (isBig)
953  hpd.bigCharge_[ts] += corrfc;
954  if (isBig5)
955  hpd.big5Charge_[ts] += corrfc;
956  if (isRBX)
957  rbx.allCharge_[ts] += corrfc;
958  }
959 
960  // record the maximum number of zero's found
961  if (totalzeros > hpd.maxZeros_)
962  hpd.maxZeros_ = totalzeros;
963  }
964 
965  // get the calibration digis
967  // iEvent.getByLabel("hcalDigis", hCalib);
968  iEvent.getByToken(hcalcalibdigi_token_, hCalib);
969 
970  // get the lasermon digis
972  iEvent.getByToken(lasermondigi_token_, hLasermon);
973 
974  // get total charge in calibration channels
975  if (hCalib.isValid() == true) {
976  for (HcalCalibDigiCollection::const_iterator digi = hCalib->begin(); digi != hCalib->end(); digi++) {
977  if (digi->id().hcalSubdet() == 0)
978  continue;
979 
980  for (unsigned i = 0; i < (unsigned)digi->size(); i++)
981  totalCalibCharge = totalCalibCharge + adc2fC[digi->sample(i).adc() & 0xff];
982 
983  HcalCalibDetId myid = (HcalCalibDetId)digi->id();
985  continue; // ignore HOCrosstalk channels
986  if (digi->zsMarkAndPass())
987  continue; // skip "mark-and-pass" channels when computing charge in calib channels
988 
989  if (digi->id().hcalSubdet() == HcalForward) // check HF
990  {
991  double sumChargeHF = 0;
992  for (unsigned int i = 0; i < calibdigiHFtimeslices_.size(); ++i) {
993  // skip unphysical time slices
994  if (calibdigiHFtimeslices_[i] < 0 || calibdigiHFtimeslices_[i] > digi->size())
995  continue;
996  sumChargeHF += adc2fC[digi->sample(calibdigiHFtimeslices_[i]).adc() & 0xff];
997  }
998  if (sumChargeHF > calibdigiHFthreshold_)
999  ++NcalibHFgtX;
1000  } // end of HF check
1001  else if (digi->id().hcalSubdet() == HcalBarrel || digi->id().hcalSubdet() == HcalEndcap) // now check HBHE
1002  {
1003  double sumChargeHBHE = 0;
1004  for (unsigned int i = 0; i < calibdigiHBHEtimeslices_.size(); ++i) {
1005  // skip unphysical time slices
1006  if (calibdigiHBHEtimeslices_[i] < 0 || calibdigiHBHEtimeslices_[i] > digi->size())
1007  continue;
1008  sumChargeHBHE += adc2fC[digi->sample(calibdigiHBHEtimeslices_[i]).adc() & 0xff];
1009  }
1010  ++NcalibTS45;
1011  chargecalibTS45 += sumChargeHBHE;
1012  if (sumChargeHBHE > calibdigiHBHEthreshold_) {
1013  ++NcalibTS45gt15;
1014  chargecalibgt15TS45 += sumChargeHBHE;
1015  }
1016  } // end of HBHE check
1017  } // loop on HcalCalibDigiCollection
1018 
1019  } // if (hCalib.isValid()==true)
1020  if (fillLaserMonitor_ && (hLasermon.isValid() == true)) {
1021  int icombts = -1;
1022  float max_charge = 0;
1023  int max_ts = -1;
1024  std::vector<float> comb_charge;
1025 
1026  unsigned nch = laserMonCBoxList_.size();
1027  // loop over channels in the order provided
1028  for (unsigned ich = 0; ich < nch; ++ich) {
1029  int cboxch = laserMonCBoxList_[ich];
1030  int iphi = laserMonIPhiList_[ich];
1031  int ieta = laserMonIEtaList_[ich];
1032 
1033  // loop over digis, find the digi that matches this channel
1034  for (const QIE10DataFrame df : (*hLasermon)) {
1035  HcalCalibDetId calibId(df.id());
1036 
1037  int ch_cboxch = calibId.cboxChannel();
1038  int ch_iphi = calibId.iphi();
1039  int ch_ieta = calibId.ieta();
1040 
1041  if (cboxch == ch_cboxch && iphi == ch_iphi && ieta == ch_ieta) {
1042  unsigned ts_size = df.samples();
1043 
1044  // loop over time slices
1045  for (unsigned its = 0; its < ts_size; ++its) {
1046  // if we are on the last channel, use all the data
1047  // otherwise only take the unique samples
1048  if (((ich + 1) < nch) && its >= laserMonitorSamples_)
1049  continue;
1050 
1051  bool ok = df[its].ok();
1052  int adc = df[its].adc();
1053 
1054  icombts++;
1055  // apply integration limits
1056  if (icombts < laserMonitorTSStart_)
1057  continue;
1058  if (laserMonitorTSEnd_ > 0 && icombts > laserMonitorTSEnd_)
1059  continue;
1060 
1061  if (ok && adc >= 0) { // protection against QIE reset or bad ADC values
1062 
1063  float charge = adc2fCHF[adc];
1064  if (charge > max_charge) {
1065  max_charge = charge;
1066  max_ts = icombts;
1067  }
1068 
1069  comb_charge.push_back(charge);
1070  } // if( ok && adc >= 0 )
1071  } // loop over time slices
1072  } // if( cboxch == ch_cboxch && iphi == ch_iphi && ieta == ch_ieta )
1073  } // loop over digi collection
1074  } // loop over channel list
1075 
1076  // do not continue with the calculation
1077  // if the vector was not filled
1078  if (comb_charge.empty()) {
1079  totalLasmonCharge = -1;
1080  } else {
1081  // integrate from +- 3 TS around the time sample
1082  // having the maximum charge
1083  int start_ts = max_ts - 3;
1084  int end_ts = max_ts + 3;
1085 
1086  // Change the integration limits
1087  // if outside of the range
1088  if (start_ts < 0)
1089  start_ts = 0;
1090  if (end_ts >= int(comb_charge.size()))
1091  end_ts = comb_charge.size() - 1;
1092 
1093  for (int isum = start_ts; isum <= end_ts; ++isum) {
1094  totalLasmonCharge += comb_charge[isum];
1095  }
1096  }
1097  } // if( fillLaserMonitor_ && (hLasermon.isValid() == true) )
1098 
1099  summary.calibCharge_ = totalCalibCharge;
1100  summary.lasmonCharge_ = totalLasmonCharge;
1101  summary.calibCountTS45_ = NcalibTS45;
1102  summary.calibCountgt15TS45_ = NcalibTS45gt15;
1103  summary.calibChargeTS45_ = chargecalibTS45;
1104  summary.calibChargegt15TS45_ = chargecalibgt15TS45;
1105  summary.calibCountHF_ = NcalibHFgtX;
1106 
1107  return;
1108 }
1109 
1110 // ------------ fill the array with rec hit information
1112  const edm::EventSetup& iSetup,
1114  HcalNoiseSummary& summary) const {
1115  // get the HCAL channel status map
1117  const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();
1118 
1119  // get the severity level computer
1121  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
1122 
1123  // get the calo geometry
1125  const CaloGeometry* geo = pG.product();
1126 
1127  // get the rechits
1129  // iEvent.getByLabel(recHitCollName_, handle);
1130  iEvent.getByToken(hbherechit_token_, handle);
1131 
1132  if (!handle.isValid()) {
1134  << " could not find HBHERecHitCollection named " << recHitCollName_ << "\n.";
1135  return;
1136  }
1137 
1138  summary.rechitCount_ = 0;
1139  summary.rechitCount15_ = 0;
1140  summary.rechitEnergy_ = 0;
1141  summary.rechitEnergy15_ = 0;
1142 
1143  summary.hitsInLaserRegion_ = 0;
1144  summary.hitsInNonLaserRegion_ = 0;
1145  summary.energyInLaserRegion_ = 0;
1146  summary.energyInNonLaserRegion_ = 0;
1147 
1148  // loop over all of the rechit information
1149  for (HBHERecHitCollection::const_iterator it = handle->begin(); it != handle->end(); ++it) {
1150  const HBHERecHit& rechit = (*it);
1151 
1152  // skip bad rechits (other than those flagged by the isolated noise, triangle, flat, and spike algorithms)
1153  const DetId id = rechit.idFront();
1154 
1155  uint32_t recHitFlag = rechit.flags();
1156  uint32_t isolbitset = (1 << HcalCaloFlagLabels::HBHEIsolatedNoise);
1157  uint32_t flatbitset = (1 << HcalCaloFlagLabels::HBHEFlatNoise);
1158  uint32_t spikebitset = (1 << HcalCaloFlagLabels::HBHESpikeNoise);
1159  uint32_t trianglebitset = (1 << HcalCaloFlagLabels::HBHETriangleNoise);
1160  uint32_t ts4ts5bitset = (1 << HcalCaloFlagLabels::HBHETS4TS5Noise);
1161  uint32_t negativebitset = (1 << HcalCaloFlagLabels::HBHENegativeNoise);
1162  for (unsigned int i = 0; i < HcalRecHitFlagsToBeExcluded_.size(); i++) {
1163  uint32_t bitset = (1 << HcalRecHitFlagsToBeExcluded_[i]);
1164  recHitFlag = (recHitFlag & bitset) ? recHitFlag - bitset : recHitFlag;
1165  }
1166  const HcalChannelStatus* dbStatus = dbHcalChStatus->getValues(id);
1167 
1168  // Ignore rechit if exclude bit set, regardless of severity of other bits
1170  continue;
1171 
1172  int severityLevel = hcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatus->getValue());
1173  bool isRecovered = hcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
1174  if (severityLevel != 0 && !isRecovered && severityLevel > static_cast<int>(HcalAcceptSeverityLevel_))
1175  continue;
1176 
1177  // do some rechit counting and energies
1178  summary.rechitCount_ = summary.rechitCount_ + 1;
1179  summary.rechitEnergy_ = summary.rechitEnergy_ + rechit.eraw();
1180  if (dbStatus->isBitSet(
1182  HcalBadLaserSignal)) // hit comes from a region where no laser calibration pulse is normally seen
1183  {
1184  ++summary.hitsInNonLaserRegion_;
1185  summary.energyInNonLaserRegion_ += rechit.eraw();
1186  } else // hit comes from region where laser calibration pulse is seen
1187  {
1188  ++summary.hitsInLaserRegion_;
1189  summary.energyInLaserRegion_ += rechit.eraw();
1190  }
1191 
1192  if (rechit.eraw() > 1.5) {
1193  summary.rechitCount15_ = summary.rechitCount15_ + 1;
1194  summary.rechitEnergy15_ = summary.rechitEnergy15_ + rechit.eraw();
1195  }
1196 
1197  // Exclude uncollapsed QIE11 channels
1200  continue;
1201 
1202  // if it was ID'd as isolated noise, update the summary object
1203  if (rechit.flags() & isolbitset) {
1204  summary.nisolnoise_++;
1205  summary.isolnoisee_ += rechit.eraw();
1206  GlobalPoint gp = geo->getPosition(rechit.id());
1207  double et = rechit.eraw() * gp.perp() / gp.mag();
1208  summary.isolnoiseet_ += et;
1209  }
1210 
1211  if (rechit.flags() & flatbitset) {
1212  summary.nflatnoise_++;
1213  summary.flatnoisee_ += rechit.eraw();
1214  GlobalPoint gp = geo->getPosition(rechit.id());
1215  double et = rechit.eraw() * gp.perp() / gp.mag();
1216  summary.flatnoiseet_ += et;
1217  }
1218 
1219  if (rechit.flags() & spikebitset) {
1220  summary.nspikenoise_++;
1221  summary.spikenoisee_ += rechit.eraw();
1222  GlobalPoint gp = geo->getPosition(rechit.id());
1223  double et = rechit.eraw() * gp.perp() / gp.mag();
1224  summary.spikenoiseet_ += et;
1225  }
1226 
1227  if (rechit.flags() & trianglebitset) {
1228  summary.ntrianglenoise_++;
1229  summary.trianglenoisee_ += rechit.eraw();
1230  GlobalPoint gp = geo->getPosition(rechit.id());
1231  double et = rechit.eraw() * gp.perp() / gp.mag();
1232  summary.trianglenoiseet_ += et;
1233  }
1234 
1235  if (rechit.flags() & ts4ts5bitset) {
1236  // only add to TS4TS5 if the bit is not marked as "HcalCellExcludeFromHBHENoiseSummaryR45"
1238  summary.nts4ts5noise_++;
1239  summary.ts4ts5noisee_ += rechit.eraw();
1240  GlobalPoint gp = geo->getPosition(rechit.id());
1241  double et = rechit.eraw() * gp.perp() / gp.mag();
1242  summary.ts4ts5noiseet_ += et;
1243  }
1244  }
1245 
1246  if (rechit.flags() & negativebitset) {
1247  summary.nnegativenoise_++;
1248  summary.negativenoisee_ += rechit.eraw();
1249  GlobalPoint gp = geo->getPosition(rechit.id());
1250  double et = rechit.eraw() * gp.perp() / gp.mag();
1251  summary.negativenoiseet_ += et;
1252  }
1253 
1254  // find the hpd that the rechit is in
1255  HcalNoiseHPD& hpd = (*array.findHPD(rechit));
1256 
1257  // create a persistent reference to the rechit
1258  edm::Ref<HBHERecHitCollection> myRef(handle, it - handle->begin());
1259 
1260  // store it in a place so that it remains sorted by energy
1261  hpd.refrechitset_.insert(myRef);
1262 
1263  } // end loop over rechits
1264 
1265  // loop over all HPDs and transfer the information from refrechitset_ to rechits_;
1266  for (HcalNoiseRBXArray::iterator rbxit = array.begin(); rbxit != array.end(); ++rbxit) {
1267  for (std::vector<HcalNoiseHPD>::iterator hpdit = rbxit->hpds_.begin(); hpdit != rbxit->hpds_.end(); ++hpdit) {
1268  // loop over all of the entries in the set and add them to rechits_
1269  for (std::set<edm::Ref<HBHERecHitCollection>, RefHBHERecHitEnergyComparison>::const_iterator it =
1270  hpdit->refrechitset_.begin();
1271  it != hpdit->refrechitset_.end();
1272  ++it) {
1273  hpdit->rechits_.push_back(*it);
1274  }
1275  }
1276  }
1277  // now the rechits in all the HPDs are sorted by energy!
1278 
1279  return;
1280 }
1281 
1282 // ------------ fill the array with calo tower information
1284  const edm::EventSetup& iSetup,
1286  HcalNoiseSummary& summary) const {
1287  // get the calotowers
1289  // iEvent.getByLabel(caloTowerCollName_, handle);
1290  iEvent.getByToken(calotower_token_, handle);
1291 
1292  if (!handle.isValid()) {
1294  << " could not find CaloTowerCollection named " << caloTowerCollName_ << "\n.";
1295  return;
1296  }
1297 
1298  summary.emenergy_ = summary.hadenergy_ = 0.0;
1299 
1300  // loop over all of the calotower information
1301  for (CaloTowerCollection::const_iterator it = handle->begin(); it != handle->end(); ++it) {
1302  const CaloTower& twr = (*it);
1303 
1304  // create a persistent reference to the tower
1305  edm::Ref<CaloTowerCollection> myRef(handle, it - handle->begin());
1306 
1307  // get all of the hpd's that are pointed to by the calotower
1308  std::vector<std::vector<HcalNoiseHPD>::iterator> hpditervec;
1309  array.findHPD(twr, hpditervec);
1310 
1311  // loop over the hpd's and add the reference to the RefVectors
1312  for (std::vector<std::vector<HcalNoiseHPD>::iterator>::iterator it = hpditervec.begin(); it != hpditervec.end();
1313  ++it)
1314  (*it)->calotowers_.push_back(myRef);
1315 
1316  // skip over anything with |ieta|>maxCaloTowerIEta
1317  if (twr.ietaAbs() > maxCaloTowerIEta_) {
1318  summary.emenergy_ += twr.emEnergy();
1319  summary.hadenergy_ += twr.hadEnergy();
1320  }
1321  }
1322 
1323  return;
1324 }
1325 
1326 // ------------ fill the summary info from jets
1328  const edm::EventSetup& iSetup,
1329  HcalNoiseSummary& summary) const {
1330  bool goodJetFoundInLowBVRegion = false; // checks whether a jet is in
1331  // a low BV region, where false
1332  // noise flagging rate is higher.
1333  if (!jetCollName_.empty()) {
1335  iEvent.getByToken(jet_token_, pfjet_h);
1336 
1337  if (pfjet_h.isValid()) {
1338  int jetindex = 0;
1339  for (reco::PFJetCollection::const_iterator jet = pfjet_h->begin(); jet != pfjet_h->end(); ++jet) {
1340  if (jetindex > maxjetindex_)
1341  break; // only look at jets with
1342  // indices up to maxjetindex_
1343 
1344  // Check whether jet is in low-BV region (0<eta<1.4, -1.8<phi<-1.4)
1345  if (jet->eta() > 0.0 && jet->eta() < 1.4 && jet->phi() > -1.8 && jet->phi() < -1.4) {
1346  // Look for a good jet in low BV region;
1347  // if found, we will keep event
1348  if (maxNHF_ < 0.0 || jet->neutralHadronEnergyFraction() < maxNHF_) {
1349  goodJetFoundInLowBVRegion = true;
1350  break;
1351  }
1352  }
1353  ++jetindex;
1354  }
1355  }
1356  }
1357 
1358  summary.goodJetFoundInLowBVRegion_ = goodJetFoundInLowBVRegion;
1359 }
1360 
1361 // ------------ fill the summary with track information
1363  const edm::EventSetup& iSetup,
1364  HcalNoiseSummary& summary) const {
1366  // iEvent.getByLabel(trackCollName_, handle);
1367  iEvent.getByToken(track_token_, handle);
1368 
1369  // don't throw exception, just return quietly
1370  if (!handle.isValid()) {
1371  // throw edm::Exception(edm::errors::ProductNotFound)
1372  // << " could not find trackCollection named " << trackCollName_ << "\n.";
1373  return;
1374  }
1375 
1376  summary.trackenergy_ = 0.0;
1377  for (reco::TrackCollection::const_iterator iTrack = handle->begin(); iTrack != handle->end(); ++iTrack) {
1378  const reco::Track& trk = *iTrack;
1379  if (trk.pt() < minTrackPt_ || fabs(trk.eta()) > maxTrackEta_)
1380  continue;
1381 
1382  summary.trackenergy_ += trk.p();
1383  }
1384 
1385  return;
1386 }
1387 
1388 //define this as a plug-in
int cboxChannel() const
get the calibration box channel (if relevant)
edm::EDGetTokenT< QIE10DigiCollection > lasermondigi_token_
std::vector< int > calibdigiHFtimeslices_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > HcalRecHitFlagsToBeExcluded_
bool passTightRatio(const CommonHcalNoiseRBXData &) const
int size() const
get the size
Definition: CaloSamples.h:24
constexpr bool zsMarkAndPass() const
was ZS MarkAndPass?
Definition: HBHEDataFrame.h:31
bool passLooseTiming(const CommonHcalNoiseRBXData &) const
bool passLooseZeros(const CommonHcalNoiseRBXData &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool passLooseRatio(const CommonHcalNoiseRBXData &) const
double p() const
momentum vector magnitude
Definition: TrackBase.h:631
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
void produce(edm::Event &, const edm::EventSetup &) override
bool passRatioThreshold(const CommonHcalNoiseRBXData &) const
std::vector< std::pair< double, double > > TS4TS5LowerCut_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > severitycomputer_token_
std::set< edm::Ref< HBHERecHitCollection >, RefHBHERecHitEnergyComparison > refrechitset_
Definition: HcalNoiseHPD.h:145
std::vector< T >::const_iterator const_iterator
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:137
bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const
bool passTightZeros(const CommonHcalNoiseRBXData &) const
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:138
double isum
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcaltopo_token_
const Item * getValues(DetId fId, bool throwOnFail=true) const
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:141
edm::EDGetTokenT< reco::PFJetCollection > jet_token_
void filljetinfo(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
bool passLooseHits(const CommonHcalNoiseRBXData &) const
bool passLooseRBXRechitR45(const CommonHcalNoiseRBXData &) const
double pt() const
track transverse momentum
Definition: TrackBase.h:637
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
Definition: HcalCoderDb.cc:73
static const unsigned OFF_TDC_TIME
void fillrechits(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > quality_token_
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
constexpr float eraw() const
Definition: HBHERecHit.h:47
HcalDetId idFront() const
Definition: HBHERecHit.cc:5
bool passZerosThreshold(const CommonHcalNoiseRBXData &) const
constexpr uint32_t auxPhase1() const
Definition: HBHERecHit.h:56
edm::EDGetTokenT< HcalCalibDigiCollection > hcalcalibdigi_token_
int ietaAbs() const
Definition: CaloTower.h:201
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const_iterator begin() const
edm::EDGetTokenT< HBHEDigiCollection > hbhedigi_token_
void fillOtherSummaryVariables(HcalNoiseSummary &summary, const CommonHcalNoiseRBXData &data) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
constexpr const HcalDetId & id() const
Definition: HBHEDataFrame.h:23
bool passTightRBXRechitR45(const CommonHcalNoiseRBXData &) const
bool passEMFThreshold(const CommonHcalNoiseRBXData &) const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > calogeometry_token_
uint32_t getValue() const
std::vector< std::pair< double, double > > TS4TS5UpperCut_
constexpr bool getBit(const uint32_t u, const unsigned bitnum)
const_iterator end() const
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:108
edm::EDGetTokenT< reco::TrackCollection > track_token_
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
Definition: DetId.h:17
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
edm::EDGetTokenT< HBHERecHitCollection > hbherechit_token_
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double emEnergy() const
Definition: CaloTower.h:130
void filldigis(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &)
bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const
double hadEnergy() const
Definition: CaloTower.h:131
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< HcalDbService, HcalDbRecord > service_token_
CalibDetType calibFlavor() const
get the flavor of this calibration detid
bool isValid() const
Definition: HandleBase.h:70
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
fixed size matrix
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static std::atomic< unsigned int > counter
static const unsigned OFF_COMBINED
bool passTightTiming(const CommonHcalNoiseRBXData &) const
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
std::vector< int > calibdigiHBHEtimeslices_
const HcalTopology * theHcalTopology_
bool passTightHits(const CommonHcalNoiseRBXData &) const
Log< level::Warning, false > LogWarning
HcalNoiseInfoProducer(const edm::ParameterSet &)
void filltracks(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
bool isBitSet(unsigned int bitnumber) const
def move(src, dest)
Definition: eostools.py:511
bool isProblematic(const CommonHcalNoiseRBXData &) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
bool dropChannel(const uint32_t &mystatus) const
void fillcalotwrs(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
edm::EDGetTokenT< CaloTowerCollection > calotower_token_