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 
24 
25 using namespace reco;
26 
27 //
28 // constructors and destructor
29 //
30 
32 {
33  // set the parameters
34  fillDigis_ = iConfig.getParameter<bool>("fillDigis");
35  fillRecHits_ = iConfig.getParameter<bool>("fillRecHits");
36  fillCaloTowers_ = iConfig.getParameter<bool>("fillCaloTowers");
37  fillTracks_ = iConfig.getParameter<bool>("fillTracks");
38  fillLaserMonitor_ = iConfig.getParameter<bool>("fillLaserMonitor");
39 
40  maxProblemRBXs_ = iConfig.getParameter<int>("maxProblemRBXs");
41 
42  maxCaloTowerIEta_ = iConfig.getParameter<int>("maxCaloTowerIEta");
43  maxTrackEta_ = iConfig.getParameter<double>("maxTrackEta");
44  minTrackPt_ = iConfig.getParameter<double>("minTrackPt");
45 
46  digiCollName_ = iConfig.getParameter<std::string>("digiCollName");
47  recHitCollName_ = iConfig.getParameter<std::string>("recHitCollName");
48  caloTowerCollName_ = iConfig.getParameter<std::string>("caloTowerCollName");
49  trackCollName_ = iConfig.getParameter<std::string>("trackCollName");
50 
51  jetCollName_ = iConfig.getParameter<std::string>("jetCollName");
52  maxNHF_ = iConfig.getParameter<double>("maxNHF");
53  maxjetindex_ = iConfig.getParameter<int>("maxjetindex");
54  jet_token_ = consumes<reco::PFJetCollection>(edm::InputTag(jetCollName_));
55 
56  minRecHitE_ = iConfig.getParameter<double>("minRecHitE");
57  minLowHitE_ = iConfig.getParameter<double>("minLowHitE");
58  minHighHitE_ = iConfig.getParameter<double>("minHighHitE");
59 
60  minR45HitE_ = iConfig.getParameter<double>("minR45HitE");
61 
62  HcalAcceptSeverityLevel_ = iConfig.getParameter<uint32_t>("HcalAcceptSeverityLevel");
63  HcalRecHitFlagsToBeExcluded_ = iConfig.getParameter<std::vector<int> >("HcalRecHitFlagsToBeExcluded");
64 
65  // Digi threshold and time slices to use for HBHE and HF calibration digis
67  calibdigiHBHEtimeslices_ = std::vector<int>();
69  calibdigiHFtimeslices_ = std::vector<int>();
70 
71  calibdigiHBHEthreshold_ = iConfig.getParameter<double>("calibdigiHBHEthreshold");
72  calibdigiHBHEtimeslices_ = iConfig.getParameter<std::vector<int> >("calibdigiHBHEtimeslices");
73  calibdigiHFthreshold_ = iConfig.getParameter<double>("calibdigiHFthreshold");
74  calibdigiHFtimeslices_ = iConfig.getParameter<std::vector<int> >("calibdigiHFtimeslices");
75 
76  TS4TS5EnergyThreshold_ = iConfig.getParameter<double>("TS4TS5EnergyThreshold");
77 
78  std::vector<double> TS4TS5UpperThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperThreshold");
79  std::vector<double> TS4TS5UpperCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperCut");
80  std::vector<double> TS4TS5LowerThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerThreshold");
81  std::vector<double> TS4TS5LowerCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerCut");
82 
83  for(int i = 0; i < (int)TS4TS5UpperThresholdTemp.size() && i < (int)TS4TS5UpperCutTemp.size(); i++)
84  TS4TS5UpperCut_.push_back(std::pair<double, double>(TS4TS5UpperThresholdTemp[i], TS4TS5UpperCutTemp[i]));
85  sort(TS4TS5UpperCut_.begin(), TS4TS5UpperCut_.end());
86 
87  for(int i = 0; i < (int)TS4TS5LowerThresholdTemp.size() && i < (int)TS4TS5LowerCutTemp.size(); i++)
88  TS4TS5LowerCut_.push_back(std::pair<double, double>(TS4TS5LowerThresholdTemp[i], TS4TS5LowerCutTemp[i]));
89  sort(TS4TS5LowerCut_.begin(), TS4TS5LowerCut_.end());
90 
91  // if digis are filled, then rechits must also be filled
92  if(fillDigis_ && !fillRecHits_) {
93  fillRecHits_=true;
94  edm::LogWarning("HCalNoiseInfoProducer") << " forcing fillRecHits to be true if fillDigis is true.\n";
95  }
96 
97  // get the fiber configuration vectors
98  laserMonCBoxList_ = iConfig.getParameter<std::vector<int> >("laserMonCBoxList");
99  laserMonIPhiList_ = iConfig.getParameter<std::vector<int> >("laserMonIPhiList");
100  laserMonIEtaList_ = iConfig.getParameter<std::vector<int> >("laserMonIEtaList");
101 
102  // check that the vectors have the same size, if not
103  // disable the laser monitor
104  if( !( (laserMonCBoxList_.size() == laserMonIEtaList_.size() ) &&
105  (laserMonCBoxList_.size() == laserMonIPhiList_.size() ) ) ) {
106  edm::LogWarning("MisConfiguration")<<"Must provide equally sized lists for laserMonCBoxList, laserMonIEtaList, and laserMonIPhiList. Will not fill LaserMon\n";
107  fillLaserMonitor_=false;
108  }
109 
110  // get the integration region with defaults
111  laserMonitorTSStart_ = iConfig.getParameter<int>("laserMonTSStart");
112  laserMonitorTSEnd_ = iConfig.getParameter<int>("laserMonTSEnd");
113 
114  adc2fC= std::vector<float> {-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,12.5,
115  13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
116  64.5,59.5,64.5,69.5,74.5,79.5,84.5,89.5,94.5,99.5,104.5,109.5,114.5,119.5,
117  124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
118  292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
119  559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
120  1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
121  1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
122  3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
123  5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
124 
125  // adc -> fC for qie8 with PMT input, for laser monitor
126  // Taken from Table 2 in
127  // https://cms-docdb.cern.ch/cgi-bin/DocDB/RetrieveFile?docid=3275&filename=qie_spec.pdf&version=1
128  adc2fCHF = std::vector<float> {-3,-0.4,2.2,4.8,7.4,10,12.6,15.2,17.8,20.4,23,25.6,28.2,30.8,33.4,
129  36,41.2,46.4,51.6,56.8,62,67.2,73,80.8,88.6,96.4,104,114.4,124.8,135,
130  148,161,150,163,176,189,202,215,228,241,254,267,280,293,306,319,332,
131  343,369,395,421,447,473,499,525,564,603,642,681,733,785,837,902,967,
132  902,967,1032,1097,1162,1227,1292,1357,1422,1487,1552,1617,1682,1747,
133  1812,1877,2007,2137,2267,2397,2527,2657,2787,2982,3177,3372,3567,
134  3827,4087,4347,4672,4997,4672,4997,5322,5647,5972,6297,6622,6947,
135  7272,7597,7922,8247,8572,8897,9222,9547,10197,10847,11497,12147,
136  12797,13447,14097,15072,16047,17022,17997,19297,20597,21897,23522,25147};
137 
138  hbhedigi_token_ = consumes<HBHEDigiCollection>(edm::InputTag(digiCollName_));
139  hcalcalibdigi_token_ = consumes<HcalCalibDigiCollection>(edm::InputTag("hcalDigis"));
140  hbherechit_token_ = consumes<HBHERecHitCollection>(edm::InputTag(recHitCollName_));
141  calotower_token_ = consumes<CaloTowerCollection>(edm::InputTag(caloTowerCollName_));
142  track_token_ = consumes<reco::TrackCollection>(edm::InputTag(trackCollName_));
143 
144  // we produce a vector of HcalNoiseRBXs
145  produces<HcalNoiseRBXCollection>();
146  // we also produce a noise summary
147  produces<HcalNoiseSummary>();
148 }
149 
150 
152 {
153 }
154 
157  // define hit energy thesholds
158  desc.add<double>("minRecHitE", 1.5);
159  desc.add<double>("minLowHitE", 10.0);
160  desc.add<double>("minHighHitE", 25.0);
161  desc.add<double>("minR45HitE", 5.0);
162 
163  // define energy threshold for "problematic" cuts
164  desc.add<double>("pMinERatio", 25.0);
165  desc.add<double>("pMinEZeros", 5.0);
166  desc.add<double>("pMinEEMF", 10.0);
167 
168  // define energy threshold for loose/tight/high level cuts
169  desc.add<double>("minERatio", 50.0);
170  desc.add<double>("minEZeros", 10.0);
171  desc.add<double>("minEEMF", 50.0);
172 
173  // define problematic RBX
174  desc.add<double>("pMinE", 40.0);
175  desc.add<double>("pMinRatio", 0.75);
176  desc.add<double>("pMaxRatio", 0.85);
177  desc.add<int>("pMinHPDHits", 10);
178  desc.add<int>("pMinRBXHits", 20);
179  desc.add<int>("pMinHPDNoOtherHits", 7);
180  desc.add<int>("pMinZeros", 4);
181  desc.add<double>("pMinLowEHitTime", -6.0);
182  desc.add<double>("pMaxLowEHitTime", 6.0);
183  desc.add<double>("pMinHighEHitTime", -4.0);
184  desc.add<double>("pMaxHighEHitTime", 5.0);
185  desc.add<double>("pMaxHPDEMF", -0.02);
186  desc.add<double>("pMaxRBXEMF", 0.02);
187  desc.add<int>("pMinRBXRechitR45Count", 1);
188  desc.add<double>("pMinRBXRechitR45Fraction", 0.1);
189  desc.add<double>("pMinRBXRechitR45EnergyFraction", 0.1);
190 
191  // define loose noise cuts
192  desc.add<double>("lMinRatio", -999.0);
193  desc.add<double>("lMaxRatio", 999.0);
194  desc.add<int>("lMinHPDHits", 17);
195  desc.add<int>("lMinRBXHits", 999);
196  desc.add<int>("lMinHPDNoOtherHits", 10);
197  desc.add<int>("lMinZeros", 10);
198  desc.add<double>("lMinLowEHitTime", -9999.0);
199  desc.add<double>("lMaxLowEHitTime", 9999.0);
200  desc.add<double>("lMinHighEHitTime", -9999.0);
201  desc.add<double>("lMaxHighEHitTime", 9999.0);
202 
203  // define tight noise cuts
204  desc.add<double>("tMinRatio", -999.0);
205  desc.add<double>("tMaxRatio", 999.0);
206  desc.add<int>("tMinHPDHits", 16);
207  desc.add<int>("tMinRBXHits", 50);
208  desc.add<int>("tMinHPDNoOtherHits", 9);
209  desc.add<int>("tMinZeros", 8);
210  desc.add<double>("tMinLowEHitTime", -9999.0);
211  desc.add<double>("tMaxLowEHitTime", 9999.0);
212  desc.add<double>("tMinHighEHitTime", -7.0);
213  desc.add<double>("tMaxHighEHitTime", 6.0);
214 
215  // define high level noise cuts
216  desc.add<double>("hlMaxHPDEMF", -9999.0);
217  desc.add<double>("hlMaxRBXEMF", 0.01);
218 
219  // Calibration digi noise variables (used for finding laser noise events)
220  desc.add<double>("calibdigiHBHEthreshold", 15)->
221  setComment("minimum threshold in fC of any HBHE \
222  calib digi to be counted in summary");
223  desc.add<std::vector<int>>("calibdigiHBHEtimeslices", {3,4,5,6,})->
224  setComment("time slices to use when determining charge of HBHE calib digis");
225  desc.add<double>("calibdigiHFthreshold", -999)->
226  setComment("minimum threshold in fC of any HF calib digi to be counted in summary");
227  desc.add<std::vector<int>>("calibdigiHFtimeslices", {0,1,2,3,4,5,6,7,8,9,})->
228  setComment("time slices to use when determining charge of HF calib digis");
229 
230  // RBX-wide TS4TS5 variable
231  desc.add<double>("TS4TS5EnergyThreshold", 50);
232  desc.add<std::vector<double>>("TS4TS5UpperThreshold", {70,90,100,400,4000,});
233  desc.add<std::vector<double>>("TS4TS5UpperCut", {1,0.8,0.75,0.72,0.72,});
234  desc.add<std::vector<double>>("TS4TS5LowerThreshold", {100,120,150,200,300,400,500,});
235  desc.add<std::vector<double>>("TS4TS5LowerCut", {-1,-0.7,-0.4,-0.2,-0.08,0,0.1,});
236 
237  // rechit R45 population filter variables
238  // this comes in groups of four: (a_Count, a_Fraction, a_EnergyFraction, const)
239  // flag as noise if (count * a_count + fraction * a_fraction + energyfraction * a_energyfraction + const) > 0
240  desc.add<std::vector<double>>("lRBXRecHitR45Cuts",
241  {0.0,1.0,0.0,-0.5,0.0,0.0,1.0,-0.5,})->
242  setComment("first 4 entries : equivalent to 'fraction > 0.5' \
243  last 4 entries : equivalent to 'energy fraction > 0.5'");
244  desc.add<std::vector<double>>("tRBXRecHitR45Cuts",
245  {0.0,1.0,0.0,-0.2,0.0,0.0,1.0,-0.2,})->
246  setComment("first 4 entries : equivalent to 'fraction > 0.2' \
247  last 4 entries : equivalent to 'energy fraction > 0.2'" );
248 
249  // define the channels used for laser monitoring
250  // note that the order here indicates the time order
251  // of the channels
252  desc.add<std::vector<int>>("laserMonCBoxList", {6,6,6,6,6,6,6,6,})->
253  setComment("time ordered list of the cBox values of laser monitor channels");
254  desc.add<std::vector<int>>("laserMonIPhiList", {23,17,11,5,29,35,41,47,})->
255  setComment("time ordered list of the iPhi values of laser monitor channels");
256  desc.add<std::vector<int>>("laserMonIEtaList", {0,0,0,0,0,0,0,0,})->
257  setComment("time ordered list of the iEta values of laser monitor channels");
258 
259  // boundaries for total charge integration
260  desc.add<int>("laserMonTSStart", 0)->
261  setComment("lower bound of laser monitor charge integration window");
262  desc.add<int>("laserMonTSEnd", -1)->
263  setComment("upper bound of laser monitor charge integration window (-1 = no bound)");
264 
265  // what to fill
266  desc.add<bool>("fillDigis", true);
267  desc.add<bool>("fillRecHits", true);
268  desc.add<bool>("fillCaloTowers", true);
269  desc.add<bool>("fillTracks", true);
270  desc.add<bool>("fillLaserMonitor", true);
271 
272  // maximum number of RBXs to fill
273  // if you want to record all RBXs above some energy threshold,
274  // change maxProblemRBXs to 999 and pMinE (above) to the threshold you want
275  desc.add<int>("maxProblemRBXs", 72)->
276  setComment("maximum number of RBXs to fill. if you want to record \
277  all RBXs above some energy threshold,change maxProblemRBXs to \
278  999 and pMinE (above) to the threshold you want");
279 ;
280 
281  // parameters for calculating summary variables
282  desc.add<int>("maxCaloTowerIEta", 20);
283  desc.add<double>("maxTrackEta", 2.0);
284  desc.add<double>("minTrackPt", 1.0);
285  desc.add<double>("maxNHF", 0.9);
286  desc.add<int>("maxjetindex", 0);
287 
288  // collection names
289  desc.add<std::string>("digiCollName", "hcalDigis");
290  desc.add<std::string>("recHitCollName", "hbhereco");
291  desc.add<std::string>("caloTowerCollName", "towerMaker");
292  desc.add<std::string>("trackCollName", "generalTracks");
293  desc.add<std::string>("jetCollName", "ak4PFJets");
294 
295  // severity level
296  desc.add<unsigned int>("HcalAcceptSeverityLevel", 9);
297 
298  // which hcal calo flags to mask
299  // (HBHEIsolatedNoise=11, HBHEFlatNoise=12, HBHESpikeNoise=13,
300  // HBHETriangleNoise=14, HBHETS4TS5Noise=15, HBHENegativeNoise=27)
301  desc.add<std::vector<int>>("HcalRecHitFlagsToBeExcluded", {11,12,13,14,15,27,})->
302  setComment("which hcal calo flags to mask (HBHEIsolatedNoise=11, \
303  HBHEFlatNoise=12, HBHESpikeNoise=13, \
304  HBHETriangleNoise=14, HBHETS4TS5Noise=15, HBHENegativeNoise=27)");
305 ;
306 
307  descriptions.add("hcalnoise", desc);
308 }
309 
310 //
311 // member functions
312 //
313 
314 // ------------ method called to produce the data ------------
315 void
317 {
318  // this is what we're going to actually write to the EDM
319  auto result1 = std::make_unique<HcalNoiseRBXCollection>();
320  auto result2 = std::make_unique<HcalNoiseSummary>();
321 
322  // define an empty HcalNoiseRBXArray that we're going to fill
323  HcalNoiseRBXArray rbxarray;
324  HcalNoiseSummary &summary=*result2;
325 
326  // Get topology class to use later
328  iSetup.get<HcalRecNumberingRecord>().get(topo);
329  theHcalTopology_ = topo.product();
330 
331  // fill them with the various components
332  // digi assumes that rechit information is available
333  if(fillRecHits_) fillrechits(iEvent, iSetup, rbxarray, summary);
334  if(fillDigis_) filldigis(iEvent, iSetup, rbxarray, summary);
335  if(fillCaloTowers_) fillcalotwrs(iEvent, iSetup, rbxarray, summary);
336  if(fillTracks_) filltracks(iEvent, iSetup, summary);
337 
338  filljetinfo(iEvent, iSetup, summary);
339 
340  // Why is this here? Shouldn't it have been in the filldigis method? Any reason for totalCalibCharge to be defined outside filldigis(...) ?-- Jeff, 7/2/12
341  //if(fillDigis_) summary.calibCharge_ = totalCalibCharge;
342 
343  // select those RBXs which are interesting
344  // also look for the highest energy RBX
345  HcalNoiseRBXArray::iterator maxit=rbxarray.begin();
346  double maxenergy=-999;
347  bool maxwritten=false;
348  for(HcalNoiseRBXArray::iterator rit = rbxarray.begin(); rit!=rbxarray.end(); ++rit) {
349  HcalNoiseRBX &rbx=(*rit);
352 
353  // find the highest energy rbx
354  if(data.energy()>maxenergy) {
355  maxenergy=data.energy();
356  maxit=rit;
357  maxwritten=false;
358  }
359 
360  // find out if the rbx is problematic/noisy/etc.
361  bool writerbx = algo_.isProblematic(data) || !algo_.passLooseNoiseFilter(data) ||
363 
364  // fill variables in the summary object not filled elsewhere
365  fillOtherSummaryVariables(summary, data);
366 
367  if(writerbx) {
368  summary.nproblemRBXs_++;
369  if(summary.nproblemRBXs_<=maxProblemRBXs_) {
370  result1->push_back(rbx);
371  if(maxit==rit) maxwritten=true;
372  }
373  }
374  } // end loop over rbxs
375 
376  // if we still haven't written the maximum energy rbx, write it now
377  if(!maxwritten) {
378  HcalNoiseRBX &rbx=(*maxit);
379 
380  // add the RBX to the event
381  result1->push_back(rbx);
382  }
383 
384  // put the rbxcollection and summary into the EDM
385  iEvent.put(std::move(result1));
386  iEvent.put(std::move(result2));
387 
388  return;
389 }
390 
391 
392 // ------------ here we fill specific variables in the summary object not already accounted for earlier
393 void
395 {
396  // charge ratio
397  if(algo_.passRatioThreshold(data) && data.validRatio()) {
398  if(data.ratio()<summary.minE2Over10TS()) {
399  summary.mine2ts_ = data.e2ts();
400  summary.mine10ts_ = data.e10ts(); }
401  if(data.ratio()>summary.maxE2Over10TS()) {
402  summary.maxe2ts_ = data.e2ts();
403  summary.maxe10ts_ = data.e10ts();
404  }
405  }
406 
407  // ADC zeros
408  if(algo_.passZerosThreshold(data)) {
409  if(data.numZeros()>summary.maxZeros()) {
410  summary.maxzeros_ = data.numZeros();
411  }
412  }
413 
414  // hits count
415  if(data.numHPDHits() > summary.maxHPDHits()) {
416  summary.maxhpdhits_ = data.numHPDHits();
417  }
418  if(data.numRBXHits() > summary.maxRBXHits()) {
419  summary.maxrbxhits_ = data.numRBXHits();
420  }
421  if(data.numHPDNoOtherHits() > summary.maxHPDNoOtherHits()) {
422  summary.maxhpdhitsnoother_ = data.numHPDNoOtherHits();
423  }
424 
425  // TS4TS5
426  if(data.PassTS4TS5() == false)
427  summary.hasBadRBXTS4TS5_ = true;
428 
429  if(algo_.passLooseRBXRechitR45(data) == false)
430  summary.hasBadRBXRechitR45Loose_ = true;
431  if(algo_.passTightRBXRechitR45(data) == false)
432  summary.hasBadRBXRechitR45Tight_ = true;
433 
434  // hit timing
435  if(data.minLowEHitTime()<summary.min10GeVHitTime()) {
436  summary.min10_ = data.minLowEHitTime();
437  }
438  if(data.maxLowEHitTime()>summary.max10GeVHitTime()) {
439  summary.max10_ = data.maxLowEHitTime();
440  }
441  summary.rms10_ += data.lowEHitTimeSqrd();
442  summary.cnthit10_ += data.numLowEHits();
443  if(data.minHighEHitTime()<summary.min25GeVHitTime()) {
444  summary.min25_ = data.minHighEHitTime();
445  }
446  if(data.maxHighEHitTime()>summary.max25GeVHitTime()) {
447  summary.max25_ = data.maxHighEHitTime();
448  }
449  summary.rms25_ += data.highEHitTimeSqrd();
450  summary.cnthit25_ += data.numHighEHits();
451 
452  // EMF
453  if(algo_.passEMFThreshold(data)) {
454  if(summary.minHPDEMF() > data.HPDEMF()) {
455  summary.minhpdemf_ = data.HPDEMF();
456  }
457  if(summary.minRBXEMF() > data.RBXEMF()) {
458  summary.minrbxemf_ = data.RBXEMF();
459  }
460  }
461 
462  // summary flag
463  if(!algo_.passLooseRatio(data)) summary.filterstatus_ |= 0x1;
464  if(!algo_.passLooseHits(data)) summary.filterstatus_ |= 0x2;
465  if(!algo_.passLooseZeros(data)) summary.filterstatus_ |= 0x4;
466  if(!algo_.passLooseTiming(data)) summary.filterstatus_ |= 0x8;
467 
468  if(!algo_.passTightRatio(data)) summary.filterstatus_ |= 0x100;
469  if(!algo_.passTightHits(data)) summary.filterstatus_ |= 0x200;
470  if(!algo_.passTightZeros(data)) summary.filterstatus_ |= 0x400;
471  if(!algo_.passTightTiming(data)) summary.filterstatus_ |= 0x800;
472 
473  if(!algo_.passHighLevelNoiseFilter(data)) summary.filterstatus_ |= 0x10000;
474 
475  // summary refvectors
477  if(!algo_.passLooseNoiseFilter(data))
478  join(summary.loosenoisetwrs_, data.rbxTowers());
479  if(!algo_.passTightNoiseFilter(data))
480  join(summary.tightnoisetwrs_, data.rbxTowers());
482  join(summary.hlnoisetwrs_, data.rbxTowers());
483 
484  return;
485 }
486 
487 
488 // ------------ fill the array with digi information
489 void
491 {
492  // Some initialization
493  totalCalibCharge = 0;
494  totalLasmonCharge = 0;
495 
496  // 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)
497  int NcalibTS45=0;
498  int NcalibTS45gt15=0;
499  int NcalibHFgtX=0;
500 
501  double chargecalibTS45=0;
502  double chargecalibgt15TS45=0;
503 
504  // get the conditions and channel quality
505  edm::ESHandle<HcalDbService> conditions;
506  iSetup.get<HcalDbRecord>().get(conditions);
508  iSetup.get<HcalChannelQualityRcd>().get("withTopo",qualhandle);
509  const HcalChannelQuality* myqual = qualhandle.product();
511  iSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
512  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
513 
514  // get the digis
516  // iEvent.getByLabel(digiCollName_, handle);
517  iEvent.getByToken(hbhedigi_token_, handle);
518 
519  if(!handle.isValid()) {
520  throw edm::Exception(edm::errors::ProductNotFound) << " could not find HBHEDigiCollection named " << digiCollName_ << "\n.";
521  return;
522  }
523 
524  // loop over all of the digi information
525  for(HBHEDigiCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
526  const HBHEDataFrame &digi=(*it);
527  HcalDetId cell = digi.id();
528  DetId detcell=(DetId)cell;
529 
530  // check on cells to be ignored and dropped
531  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
532  if(mySeverity->dropChannel(mydigistatus->getValue())) continue;
533  if(digi.zsMarkAndPass()) continue;
534  // Drop if exclude bit set
535  if ((mydigistatus->getValue() & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary))==1) continue;
536 
537  // get the calibrations and coder
538  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
539  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
540  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
541  HcalCoderDb coder (*channelCoder, *shape);
542 
543  // match the digi to an rbx and hpd
544  HcalNoiseRBX &rbx=(*array.findRBX(digi));
545  HcalNoiseHPD &hpd=(*array.findHPD(digi));
546 
547  // determine if the digi is one the highest energy hits in the HPD
548  // this works because the rechits are sorted by energy (see fillrechits() below)
549  bool isBig=false, isBig5=false, isRBX=false;
550  int counter=0;
553  rit!=rechits.end(); ++rit, ++counter) {
554  const HcalDetId & detid = (*rit)->idFront();
555  if(DetId(detid) == digi.id()) {
556  if(counter==0) isBig=isBig5=true; // digi is also the highest energy rechit
557  if(counter<5) isBig5=true; // digi is one of 5 highest energy rechits
558  isRBX=true;
559  }
560  }
561 
562  // loop over each of the digi's time slices
563  int totalzeros=0;
564  CaloSamples tool;
565  coder.adc2fC(digi,tool);
566  for(int ts=0; ts<tool.size(); ++ts) {
567 
568  // count zero's
569  if(digi[ts].adc()==0) {
570  ++hpd.totalZeros_;
571  ++totalzeros;
572  }
573 
574  // get the fC's
575  double corrfc = tool[ts]-calibrations.pedestal(digi[ts].capid());
576 
577  // fill the relevant digi arrays
578  if(isBig) hpd.bigCharge_[ts]+=corrfc;
579  if(isBig5) hpd.big5Charge_[ts]+=corrfc;
580  if(isRBX) rbx.allCharge_[ts]+=corrfc;
581  }
582 
583  // record the maximum number of zero's found
584  if(totalzeros>hpd.maxZeros_)
585  hpd.maxZeros_=totalzeros;
586  }
587 
588  // get the calibration digis
590  // iEvent.getByLabel("hcalDigis", hCalib);
591  iEvent.getByToken(hcalcalibdigi_token_, hCalib);
592 
593  // get total charge in calibration channels
594  if(hCalib.isValid() == true)
595  {
596 
597 
598  std::vector<std::vector<int> > lasmon_adcs(laserMonCBoxList_.size(), std::vector<int>());
599  std::vector<std::vector<int> > lasmon_capids(laserMonCBoxList_.size(), std::vector<int>());
600 
601  for(HcalCalibDigiCollection::const_iterator digi = hCalib->begin(); digi != hCalib->end(); digi++)
602  {
603  if(digi->id().hcalSubdet() == 0)
604  continue;
605 
606  // Fill the lasermonitor channels
607  if( fillLaserMonitor_ ) {
608  int cboxch = digi->id().cboxChannel( );
609  int iphi = digi->id().iphi();
610  int ieta = digi->id().ieta();
611 
612  // only check channels having the requested cboxch
613  if (std::find( laserMonCBoxList_.begin(), laserMonCBoxList_.end(),
614  cboxch ) != laserMonCBoxList_.end() ) {
615  // find the index of this channel by matching cBox, iEta, iPhi
616  for( unsigned idx = 0; idx < laserMonCBoxList_.size(); ++idx ) {
617  if( cboxch == laserMonCBoxList_[idx] &&
618  iphi == laserMonIPhiList_[idx] &&
619  ieta == laserMonIEtaList_[idx] ) {
620 
621  // now get the digis
622  unsigned ts_size = digi->size();
623  for(unsigned i = 0; i < ts_size; i++) {
624  lasmon_adcs[idx].push_back( digi->sample(i).adc() );
625  lasmon_capids[idx].push_back( digi->sample(i).capid() );
626  } // end digi loop
627  } // end matching channel if
628  } // end fiber order loop
629  } // end cboxch check
630  } // end filllasmon check
631 
632 
633  for(unsigned i = 0; i < (unsigned)digi->size(); i++)
634  totalCalibCharge = totalCalibCharge + adc2fC[digi->sample(i).adc()&0xff];
635 
636 
637  HcalCalibDetId myid=(HcalCalibDetId)digi->id();
639  continue; // ignore HOCrosstalk channels
640  if(digi->zsMarkAndPass()) continue; // skip "mark-and-pass" channels when computing charge in calib channels
641 
642 
643  if (digi->id().hcalSubdet()==HcalForward) // check HF
644  {
645  double sumChargeHF=0;
646  for (unsigned int i=0;i<calibdigiHFtimeslices_.size();++i)
647  {
648  // skip unphysical time slices
649  if (calibdigiHFtimeslices_[i]<0 || calibdigiHFtimeslices_[i]>digi->size())
650  continue;
651  sumChargeHF+=adc2fC[digi->sample(calibdigiHFtimeslices_[i]).adc()&0xff];
652  }
653  if (sumChargeHF>calibdigiHFthreshold_) ++NcalibHFgtX;
654  } // end of HF check
655  else if (digi->id().hcalSubdet()==HcalBarrel || digi->id().hcalSubdet()==HcalEndcap) // now check HBHE
656  {
657  double sumChargeHBHE=0;
658  for (unsigned int i=0;i<calibdigiHBHEtimeslices_.size();++i)
659  {
660  // skip unphysical time slices
661  if (calibdigiHBHEtimeslices_[i]<0 || calibdigiHBHEtimeslices_[i]>digi->size())
662  continue;
663  sumChargeHBHE+=adc2fC[digi->sample(calibdigiHBHEtimeslices_[i]).adc()&0xff];
664  }
665  ++NcalibTS45;
666  chargecalibTS45+=sumChargeHBHE;
667  if (sumChargeHBHE>calibdigiHBHEthreshold_)
668  {
669  ++NcalibTS45gt15;
670  chargecalibgt15TS45+=sumChargeHBHE;
671  }
672  } // end of HBHE check
673  } // loop on HcalCalibDigiCollection
674 
675  // now match the laser monitor data by fiber (in time)
676  if( fillLaserMonitor_ ) {
677  // check for any fibers without data and fill
678  // them so we dont run into problems later
679  for( unsigned idx = 0; idx < laserMonCBoxList_.size(); ++idx ) {
680  if( lasmon_adcs[idx].empty() ) {
681  lasmon_adcs[idx] = std::vector<int>(10, -1);
682  }
683  if( lasmon_capids[idx].empty() ) {
684  lasmon_capids[idx] = std::vector<int>(10, -1);
685  }
686  }
687  unsigned nFibers = laserMonIEtaList_.size();
688  // for each fiber we need to find the index at with the
689  // data from the next fiber matches in order to stitch them together.
690  // When there is an overlap, the data from the end of the
691  // earlier fiber is removed. There is no removal of the last fiber
692  std::vector<unsigned> matching_idx;
693  // we assume that the list of fibers was given in time order
694  // (if this was not the case, then we just end up using
695  // all data from all fibers )
696  for( unsigned fidx = 0; nFibers > 0 && (fidx < (nFibers - 1)); ++fidx ) {
697 
698  unsigned nts = lasmon_capids[fidx].size(); // number of time slices
699 
700  // start by checking just the last TS of the earlier fiber
701  // against the first TS of the later fiber
702  // on each iteration, check one additional TS
703  // moving back in time on the earlier fiber and
704  // forward in time in the later fiber
705 
706  int start_ts = nts - 1; // start_ts will be decrimented on each loop where a match is not found
707 
708  // in the case that our stringent check below doesn't work
709  // store the latest capID that has a match
710  int latest_cap_match = -1;
711 
712  // loop over the number of checks to make
713  for( unsigned ncheck = 1; ncheck <= nts ; ncheck++ ) {
714  bool cap_match = true; //will be set to false if at least one check fails below
715  bool adc_match = true; //will be set to false if at least one check fails below
716 
717  // loop over the channel TS, this is for the later fiber in time
718  for( unsigned lidx = 0; lidx < ncheck; lidx++) {
719  // we are looping over the TS of the later fiber in time
720  // the TS of the earlier fiber starts from the end
721  unsigned eidx = nts-ncheck+lidx;
722  // if we get an invald value, this fiber has no data
723  // the check and match will fail, so the start_ts will
724  // be decrimented
725  if( lasmon_capids[fidx][eidx] == -1 || lasmon_capids[fidx+1][lidx] == -1 ) {
726  cap_match = false;
727  adc_match = false;
728  break;
729  }
730 
731  if( lasmon_capids[fidx][eidx] != lasmon_capids[fidx+1][lidx] ) {
732  cap_match = false;
733  }
734  // check the data values as well
735  if( lasmon_adcs[fidx][eidx] != lasmon_adcs[fidx+1][lidx] ) {
736  adc_match = false;
737  }
738  }
739  if( cap_match && (start_ts > latest_cap_match) ) {
740  latest_cap_match = start_ts;
741  }
742  if( cap_match && adc_match ) {
743  // end the loop and we'll take the current start_ts
744  // as the end of the data for this fiber
745  break;
746  }
747  else {
748  // if we don't have a match, then decrement the
749  // starting TS and check again
750  start_ts--;
751  }
752  }
753 
754  // now make some sanity checks on the determined overlap index
755  if( start_ts == -1 ) {
756  // if we didn't find any match, use the capID only to compare
757  if( latest_cap_match < 0 ) {
758  //this shouldn't happen, in this case use all the data from the fiber
759  start_ts = nts;
760  }
761  else {
762  // its possible that the timing of the fibers
763  // is shifted such that they do not overlap
764  // and we just want to stitch the fibers
765  // together with no removal.
766  // In this case the capIDs will match at the
767  // N-4 spot (and the ADCs will not)
768  // if this is not the case, then we just take
769  // the value of latest match
770  if( latest_cap_match == int(nts - 4) ) {
771  start_ts = nts;
772  } else {
773  start_ts = latest_cap_match;
774  }
775  }
776  }
777 
778  // now store as the matching index
779  matching_idx.push_back(start_ts);
780  }
781 
782  // for the last fiber we always use all of the data
783  matching_idx.push_back(10);
784 
785  // now loop over the time slices of each fiber and make the sum
786  int icombts = -1;
787  for( unsigned fidx = 0 ; fidx < nFibers; ++fidx ) {
788  for( unsigned its = 0; its < matching_idx[fidx]; ++its ) {
789  icombts++;
790 
791  // apply integration limits
792  if( icombts < laserMonitorTSStart_ ) continue;
793  if( laserMonitorTSEnd_ > 0 && icombts > laserMonitorTSEnd_ ) continue;
794 
795  int adc = lasmon_adcs[fidx][its];
796 
797  if( adc >= 0 ) { // skip invalid data
798  float fc = adc2fCHF[adc];
800  }
801 
802  }
803  }
804  } // if( fillLaserMonitor_ )
805  } // if (hCalib.isValid()==true)
806 
807  summary.calibCharge_ = totalCalibCharge;
809  summary.calibCountTS45_=NcalibTS45;
810  summary.calibCountgt15TS45_=NcalibTS45gt15;
811  summary.calibChargeTS45_=chargecalibTS45;
812  summary.calibChargegt15TS45_=chargecalibgt15TS45;
813  summary.calibCountHF_=NcalibHFgtX;
814 
815  return;
816 }
817 
818 // ------------ fill the array with rec hit information
819 void
821 {
822  // get the HCAL channel status map
824  iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
825  const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();
826 
827  // get the severity level computer
828  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
829  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
830  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
831 
832  // get the calo geometry
834  iSetup.get<CaloGeometryRecord>().get(pG);
835  const CaloGeometry* geo = pG.product();
836 
837  // get the rechits
839  // iEvent.getByLabel(recHitCollName_, handle);
840  iEvent.getByToken(hbherechit_token_, handle);
841 
842  if(!handle.isValid()) {
844  << " could not find HBHERecHitCollection named " << recHitCollName_ << "\n.";
845  return;
846  }
847 
848  summary.rechitCount_ = 0;
849  summary.rechitCount15_ = 0;
850  summary.rechitEnergy_ = 0;
851  summary.rechitEnergy15_ = 0;
852 
853  summary.hitsInLaserRegion_=0;
854  summary.hitsInNonLaserRegion_=0;
855  summary.energyInLaserRegion_=0;
856  summary.energyInNonLaserRegion_=0;
857 
858 
859 
860  // loop over all of the rechit information
861  for(HBHERecHitCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
862  const HBHERecHit &rechit=(*it);
863 
864  // skip bad rechits (other than those flagged by the isolated noise, triangle, flat, and spike algorithms)
865  const DetId id = rechit.idFront();
866 
867  uint32_t recHitFlag = rechit.flags();
868  uint32_t isolbitset = (1 << HcalCaloFlagLabels::HBHEIsolatedNoise);
869  uint32_t flatbitset = (1 << HcalCaloFlagLabels::HBHEFlatNoise);
870  uint32_t spikebitset = (1 << HcalCaloFlagLabels::HBHESpikeNoise);
871  uint32_t trianglebitset = (1 << HcalCaloFlagLabels::HBHETriangleNoise);
872  uint32_t ts4ts5bitset = (1 << HcalCaloFlagLabels::HBHETS4TS5Noise);
873  uint32_t negativebitset = (1 << HcalCaloFlagLabels::HBHENegativeNoise);
874  for(unsigned int i=0; i<HcalRecHitFlagsToBeExcluded_.size(); i++) {
875  uint32_t bitset = (1 << HcalRecHitFlagsToBeExcluded_[i]);
876  recHitFlag = (recHitFlag & bitset) ? recHitFlag-bitset : recHitFlag;
877  }
878  const uint32_t dbStatusFlag = dbHcalChStatus->getValues(id)->getValue();
879 
880  // Ignore rechit if exclude bit set, regardless of severity of other bits
881  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary))==1) continue;
882 
883  int severityLevel = hcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
884  bool isRecovered = hcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
885  if(severityLevel!=0 && !isRecovered && severityLevel>static_cast<int>(HcalAcceptSeverityLevel_)) continue;
886 
887  // do some rechit counting and energies
888  summary.rechitCount_ = summary.rechitCount_ + 1;
889  summary.rechitEnergy_ = summary.rechitEnergy_ + rechit.eraw();
890  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalBadLaserSignal))==1) // hit comes from a region where no laser calibration pulse is normally seen
891  {
892  ++summary.hitsInNonLaserRegion_;
893  summary.energyInNonLaserRegion_+=rechit.eraw();
894  }
895  else // hit comes from region where laser calibration pulse is seen
896  {
897  ++summary.hitsInLaserRegion_;
898  summary.energyInLaserRegion_+=rechit.eraw();
899  }
900 
901  if(rechit.eraw() > 1.5)
902  {
903  summary.rechitCount15_ = summary.rechitCount15_ + 1;
904  summary.rechitEnergy15_ = summary.rechitEnergy15_ + rechit.eraw();
905  }
906 
907  // if it was ID'd as isolated noise, update the summary object
908  if(rechit.flags() & isolbitset) {
909  summary.nisolnoise_++;
910  summary.isolnoisee_ += rechit.eraw();
911  GlobalPoint gp = geo->getPosition(rechit.id());
912  double et = rechit.eraw()*gp.perp()/gp.mag();
913  summary.isolnoiseet_ += et;
914  }
915 
916  if(rechit.flags() & flatbitset) {
917  summary.nflatnoise_++;
918  summary.flatnoisee_ += rechit.eraw();
919  GlobalPoint gp = geo->getPosition(rechit.id());
920  double et = rechit.eraw()*gp.perp()/gp.mag();
921  summary.flatnoiseet_ += et;
922  }
923 
924  if(rechit.flags() & spikebitset) {
925  summary.nspikenoise_++;
926  summary.spikenoisee_ += rechit.eraw();
927  GlobalPoint gp = geo->getPosition(rechit.id());
928  double et = rechit.eraw()*gp.perp()/gp.mag();
929  summary.spikenoiseet_ += et;
930  }
931 
932  if(rechit.flags() & trianglebitset) {
933  summary.ntrianglenoise_++;
934  summary.trianglenoisee_ += rechit.eraw();
935  GlobalPoint gp = geo->getPosition(rechit.id());
936  double et = rechit.eraw()*gp.perp()/gp.mag();
937  summary.trianglenoiseet_ += et;
938  }
939 
940  if(rechit.flags() & ts4ts5bitset) {
941  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummaryR45))==0) // only add to TS4TS5 if the bit is not marked as "HcalCellExcludeFromHBHENoiseSummaryR45"
942  {
943  summary.nts4ts5noise_++;
944  summary.ts4ts5noisee_ += rechit.eraw();
945  GlobalPoint gp = geo->getPosition(rechit.id());
946  double et = rechit.eraw()*gp.perp()/gp.mag();
947  summary.ts4ts5noiseet_ += et;
948  }
949  }
950 
951  if(rechit.flags() & negativebitset) {
952  summary.nnegativenoise_++;
953  summary.negativenoisee_ += rechit.eraw();
954  GlobalPoint gp = geo->getPosition(rechit.id());
955  double et = rechit.eraw()*gp.perp()/gp.mag();
956  summary.negativenoiseet_ += et;
957  }
958 
959  // find the hpd that the rechit is in
960  HcalNoiseHPD& hpd=(*array.findHPD(rechit));
961 
962  // create a persistent reference to the rechit
963  edm::Ref<HBHERecHitCollection> myRef(handle, it-handle->begin());
964 
965  // store it in a place so that it remains sorted by energy
966  hpd.refrechitset_.insert(myRef);
967 
968  } // end loop over rechits
969 
970  // loop over all HPDs and transfer the information from refrechitset_ to rechits_;
971  for(HcalNoiseRBXArray::iterator rbxit=array.begin(); rbxit!=array.end(); ++rbxit) {
972  for(std::vector<HcalNoiseHPD>::iterator hpdit=rbxit->hpds_.begin(); hpdit!=rbxit->hpds_.end(); ++hpdit) {
973 
974  // loop over all of the entries in the set and add them to rechits_
976  it=hpdit->refrechitset_.begin(); it!=hpdit->refrechitset_.end(); ++it) {
977  hpdit->rechits_.push_back(*it);
978  }
979  }
980  }
981  // now the rechits in all the HPDs are sorted by energy!
982 
983  return;
984 }
985 
986 // ------------ fill the array with calo tower information
987 void
989 {
990  // get the calotowers
992  // iEvent.getByLabel(caloTowerCollName_, handle);
993  iEvent.getByToken(calotower_token_, handle);
994 
995  if(!handle.isValid()) {
997  << " could not find CaloTowerCollection named " << caloTowerCollName_ << "\n.";
998  return;
999  }
1000 
1001  summary.emenergy_ = summary.hadenergy_ = 0.0;
1002 
1003  // loop over all of the calotower information
1004  for(CaloTowerCollection::const_iterator it = handle->begin(); it!=handle->end(); ++it) {
1005  const CaloTower& twr=(*it);
1006 
1007  // create a persistent reference to the tower
1008  edm::Ref<CaloTowerCollection> myRef(handle, it-handle->begin());
1009 
1010  // get all of the hpd's that are pointed to by the calotower
1011  std::vector<std::vector<HcalNoiseHPD>::iterator> hpditervec;
1012  array.findHPD(twr, hpditervec);
1013 
1014  // loop over the hpd's and add the reference to the RefVectors
1015  for(std::vector<std::vector<HcalNoiseHPD>::iterator>::iterator it=hpditervec.begin();
1016  it!=hpditervec.end(); ++it)
1017  (*it)->calotowers_.push_back(myRef);
1018 
1019  // skip over anything with |ieta|>maxCaloTowerIEta
1020  if(twr.ietaAbs()>maxCaloTowerIEta_) {
1021  summary.emenergy_ += twr.emEnergy();
1022  summary.hadenergy_ += twr.hadEnergy();
1023  }
1024  }
1025 
1026  return;
1027 }
1028 
1029 // ------------ fill the summary info from jets
1030 void
1032 {
1033  bool goodJetFoundInLowBVRegion = false; // checks whether a jet is in
1034  // a low BV region, where false
1035  // noise flagging rate is higher.
1036  if (!jetCollName_.empty())
1037  {
1039  iEvent.getByToken(jet_token_, pfjet_h);
1040 
1041  if (pfjet_h.isValid())
1042  {
1043  int jetindex=0;
1044  for(reco::PFJetCollection::const_iterator jet = pfjet_h->begin();
1045  jet != pfjet_h->end(); ++jet)
1046  {
1047  if (jetindex>maxjetindex_) break; // only look at jets with
1048  // indices up to maxjetindex_
1049 
1050  // Check whether jet is in low-BV region (0<eta<1.4, -1.8<phi<-1.4)
1051  if (jet->eta()>0.0 && jet->eta()<1.4 &&
1052  jet->phi()>-1.8 && jet->phi()<-1.4)
1053  {
1054  // Look for a good jet in low BV region;
1055  // if found, we will keep event
1056  if (maxNHF_<0.0 || jet->neutralHadronEnergyFraction()<maxNHF_)
1057  {
1058  goodJetFoundInLowBVRegion=true;
1059  break;
1060  }
1061  }
1062  ++jetindex;
1063  }
1064  }
1065  }
1066 
1067  summary.goodJetFoundInLowBVRegion_ = goodJetFoundInLowBVRegion;
1068 }
1069 
1070 // ------------ fill the summary with track information
1071 void
1073 {
1075  // iEvent.getByLabel(trackCollName_, handle);
1076  iEvent.getByToken(track_token_, handle);
1077 
1078  // don't throw exception, just return quietly
1079  if(!handle.isValid()) {
1080  // throw edm::Exception(edm::errors::ProductNotFound)
1081  // << " could not find trackCollection named " << trackCollName_ << "\n.";
1082  return;
1083  }
1084 
1085  summary.trackenergy_=0.0;
1086  for(reco::TrackCollection::const_iterator iTrack = handle->begin(); iTrack!=handle->end(); ++iTrack) {
1087  reco::Track trk=*iTrack;
1088  if(trk.pt()<minTrackPt_ || fabs(trk.eta())>maxTrackEta_) continue;
1089 
1090  summary.trackenergy_ += trk.p();
1091  }
1092 
1093  return;
1094 }
1095 
1096 //define this as a plug-in
int adc(sample_type sample)
get the ADC sample (12 bits)
double e10ts(void) const
Definition: HcalNoiseAlgo.h:23
double HPDEMF(void) const
Definition: HcalNoiseAlgo.h:38
double e2ts(void) const
Definition: HcalNoiseAlgo.h:22
double p() const
momentum vector magnitude
Definition: TrackBase.h:615
T getParameter(std::string const &) const
edm::RefVector< CaloTowerCollection > hlnoisetwrs_
double lowEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:31
std::vector< int > calibdigiHFtimeslices_
std::vector< int > HcalRecHitFlagsToBeExcluded_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool isProblematic(const CommonHcalNoiseRBXData &) const
bool passTightRatio(const CommonHcalNoiseRBXData &) const
bool zsMarkAndPass() const
was ZS MarkAndPass?
Definition: HBHEDataFrame.h:30
double minLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:29
bool passLooseRatio(const CommonHcalNoiseRBXData &) const
CalibDetType calibFlavor() const
get the flavor of this calibration detid
void fillrechits(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
bool passTightRBXRechitR45(const CommonHcalNoiseRBXData &) const
double maxHighEHitTime(void) const
Definition: HcalNoiseAlgo.h:34
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
bool passTightTiming(const CommonHcalNoiseRBXData &) const
double maxLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:30
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int numLowEHits(void) const
Definition: HcalNoiseAlgo.h:32
void produce(edm::Event &, const edm::EventSetup &) override
double ratio(void) const
Definition: HcalNoiseAlgo.h:21
std::vector< std::pair< double, double > > TS4TS5LowerCut_
HcalDetId id() const
get the id
Definition: HBHERecHit.h:25
std::set< edm::Ref< HBHERecHitCollection >, RefHBHERecHitEnergyComparison > refrechitset_
Definition: HcalNoiseHPD.h:145
std::vector< HBHEDataFrame >::const_iterator const_iterator
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:137
float maxE2Over10TS(void) const
edm::RefVector< CaloTowerCollection > loosenoisetwrs_
void fillcalotwrs(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:138
double pedestal(int fCapId) const
get pedestal for capid=0..3
HcalDetId idFront() const
Definition: HBHERecHit.cc:67
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool passLooseRBXRechitR45(const CommonHcalNoiseRBXData &) const
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
float min25GeVHitTime(void) const
bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
double RBXEMF(void) const
Definition: HcalNoiseAlgo.h:37
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:141
edm::EDGetTokenT< reco::PFJetCollection > jet_token_
int numRBXHits(void) const
Definition: HcalNoiseAlgo.h:26
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
float min10GeVHitTime(void) const
HcalNoiseRBXArray::iterator findRBX(int rbxindex)
double highEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:35
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
Definition: HcalCoderDb.cc:68
int iEvent
Definition: GenABIO.cc:230
float minE2Over10TS(void) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
bool passLooseZeros(const CommonHcalNoiseRBXData &) const
double emEnergy() const
Definition: CaloTower.h:110
int maxRBXHits(void) const
bool passTightZeros(const CommonHcalNoiseRBXData &) const
void filljetinfo(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
double pt() const
track transverse momentum
Definition: TrackBase.h:621
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
uint32_t flags() const
Definition: CaloRecHit.h:22
int numHighEHits(void) const
Definition: HcalNoiseAlgo.h:36
edm::EDGetTokenT< HcalCalibDigiCollection > hcalcalibdigi_token_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:69
bool passRatioThreshold(const CommonHcalNoiseRBXData &) const
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
bool dropChannel(const uint32_t &mystatus) const
int numHPDNoOtherHits(void) const
Definition: HcalNoiseAlgo.h:27
int numZeros(void) const
Definition: HcalNoiseAlgo.h:28
edm::EDGetTokenT< HBHEDigiCollection > hbhedigi_token_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
bool passZerosThreshold(const CommonHcalNoiseRBXData &) const
std::vector< std::pair< double, double > > TS4TS5UpperCut_
float minHPDEMF(void) const
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
edm::RefVector< CaloTowerCollection > rbxTowers(void) const
Definition: HcalNoiseAlgo.h:40
double hadEnergy() const
Definition: CaloTower.h:111
const_iterator end() const
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:115
edm::EDGetTokenT< reco::TrackCollection > track_token_
Definition: DetId.h:18
bool passLooseHits(const CommonHcalNoiseRBXData &) const
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
edm::EDGetTokenT< HBHERecHitCollection > hbherechit_token_
int size() const
get the size
Definition: CaloSamples.h:24
void filldigis(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &)
int maxZeros(void) const
const T & get() const
Definition: EventSetup.h:58
edm::RefVector< CaloTowerCollection > tightnoisetwrs_
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
et
define resolution functions of each parameter
double energy(void) const
Definition: HcalNoiseAlgo.h:20
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:17
int ietaAbs() const
Definition: CaloTower.h:186
bool passLooseTiming(const CommonHcalNoiseRBXData &) const
bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const
int maxHPDNoOtherHits(void) const
fixed size matrix
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double minHighEHitTime(void) const
Definition: HcalNoiseAlgo.h:33
static std::atomic< unsigned int > counter
double energyInNonLaserRegion_
float minRBXEMF(void) const
std::vector< int > calibdigiHBHEtimeslices_
const HcalTopology * theHcalTopology_
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
float eraw() const
Definition: HBHERecHit.h:31
bool PassTS4TS5(void) const
Definition: HcalNoiseAlgo.h:39
uint32_t getValue() const
bool passEMFThreshold(const CommonHcalNoiseRBXData &) const
void filltracks(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
HcalNoiseInfoProducer(const edm::ParameterSet &)
void fillOtherSummaryVariables(HcalNoiseSummary &summary, const CommonHcalNoiseRBXData &data) const
int maxHPDHits(void) const
int numHPDHits(void) const
Definition: HcalNoiseAlgo.h:25
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
float max25GeVHitTime(void) const
float max10GeVHitTime(void) const
const_iterator begin() const
bool validRatio(void) const
Definition: HcalNoiseAlgo.h:24
bool passTightHits(const CommonHcalNoiseRBXData &) const
edm::EDGetTokenT< CaloTowerCollection > calotower_token_