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