CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalHFStatusBitFromRecHits Class Reference

#include <HcalHFStatusBitFromRecHits.h>

Public Member Functions

double bit ()
 
 HcalHFStatusBitFromRecHits ()
 
 HcalHFStatusBitFromRecHits (double shortR, double shortET, double shortE, double longR, double longET, double longE)
 
void hfSetFlagFromRecHits (HFRecHitCollection &rec, HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
 
double long_energythreshold ()
 
double long_ETthreshold ()
 
double long_hflongshortratio ()
 
void set_long_energythreshold (double x)
 
void set_long_ETthreshold (double x)
 
void set_long_hflongshortratio (double x)
 
void set_short_energythreshold (double x)
 
void set_short_ETthreshold (double x)
 
void set_short_hflongshortratio (double x)
 
double short_energythreshold ()
 
double short_ETthreshold ()
 
double short_hflongshortratio ()
 
 ~HcalHFStatusBitFromRecHits ()
 

Private Attributes

double long_HFlongshortratio_
 
double long_thresholdEnergy_
 
double long_thresholdET_
 
double short_HFlongshortratio_
 
double short_thresholdEnergy_
 
double short_thresholdET_
 

Detailed Description

This class sets status bit in the status words for the revised CaloRecHit objets using comparisons between the rec hit energies of long and short fibers for a given HF (ieat, iphi)

Author
J. Temple – University of Maryland and E. Yazgan

Definition at line 18 of file HcalHFStatusBitFromRecHits.h.

Constructor & Destructor Documentation

◆ HcalHFStatusBitFromRecHits() [1/2]

HcalHFStatusBitFromRecHits::HcalHFStatusBitFromRecHits ( )

Full featured constructor for HB/HE and HO (HPD-based detectors)

Definition at line 9 of file HcalHFStatusBitFromRecHits.cc.

References long_HFlongshortratio_, long_thresholdEnergy_, long_thresholdET_, short_HFlongshortratio_, short_thresholdEnergy_, and short_thresholdET_.

9  {
10  // use simple values in default constructor
13  long_thresholdET_ = 0.5; // default energy requirement
14  short_thresholdET_ = 0.5;
17 }

◆ HcalHFStatusBitFromRecHits() [2/2]

HcalHFStatusBitFromRecHits::HcalHFStatusBitFromRecHits ( double  shortR,
double  shortET,
double  shortE,
double  longR,
double  longET,
double  longE 
)

◆ ~HcalHFStatusBitFromRecHits()

HcalHFStatusBitFromRecHits::~HcalHFStatusBitFromRecHits ( )

Definition at line 29 of file HcalHFStatusBitFromRecHits.cc.

29 {}

Member Function Documentation

◆ bit()

double HcalHFStatusBitFromRecHits::bit ( )
inline

◆ hfSetFlagFromRecHits()

void HcalHFStatusBitFromRecHits::hfSetFlagFromRecHits ( HFRecHitCollection rec,
HcalChannelQuality myqual,
const HcalSeverityLevelComputer mySeverity 
)

Definition at line 31 of file HcalHFStatusBitFromRecHits.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), LEDCalibrationChannels::depth, HcalSeverityLevelComputer::dropChannel(), edm::SortedCollection< T, SORT >::end(), HLT_2022v11_cff::eta1, HLT_2022v11_cff::eta2, HcalTopology::etaRange(), EnergyCorrector::etas, HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalForward, HcalCaloFlagLabels::HFLongShort, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, long_HFlongshortratio_, long_thresholdEnergy_, long_thresholdET_, particleFlowDisplacedVertex_cfi::ratio, DetId::rawId(), short_HFlongshortratio_, short_thresholdEnergy_, short_thresholdET_, mps_update::status, and HcalCondObjectContainerBase::topo().

