CMS 3D CMS Logo

HcalHaloAlgo.cc
Go to the documentation of this file.
2 #include <map>
3 
4 /*
5  [class]: HcalHaloAlgo
6  [authors]: R. Remington, The University of Florida
7  [description]: See HcalHaloAlgo.h
8  [date]: October 15, 2009
9 */
10 namespace {
11  constexpr float c_cm_per_ns = 29.9792458;
12  constexpr float zseparation_HBHE = 380.;
13 }; // namespace
14 
15 using namespace reco;
16 
17 #include <iomanip>
18 bool CompareTime(const HBHERecHit* x, const HBHERecHit* y) { return x->time() < y->time(); }
19 bool CompareTowers(const CaloTower* x, const CaloTower* y) {
20  return x->iphi() * 1000 + x->ieta() < y->iphi() * 1000 + y->ieta();
21 }
22 
26  SumEnergyThreshold = 0.;
27  NHitsThreshold = 0;
28 }
29 
31  edm::Handle<HBHERecHitCollection>& TheHBHERecHits,
32  edm::Handle<EBRecHitCollection>& TheEBRecHits,
33  edm::Handle<EERecHitCollection>& TheEERecHits,
34  const edm::EventSetup& TheSetup) {
36  return Calculate(TheCaloGeometry, TheHBHERecHits, TheCaloTowers, TheEBRecHits, TheEERecHits, TheSetup);
37 }
38 
40  edm::Handle<HBHERecHitCollection>& TheHBHERecHits,
41  edm::Handle<CaloTowerCollection>& TheCaloTowers,
42  edm::Handle<EBRecHitCollection>& TheEBRecHits,
43  edm::Handle<EERecHitCollection>& TheEERecHits,
44  const edm::EventSetup& TheSetup) {
45  HcalHaloData TheHcalHaloData;
46  // ieta overlap geometrically w/ HB
47  const int iEtaOverlap = 22;
48  const int nPhiMax = 73;
49  // Store Energy sum of rechits as a function of iPhi (iPhi goes from 1 to 72)
50  float SumE[nPhiMax];
51  // Store Number of rechits as a function of iPhi
52  int NumHits[nPhiMax];
53  // Store minimum time of rechit as a function of iPhi
54  float MinTimeHits[nPhiMax];
55  // Store maximum time of rechit as a function of iPhi
56  float MaxTimeHits[nPhiMax];
57  for (unsigned int i = 0; i < nPhiMax; i++) {
58  SumE[i] = 0;
59  NumHits[i] = 0;
60  MinTimeHits[i] = 0.;
61  MaxTimeHits[i] = 0.;
62  }
63 
64  for (const auto& hit : (*TheHBHERecHits)) {
65  HcalDetId id = HcalDetId(hit.id());
66  switch (id.subdet()) {
67  case HcalBarrel:
68  if (hit.energy() < HBRecHitEnergyThreshold)
69  continue;
70  break;
71  case HcalEndcap:
72  if (hit.energy() < HERecHitEnergyThreshold)
73  continue;
74  break;
75  default:
76  continue;
77  }
78 
79  int iEta = id.ieta();
80  int iPhi = id.iphi();
81  if (iPhi < nPhiMax && std::abs(iEta) <= iEtaOverlap) {
82  SumE[iPhi] += hit.energy();
83  NumHits[iPhi]++;
84 
85  float time = hit.time();
86  MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
87  MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
88  }
89  }
90 
91  for (int iPhi = 1; iPhi < nPhiMax; iPhi++) {
92  if (SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold) {
93  // Build PhiWedge and store to HcalHaloData if energy or #hits pass thresholds
94  PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
95 
96  // Loop over rechits again to calculate direction based on timing info
97  std::vector<const HBHERecHit*> Hits;
98  for (const auto& hit : (*TheHBHERecHits)) {
99  HcalDetId id = HcalDetId(hit.id());
100  if (id.iphi() != iPhi)
101  continue;
102  if (std::abs(id.ieta()) > iEtaOverlap)
103  continue; // has to overlap geometrically w/ HB
104  switch (id.subdet()) {
105  case HcalBarrel:
106  if (hit.energy() < HBRecHitEnergyThreshold)
107  continue;
108  break;
109  case HcalEndcap:
110  if (hit.energy() < HERecHitEnergyThreshold)
111  continue;
112  break;
113  default:
114  continue;
115  }
116  Hits.push_back(&(hit));
117  }
118 
119  std::sort(Hits.begin(), Hits.end(), CompareTime);
120  float MinusToPlus = 0.;
121  float PlusToMinus = 0.;
122  for (unsigned int i = 0; i < Hits.size(); i++) {
123  HcalDetId id_i = HcalDetId(Hits[i]->id());
124  int ieta_i = id_i.ieta();
125  for (unsigned int j = (i + 1); j < Hits.size(); j++) {
126  HcalDetId id_j = HcalDetId(Hits[j]->id());
127  int ieta_j = id_j.ieta();
128  if (ieta_i > ieta_j)
129  PlusToMinus += std::abs(ieta_i - ieta_j);
130  else
131  MinusToPlus += std::abs(ieta_i - ieta_j);
132  }
133  }
134  float PlusZOriginConfidence = (PlusToMinus + MinusToPlus) ? PlusToMinus / (PlusToMinus + MinusToPlus) : -1.;
135  wedge.SetPlusZOriginConfidence(PlusZOriginConfidence);
136  TheHcalHaloData.GetPhiWedges().push_back(wedge);
137  }
138  }
139 
140  // Don't use HF.
141  int maxAbsIEta = 29;
142 
143  std::map<int, float> iPhiHadEtMap;
144  std::vector<const CaloTower*> sortedCaloTowers;
145  for (const auto& tower : (*TheCaloTowers)) {
146  if (std::abs(tower.ieta()) > maxAbsIEta)
147  continue;
148 
149  int iPhi = tower.iphi();
150  if (!iPhiHadEtMap.count(iPhi))
151  iPhiHadEtMap[iPhi] = 0.0;
152  iPhiHadEtMap[iPhi] += tower.hadEt();
153 
154  if (tower.numProblematicHcalCells() > 0)
155  sortedCaloTowers.push_back(&(tower));
156  }
157 
158  // Sort towers such that lowest iphi and ieta are first, highest last, and towers
159  // with same iphi value are consecutive. Then we can do everything else in one loop.
160  std::sort(sortedCaloTowers.begin(), sortedCaloTowers.end(), CompareTowers);
161 
163 
164  int prevIEta = -99, prevIPhi = -99;
165  float prevHadEt = 0.;
166  float prevEmEt = 0.;
167  std::pair<uint8_t, CaloTowerDetId> prevPair, towerPair;
168  bool wasContiguous = true;
169 
170  // Loop through and store a vector of pairs (problematicCells, DetId) for each contiguous strip we find
171  for (unsigned int i = 0; i < sortedCaloTowers.size(); i++) {
172  const CaloTower* tower = sortedCaloTowers[i];
173 
174  towerPair = std::make_pair((uint8_t)tower->numProblematicHcalCells(), tower->id());
175 
176  bool newIPhi = tower->iphi() != prevIPhi;
177  bool isContiguous = tower->ieta() == 1 ? tower->ieta() - 2 == prevIEta : tower->ieta() - 1 == prevIEta;
178 
179  isContiguous = isContiguous || (tower->ieta() == -maxAbsIEta);
180  if (newIPhi)
181  isContiguous = false;
182 
183  if (!wasContiguous && isContiguous) {
184  strip.cellTowerIds.push_back(prevPair);
185  strip.cellTowerIds.push_back(towerPair);
186  strip.hadEt += prevHadEt + tower->hadEt();
187  strip.emEt += prevEmEt + tower->emEt();
188  }
189 
190  if (wasContiguous && isContiguous) {
191  strip.cellTowerIds.push_back(towerPair);
192  strip.hadEt += tower->hadEt();
193  strip.emEt += tower->emEt();
194  }
195 
196  if ((wasContiguous && !isContiguous) || i == sortedCaloTowers.size() - 1) { //ended the strip, so flush it
197 
198  if (strip.cellTowerIds.size() > 3) {
199  int iPhi = strip.cellTowerIds.at(0).second.iphi();
200  int iPhiLower = (iPhi == 1) ? 72 : iPhi - 1;
201  int iPhiUpper = (iPhi == 72) ? 1 : iPhi + 1;
202 
203  float energyRatio = 0.0;
204  if (iPhiHadEtMap.count(iPhiLower))
205  energyRatio += iPhiHadEtMap[iPhiLower];
206  if (iPhiHadEtMap.count(iPhiUpper))
207  energyRatio += iPhiHadEtMap[iPhiUpper];
208  iPhiHadEtMap[iPhi] = std::max(iPhiHadEtMap[iPhi], 0.001F);
209 
210  energyRatio /= iPhiHadEtMap[iPhi];
211  strip.energyRatio = energyRatio;
212 
213  TheHcalHaloData.getProblematicStrips().push_back(strip);
214  }
215  strip = HaloTowerStrip();
216  }
217 
218  wasContiguous = isContiguous;
219  prevPair = towerPair;
220  prevEmEt = tower->emEt();
221  prevIPhi = tower->iphi();
222  prevIEta = tower->ieta();
223  prevHadEt = tower->hadEt();
224  }
225 
227  TheSetup.get<CaloGeometryRecord>().get(pGeo);
228  geo_ = pGeo.product();
229  hgeo_ = dynamic_cast<const HcalGeometry*>(geo_->getSubdetectorGeometry(DetId::Hcal, 1));
230 
231  //Halo cluster building:
232  //Various clusters are built, depending on the subdetector.
233  //In barrel, one looks for deposits narrow in phi.
234  //In endcaps, one looks for localized deposits (dr condition in EE where r =sqrt(dphi*dphi+deta*deta)
235  //E/H condition is also applied.
236  //The halo cluster building step targets a large efficiency (ideally >99%) for beam halo deposits.
237  //These clusters are used as input for the halo pattern finding methods in HcalHaloAlgo and for the CSC-calo matching methods in GlobalHaloAlgo.
238 
239  //Et threshold hardcoded for now. Might one to get it from config
240 
241  std::vector<HaloClusterCandidateHCAL> haloclustercands_HB;
242  haloclustercands_HB = GetHaloClusterCandidateHB(TheEBRecHits, TheHBHERecHits, 5);
243 
244  std::vector<HaloClusterCandidateHCAL> haloclustercands_HE;
245  haloclustercands_HE = GetHaloClusterCandidateHE(TheEERecHits, TheHBHERecHits, 10);
246 
247  TheHcalHaloData.setHaloClusterCandidatesHB(haloclustercands_HB);
248  TheHcalHaloData.setHaloClusterCandidatesHE(haloclustercands_HE);
249 
250  return TheHcalHaloData;
251 }
252 
253 std::vector<HaloClusterCandidateHCAL> HcalHaloAlgo::GetHaloClusterCandidateHB(
254  edm::Handle<EcalRecHitCollection>& ecalrechitcoll,
255  edm::Handle<HBHERecHitCollection>& hbherechitcoll,
256  float et_thresh_seedrh) {
257  std::vector<HaloClusterCandidateHCAL> TheHaloClusterCandsHB;
258 
259  reco::Vertex::Point vtx(0, 0, 0);
260 
261  for (size_t ihit = 0; ihit < hbherechitcoll->size(); ++ihit) {
262  HaloClusterCandidateHCAL clustercand;
263 
264  const HBHERecHit& rechit = (*hbherechitcoll)[ihit];
265  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
266  //Et condition
267  double rhet = rechit.energy() * sqrt(rhpos.perp2() / rhpos.mag2());
268  if (rhet < et_thresh_seedrh)
269  continue;
270  if (std::abs(rhpos.z()) > zseparation_HBHE)
271  continue;
272  double eta = rhpos.eta();
273  double phi = rhpos.phi();
274 
275  bool isiso = true;
276  double etcluster(0);
277  int nbtowerssameeta(0);
278  double timediscriminatorITBH(0), timediscriminatorOTBH(0);
279  double etstrip_phiseedplus1(0), etstrip_phiseedminus1(0);
280 
281  //Building the cluster
283  for (size_t jhit = 0; jhit < hbherechitcoll->size(); ++jhit) {
284  const HBHERecHit& rechitj = (*hbherechitcoll)[jhit];
285  HBHERecHitRef rhRef(hbherechitcoll, jhit);
286  math::XYZPoint rhposj = getPosition(rechitj.id(), vtx);
287  double rhetj = rechitj.energy() * sqrt(rhposj.perp2() / rhposj.mag2());
288  if (rhetj < 2)
289  continue;
290  if (std::abs(rhposj.z()) > zseparation_HBHE)
291  continue;
292  double etaj = rhposj.eta();
293  double phij = rhposj.phi();
294  double deta = eta - etaj;
295  double dphi = deltaPhi(phi, phij);
296  if (std::abs(deta) > 0.4)
297  continue; //This means +/-4 towers in eta
298  if (std::abs(dphi) > 0.2)
299  continue; //This means +/-2 towers in phi
300  if (std::abs(dphi) > 0.1 && std::abs(deta) < 0.2) {
301  isiso = false;
302  break;
303  } //The strip should be isolated
304  if (std::abs(dphi) > 0.1)
305  continue;
306  if (std::abs(dphi) < 0.05)
307  nbtowerssameeta++;
308  if (dphi > 0.05)
309  etstrip_phiseedplus1 += rhetj;
310  if (dphi < -0.05)
311  etstrip_phiseedminus1 += rhetj;
312 
313  etcluster += rhetj;
314  //Timing discriminator
315  //We assign a weight to the rechit defined as:
316  //Log10(Et)*f(T,R,Z)
317  //where f(T,R,Z) is the separation curve between halo-like and IP-like times.
318  //The time difference between a deposit from a outgoing IT halo and a deposit coming from a particle emitted at the IP is given by:
319  //dt= ( - sqrt(R^2+z^2) + |z| )/c
320  // For OT beam halo, the time difference is:
321  //dt= ( 25 + sqrt(R^2+z^2) + |z| )/c
322  //only consider the central part of HB as things get hard at large z.
323  //The best fitted value for R leads to 240 cm (IT) and 330 cm (OT)
324  double rhtj = rechitj.time();
325  timediscriminatorITBH +=
326  std::log10(rhetj) *
327  (rhtj + 0.5 * (sqrt(240. * 240. + rhposj.z() * rhposj.z()) - std::abs(rhposj.z())) / c_cm_per_ns);
328  if (std::abs(rhposj.z()) < 300)
329  timediscriminatorOTBH +=
330  std::log10(rhetj) *
331  (rhtj - 0.5 * (25 - (sqrt(330. * 330. + rhposj.z() * rhposj.z()) + std::abs(rhposj.z())) / c_cm_per_ns));
332  bhrhcandidates.push_back(rhRef);
333  }
334  //Isolation conditions
335  if (!isiso)
336  continue;
337  if (etstrip_phiseedplus1 / etcluster > 0.2 && etstrip_phiseedminus1 / etcluster > 0.2)
338  continue;
339 
340  //Calculate E/H
341  double eoh(0);
342  for (size_t jhit = 0; jhit < ecalrechitcoll->size(); ++jhit) {
343  const EcalRecHit& rechitj = (*ecalrechitcoll)[jhit];
344  math::XYZPoint rhposj = getPosition(rechitj.id(), vtx);
345  double rhetj = rechitj.energy() * sqrt(rhposj.perp2() / rhposj.mag2());
346  if (rhetj < 2)
347  continue;
348  double etaj = rhposj.eta();
349  double phij = rhposj.phi();
350  if (std::abs(eta - etaj) > 0.2)
351  continue;
352  if (std::abs(deltaPhi(phi, phij)) > 0.2)
353  continue;
354  eoh += rhetj / etcluster;
355  }
356  //E/H condition
357  if (eoh > 0.1)
358  continue;
359 
360  clustercand.setClusterEt(etcluster);
361  clustercand.setSeedEt(rhet);
362  clustercand.setSeedEta(eta);
363  clustercand.setSeedPhi(phi);
364  clustercand.setSeedZ(rhpos.Z());
365  clustercand.setSeedR(sqrt(rhpos.perp2()));
366  clustercand.setSeedTime(rechit.time());
367  clustercand.setEoverH(eoh);
368  clustercand.setNbTowersInEta(nbtowerssameeta);
369  clustercand.setEtStripPhiSeedPlus1(etstrip_phiseedplus1);
370  clustercand.setEtStripPhiSeedMinus1(etstrip_phiseedminus1);
371  clustercand.setTimeDiscriminatorITBH(timediscriminatorITBH);
372  clustercand.setTimeDiscriminatorOTBH(timediscriminatorOTBH);
373  clustercand.setBeamHaloRecHitsCandidates(bhrhcandidates);
374 
375  bool isbeamhalofrompattern = HBClusterShapeandTimeStudy(clustercand, false);
376  clustercand.setIsHaloFromPattern(isbeamhalofrompattern);
377  bool isbeamhalofrompattern_hlt = HBClusterShapeandTimeStudy(clustercand, true);
378  clustercand.setIsHaloFromPattern_HLT(isbeamhalofrompattern_hlt);
379 
380  TheHaloClusterCandsHB.push_back(clustercand);
381  }
382 
383  return TheHaloClusterCandsHB;
384 }
385 
386 std::vector<HaloClusterCandidateHCAL> HcalHaloAlgo::GetHaloClusterCandidateHE(
387  edm::Handle<EcalRecHitCollection>& ecalrechitcoll,
388  edm::Handle<HBHERecHitCollection>& hbherechitcoll,
389  float et_thresh_seedrh) {
390  std::vector<HaloClusterCandidateHCAL> TheHaloClusterCandsHE;
391 
392  reco::Vertex::Point vtx(0, 0, 0);
393 
394  for (size_t ihit = 0; ihit < hbherechitcoll->size(); ++ihit) {
395  HaloClusterCandidateHCAL clustercand;
396 
397  const HBHERecHit& rechit = (*hbherechitcoll)[ihit];
398  math::XYZPoint rhpos = getPosition(rechit.id(), vtx);
399  //Et condition
400  double rhet = rechit.energy() * sqrt(rhpos.perp2() / rhpos.mag2());
401  if (rhet < et_thresh_seedrh)
402  continue;
403  if (std::abs(rhpos.z()) < zseparation_HBHE)
404  continue;
405  double eta = rhpos.eta();
406  double phi = rhpos.phi();
407  double rhr = sqrt(rhpos.perp2());
408  bool isiso = true;
409  double etcluster(0), hdepth1(0);
410  int clustersize(0);
411  double etstrip_phiseedplus1(0), etstrip_phiseedminus1(0);
412 
413  //Building the cluster
415  for (size_t jhit = 0; jhit < hbherechitcoll->size(); ++jhit) {
416  const HBHERecHit& rechitj = (*hbherechitcoll)[jhit];
417  HBHERecHitRef rhRef(hbherechitcoll, jhit);
418  math::XYZPoint rhposj = getPosition(rechitj.id(), vtx);
419  double rhetj = rechitj.energy() * sqrt(rhposj.perp2() / rhposj.mag2());
420  if (rhetj < 2)
421  continue;
422  if (std::abs(rhposj.z()) < zseparation_HBHE)
423  continue;
424  if (rhpos.z() * rhposj.z() < 0)
425  continue;
426  double phij = rhposj.phi();
427  double dphi = deltaPhi(phi, phij);
428  if (std::abs(dphi) > 0.4)
429  continue;
430  double rhrj = sqrt(rhposj.perp2());
431  if (std::abs(rhr - rhrj) > 50)
432  continue;
433  if (std::abs(dphi) > 0.2 || std::abs(rhr - rhrj) > 20) {
434  isiso = false;
435  break;
436  } //The deposit should be isolated
437  if (dphi > 0.05)
438  etstrip_phiseedplus1 += rhetj;
439  if (dphi < -0.05)
440  etstrip_phiseedminus1 += rhetj;
441  clustersize++;
442  etcluster += rhetj;
443  if (std::abs(rhposj.z()) < 405)
444  hdepth1 += rhetj;
445  //No timing condition for now in HE
446  bhrhcandidates.push_back(rhRef);
447  }
448  //Isolation conditions
449  if (!isiso)
450  continue;
451  if (etstrip_phiseedplus1 / etcluster > 0.1 && etstrip_phiseedminus1 / etcluster > 0.1)
452  continue;
453 
454  //Calculate E/H
455  double eoh(0);
456  for (size_t jhit = 0; jhit < ecalrechitcoll->size(); ++jhit) {
457  const EcalRecHit& rechitj = (*ecalrechitcoll)[jhit];
458  math::XYZPoint rhposj = getPosition(rechitj.id(), vtx);
459  double rhetj = rechitj.energy() * sqrt(rhposj.perp2() / rhposj.mag2());
460  if (rhetj < 2)
461  continue;
462  if (rhpos.z() * rhposj.z() < 0)
463  continue;
464  double etaj = rhposj.eta();
465  double phij = rhposj.phi();
466  double dr = sqrt((eta - etaj) * (eta - etaj) + deltaPhi(phi, phij) * deltaPhi(phi, phij));
467  if (dr > 0.3)
468  continue;
469 
470  eoh += rhetj / etcluster;
471  }
472  //E/H condition
473  if (eoh > 0.1)
474  continue;
475 
476  clustercand.setClusterEt(etcluster);
477  clustercand.setSeedEt(rhet);
478  clustercand.setSeedEta(eta);
479  clustercand.setSeedPhi(phi);
480  clustercand.setSeedZ(rhpos.Z());
481  clustercand.setSeedR(sqrt(rhpos.perp2()));
482  clustercand.setSeedTime(rechit.time());
483  clustercand.setEoverH(eoh);
484  clustercand.setH1overH123(hdepth1 / etcluster);
485  clustercand.setClusterSize(clustersize);
486  clustercand.setEtStripPhiSeedPlus1(etstrip_phiseedplus1);
487  clustercand.setEtStripPhiSeedMinus1(etstrip_phiseedminus1);
488  clustercand.setTimeDiscriminator(0);
489  clustercand.setBeamHaloRecHitsCandidates(bhrhcandidates);
490 
491  bool isbeamhalofrompattern = HEClusterShapeandTimeStudy(clustercand, false);
492  clustercand.setIsHaloFromPattern(isbeamhalofrompattern);
493  bool isbeamhalofrompattern_hlt = HEClusterShapeandTimeStudy(clustercand, true);
494  clustercand.setIsHaloFromPattern_HLT(isbeamhalofrompattern_hlt);
495 
496  TheHaloClusterCandsHE.push_back(clustercand);
497  }
498 
499  return TheHaloClusterCandsHE;
500 }
501 
503  //Conditions on the central strip size in eta.
504  //For low size, extra conditions on seed et, isolation and cluster timing
505  //Here we target both IT and OT beam halo. Two separate discriminators were built for the two cases.
506 
507  if (hcand.getSeedEt() < 10)
508  return false;
509 
510  if (hcand.getNbTowersInEta() < 3)
511  return false;
512  //Isolation criteria for very short eta strips
513  if (hcand.getNbTowersInEta() == 3 && (hcand.getEtStripPhiSeedPlus1() > 0.1 || hcand.getEtStripPhiSeedMinus1() > 0.1))
514  return false;
515  if (hcand.getNbTowersInEta() <= 5 && (hcand.getEtStripPhiSeedPlus1() > 0.1 && hcand.getEtStripPhiSeedMinus1() > 0.1))
516  return false;
517 
518  //Timing conditions for short eta strips
519  if (hcand.getNbTowersInEta() == 3 && hcand.getTimeDiscriminatorITBH() >= 0.)
520  return false;
521  if (hcand.getNbTowersInEta() <= 6 && hcand.getTimeDiscriminatorITBH() >= 5. && hcand.getTimeDiscriminatorOTBH() < 0.)
522  return false;
523 
524  //For HLT, only use conditions without timing
525  if (ishlt && hcand.getNbTowersInEta() < 7)
526  return false;
527 
528  hcand.setIsHaloFromPattern(true);
529 
530  return true;
531 }
532 
534  //Conditions on H1/H123 to spot halo interacting only in one HCAL layer.
535  //For R> about 170cm, HE has only one layer and this condition cannot be applied
536  //Note that for R>170 cm, the halo is in CSC acceptance and will most likely be spotted by the CSC-calo matching method
537  //A method to identify halos interacting in both H1 and H2/H3 at low R is still missing.
538 
539  if (hcand.getSeedEt() < 20)
540  return false;
541  if (hcand.getSeedR() > 170)
542  return false;
543 
544  if (hcand.getH1overH123() > 0.02 && hcand.getH1overH123() < 0.98)
545  return false;
546 
547  //This method is one of the ones with the highest fake rate: in JetHT dataset, it happens in around 0.1% of the cases that a low pt jet (pt= 20) leaves all of its energy in only one HCAL layer.
548  //At HLT, one only cares about large deposits from BH that would lead to a MET/SinglePhoton trigger to be fired.
549  //Rising the seed Et threshold at HLT has therefore little impact on the HLT performances but ensures that possible controversial events are still recorded.
550  if (ishlt && hcand.getSeedEt() < 50)
551  return false;
552 
553  hcand.setIsHaloFromPattern(true);
554 
555  return true;
556 }
557 
559  const GlobalPoint pos = ((id.det() == DetId::Hcal) ? hgeo_->getPosition(id) : GlobalPoint(geo_->getPosition(id)));
560  math::XYZPoint posV(pos.x() - vtx.x(), pos.y() - vtx.y(), pos.z() - vtx.z());
561  return posV;
562 }
constexpr float energy() const
Definition: CaloRecHit.h:29
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:96
void setHaloClusterCandidatesHB(const std::vector< HaloClusterCandidateHCAL > &x)
Definition: HcalHaloData.h:58
int ieta() const
Definition: CaloTower.h:204
double hadEt() const
Definition: CaloTower.h:140
HcalDetId id() const
get the id
Definition: HBHERecHit.h:39
#define nullptr
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
int iphi() const
Definition: CaloTower.h:206
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHE(edm::Handle< EcalRecHitCollection > &eerechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
const CaloGeometry * geo_
Definition: HcalHaloAlgo.h:102
bool HBClusterShapeandTimeStudy(reco::HaloClusterCandidateHCAL hcand, bool ishlt)
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
constexpr float time() const
Definition: CaloRecHit.h:31
int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
void setHaloClusterCandidatesHE(const std::vector< HaloClusterCandidateHCAL > &x)
Definition: HcalHaloData.h:59
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void SetPlusZOriginConfidence(float x)
Definition: PhiWedge.h:69
float energy() const
Definition: EcalRecHit.h:68
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
bool CompareTime(const HBHERecHit *x, const HBHERecHit *y)
Definition: HcalHaloAlgo.cc:18
GlobalPoint getPosition(const DetId &id) const
unsigned int id
reco::HcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, edm::Handle< CaloTowerCollection > &TheCaloTowers, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, const edm::EventSetup &TheSetup)
Definition: HcalHaloAlgo.cc:39
Definition: DetId.h:17
CaloTowerDetId id() const
Definition: CaloTower.h:127
unsigned int numProblematicHcalCells() const
Definition: CaloTower.h:221
DetId id() const
get the id
Definition: EcalRecHit.h:77
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool CompareTowers(const CaloTower *x, const CaloTower *y)
Definition: HcalHaloAlgo.cc:19
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:95
const HcalGeometry * hgeo_
Definition: HcalHaloAlgo.h:103
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:99
fixed size matrix
size_type size() const
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
const std::vector< HaloTowerStrip > & getProblematicStrips() const
Definition: HcalHaloData.h:49
T get() const
Definition: EventSetup.h:73
void setBeamHaloRecHitsCandidates(edm::RefVector< HBHERecHitCollection > x)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: HcalHaloData.h:45
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
T x() const
Definition: PV3DBase.h:59
T const * product() const
Definition: ESHandle.h:86
bool HEClusterShapeandTimeStudy(reco::HaloClusterCandidateHCAL hcand, bool ishlt)
double emEt() const
Definition: CaloTower.h:139
#define constexpr
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHB(edm::Handle< EcalRecHitCollection > &ebrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)