33  {
34  // Compares energies from long & short fibers
35  int status;
36  float en, en2;
37  int ieta, iphi, depth;
38  float ratio; // ratio of (L-S)/(L+S) energy magnitudes
39  double coshEta;
40 
41  // Is there a faster way to do this than a double loop?
42  for (HFRecHitCollection::iterator iHF = rec.begin(); iHF != rec.end(); ++iHF) {
43  // skip cells that have already been tagged -- shouldn't happen in current algorithm
44  //if (iHF->flagField(HcalCaloFlagLabels::HFLongShort, HcalCaloFlagLabels::HFLongShort+1)) continue;
45 
46  ieta = iHF->id().ieta(); // int between 29-41
47  // eta = average value between cell eta bounds
48  std::pair<double, double> etas = myqual->topo()->etaRange(HcalForward, abs(ieta));
49  double eta1 = etas.first;
50  double eta2 = etas.second;
51  coshEta = fabs(cosh(0.5 * (eta1 + eta2)));
52 
53  status = 0; // status bit for rechit
54 
55  en2 = -999; // dummy starting value for partner energy
56  depth = iHF->id().depth();
57  en = iHF->energy(); // energy of current rechit
58 
59  if (depth == 1) // check long fiber
60  {
61  if (en < 1.2)
62  continue; // never flag long rechits < 1.2 GeV
64  continue;
65  if (long_thresholdET_ > 0. && en < long_thresholdET_ * coshEta)
66  continue;
67  }
68 
69  else if (depth == 2) // check short fiber
70  {
71  if (en < 1.8)
72  continue; // never flag short rechits < 1.8 GeV
74  continue;
75  if (short_thresholdET_ > 0. && en < short_thresholdET_ * coshEta)
76  continue;
77  }
78 
79  iphi = iHF->id().iphi();
80 
81  // Check for cells whose partners have been excluded from the rechit collections
82  // Such cells will not get flagged (since we can't make an L vs. S comparison)
83 
84  HcalDetId partner(HcalForward, ieta, iphi, 3 - depth); // if depth=1, 3-depth =2, and vice versa
85  DetId detpartner = DetId(partner);
86  const HcalChannelStatus* partnerstatus = myqual->getValues(detpartner.rawId());
87  if (mySeverity->dropChannel(partnerstatus->getValue()))
88  continue; // partner was dropped; don't set flag
89 
90  // inner loop will find 'partner' channel (same ieta, iphi, different depth)
91  for (HFRecHitCollection::iterator iHF2 = rec.begin(); iHF2 != rec.end(); ++iHF2) {
92  if (iHF2->id().ieta() != ieta)
93  continue; // require ieta match
94  if (iHF2->id().iphi() != iphi)
95  continue; // require iphi match
96  if (iHF2->id().depth() == depth)
97  continue; // require short/long combo
98 
99  en2 = iHF2->energy();
100 
101  /*
102  We used to use absolute values of energies for ratios, but I don't think we want to do this any more.
103  For example, for a threshold of 0.995, if en=50 and en2=0, the flag would be set.
104  But if en=50 and en2<-0.125, the threshold would not be set if using the absolute values.
105  I don't think we want to have a range of en2 below which the flag is not set.
106  This does mean that we need to be careful not to set the en energy threshold too low,
107  so as to not falsely flag fluctuations (en=2, en2=-0.01, for example), but we should never be setting our
108  thresholds that low.
109  */
110 
111  ratio = (en - en2) / (en + en2);
112 
113  if (depth == 1 && ratio > long_HFlongshortratio_)
114  status = 1;
115  else if (depth == 2 && ratio > short_HFlongshortratio_)
116  status = 1;
117  break; // once partner channel found, break out of loop
118  } // inner loop
119 
120  // Consider the case where only one depth present
121  if (en2 ==
122  -999) // outer rechit has already passed energy, ET thresholds above; no partner cell means this looks like isolated energy in one channel -- flag it!
123  status = 1;
124 
125  // flag rechit as potential PMT window hit
126  if (status == 1)
127  iHF->setFlagField(status, HcalCaloFlagLabels::HFLongShort, 1);
128  } // outer loop
129  return;
130 } // void HcalHFStatusBitFromRecHits::hfSetFlagFromRecHits(...)
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalTopology * topo() const
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const_iterator begin() const
uint32_t getValue() const
std::vector< T >::iterator iterator
const_iterator end() const
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool dropChannel(const uint32_t &mystatus) const

◆ long_energythreshold()

double HcalHFStatusBitFromRecHits::long_energythreshold ( )
inline

◆ long_ETthreshold()

double HcalHFStatusBitFromRecHits::long_ETthreshold ( )
inline

Definition at line 35 of file HcalHFStatusBitFromRecHits.h.

References long_thresholdET_.

◆ long_hflongshortratio()

double HcalHFStatusBitFromRecHits::long_hflongshortratio ( )
inline

◆ set_long_energythreshold()

void HcalHFStatusBitFromRecHits::set_long_energythreshold ( double  x)
inline

Definition at line 47 of file HcalHFStatusBitFromRecHits.h.

References long_thresholdEnergy_, and x.

47  {
49  return;
50  }

◆ set_long_ETthreshold()

void HcalHFStatusBitFromRecHits::set_long_ETthreshold ( double  x)
inline

Definition at line 51 of file HcalHFStatusBitFromRecHits.h.

References long_thresholdET_, and x.

51  {
53  return;
54  }

◆ set_long_hflongshortratio()

void HcalHFStatusBitFromRecHits::set_long_hflongshortratio ( double  x)
inline

Definition at line 43 of file HcalHFStatusBitFromRecHits.h.

References long_HFlongshortratio_, and x.

43  {
45  return;
46  }

◆ set_short_energythreshold()

void HcalHFStatusBitFromRecHits::set_short_energythreshold ( double  x)
inline

Definition at line 59 of file HcalHFStatusBitFromRecHits.h.

References short_thresholdEnergy_, and x.

59  {
61  return;
62  }

◆ set_short_ETthreshold()

void HcalHFStatusBitFromRecHits::set_short_ETthreshold ( double  x)
inline

Definition at line 63 of file HcalHFStatusBitFromRecHits.h.

References short_thresholdET_, and x.

63  {
65  return;
66  }

◆ set_short_hflongshortratio()

void HcalHFStatusBitFromRecHits::set_short_hflongshortratio ( double  x)
inline

Definition at line 55 of file HcalHFStatusBitFromRecHits.h.

References short_HFlongshortratio_, and x.

55  {
57  return;
58  }

◆ short_energythreshold()

double HcalHFStatusBitFromRecHits::short_energythreshold ( )
inline

◆ short_ETthreshold()

double HcalHFStatusBitFromRecHits::short_ETthreshold ( )
inline

Definition at line 38 of file HcalHFStatusBitFromRecHits.h.

References short_thresholdET_.

◆ short_hflongshortratio()

double HcalHFStatusBitFromRecHits::short_hflongshortratio ( )
inline

Member Data Documentation

◆ long_HFlongshortratio_

double HcalHFStatusBitFromRecHits::long_HFlongshortratio_
private

◆ long_thresholdEnergy_

double HcalHFStatusBitFromRecHits::long_thresholdEnergy_
private

◆ long_thresholdET_

double HcalHFStatusBitFromRecHits::long_thresholdET_
private

◆ short_HFlongshortratio_

double HcalHFStatusBitFromRecHits::short_HFlongshortratio_
private

◆ short_thresholdEnergy_

double HcalHFStatusBitFromRecHits::short_thresholdEnergy_
private

◆ short_thresholdET_

double HcalHFStatusBitFromRecHits::short_thresholdET_
private