CMS 3D CMS Logo

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

#include <HcalHF_PETalgorithm.h>

Public Member Functions

double bit ()
 
double CalcThreshold (double abs_energy, const std::vector< double > &params)
 
std::vector< double > GetLong_Energy_Thresh ()
 
std::vector< double > GetLong_ET_Thresh ()
 
std::vector< double > GetLong_R ()
 
std::vector< double > GetShort_Energy_Thresh ()
 
std::vector< double > GetShort_ET_Thresh ()
 
std::vector< double > GetShort_R ()
 
 HcalHF_PETalgorithm ()
 
 HcalHF_PETalgorithm (const std::vector< double > &short_R, const std::vector< double > &short_Energy, const std::vector< double > &short_ET, const std::vector< double > &long_R, const std::vector< double > &long_Energy, const std::vector< double > &long_ET, int HcalAcceptSeverityLevel, const std::vector< double > &short_R_29, const std::vector< double > &long_R_29)
 
void HFSetFlagFromPET (HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
 
void SetLong_Energy_Thresh (const std::vector< double > &x)
 
void SetLong_ET_Thresh (const std::vector< double > &x)
 
void SetLong_R (const std::vector< double > &x)
 
void SetShort_Energy_Thresh (const std::vector< double > &x)
 
void SetShort_ET_Thresh (const std::vector< double > &x)
 
void SetShort_R (const std::vector< double > &x)
 
 ~HcalHF_PETalgorithm ()
 

Private Attributes

int HcalAcceptSeverityLevel_
 
std::vector< double > long_Energy_Thresh
 
std::vector< double > long_ET_Thresh
 
std::vector< double > long_R
 
std::vector< double > long_R_29
 
std::vector< double > short_Energy_Thresh
 
std::vector< double > short_ET_Thresh
 
std::vector< double > short_R
 
std::vector< double > short_R_29
 

Detailed Description

Class evaluates the ratio |(L-S)/(L+S)| for a given cell, and flags the cell if the threshold exceeds a given maximum value R(Energy). Each cell must also pass ieta-dependent energy and ET cuts to be considered for flagging.

Author
J. Temple and D. Ferencek

Definition at line 21 of file HcalHF_PETalgorithm.h.

Constructor & Destructor Documentation

◆ HcalHF_PETalgorithm() [1/2]

HcalHF_PETalgorithm::HcalHF_PETalgorithm ( )

Constructors

Definition at line 13 of file HcalHF_PETalgorithm.cc.

References HcalAcceptSeverityLevel_, long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, short_Energy_Thresh, short_ET_Thresh, short_R, and short_R_29.

13  {
14  // no params given; revert to old 'algo 1' fixed settings
15  short_R.clear();
16  short_R.push_back(0.995);
17  short_R_29.clear();
18  short_R_29.push_back(0.995);
19  short_Energy_Thresh.clear();
20  short_Energy_Thresh.push_back(50);
21  short_ET_Thresh.clear();
22  short_ET_Thresh.push_back(0);
23 
24  long_R.clear();
25  long_R.push_back(0.995);
26  long_R_29.clear();
27  long_R_29.push_back(0.995);
28  long_Energy_Thresh.clear();
29  long_Energy_Thresh.push_back(50);
30  long_ET_Thresh.clear();
31  long_ET_Thresh.push_back(0);
33 }
std::vector< double > long_ET_Thresh
std::vector< double > long_Energy_Thresh
std::vector< double > short_R
std::vector< double > long_R
std::vector< double > long_R_29
std::vector< double > short_ET_Thresh
std::vector< double > short_Energy_Thresh
std::vector< double > short_R_29

◆ HcalHF_PETalgorithm() [2/2]

HcalHF_PETalgorithm::HcalHF_PETalgorithm ( const std::vector< double > &  short_R,
const std::vector< double > &  short_Energy,
const std::vector< double > &  short_ET,
const std::vector< double > &  long_R,
const std::vector< double > &  long_Energy,
const std::vector< double > &  long_ET,
int  HcalAcceptSeverityLevel,
const std::vector< double > &  short_R_29,
const std::vector< double > &  long_R_29 
)

Definition at line 35 of file HcalHF_PETalgorithm.cc.

References HLT_2024v14_cff::HcalAcceptSeverityLevel, HcalAcceptSeverityLevel_, long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, HLT_2024v14_cff::longEnergyParams, HLT_2024v14_cff::longETParams, short_Energy_Thresh, short_ET_Thresh, short_R, short_R_29, HLT_2024v14_cff::shortEnergyParams, and HLT_2024v14_cff::shortETParams.

43  {
44  // R is parameterized depending on the energy of the cells, so just store the parameters here
45  short_R = shortR;
46  long_R = longR;
47  short_R_29 = shortR29;
48  long_R_29 = longR29;
49 
50  // Energy and ET cuts are ieta-dependent, and only need to be calculated once!
51  short_Energy_Thresh.clear();
52  short_ET_Thresh.clear();
53  long_Energy_Thresh.clear();
54  long_ET_Thresh.clear();
55 
56  //separate short, long cuts provided for each ieta
61 
63 }
std::vector< double > long_ET_Thresh
std::vector< double > long_Energy_Thresh
std::vector< double > short_R
std::vector< double > long_R
std::vector< double > long_R_29
std::vector< double > short_ET_Thresh
std::vector< double > short_Energy_Thresh
std::vector< double > short_R_29

◆ ~HcalHF_PETalgorithm()

HcalHF_PETalgorithm::~HcalHF_PETalgorithm ( )

Definition at line 65 of file HcalHF_PETalgorithm.cc.

65 {}

Member Function Documentation

◆ bit()

double HcalHF_PETalgorithm::bit ( )
inline

◆ CalcThreshold()

double HcalHF_PETalgorithm::CalcThreshold ( double  abs_energy,
const std::vector< double > &  params 
)

Definition at line 151 of file HcalHF_PETalgorithm.cc.

References mps_fire::i, submitPVValidationJobs::params, funct::pow(), and DiMuonV_cfg::threshold.

Referenced by HFSetFlagFromPET().

151  {
152  /* CalcEnergyThreshold calculates the polynomial [0]+[1]*x + [2]*x^2 + ....,
153  where x is an integer provided by the first argument (int double abs_x),
154  and [0],[1],[2] is a vector of doubles provided by the second (std::vector<double> params).
155  The output of the polynomial calculation (threshold) is returned by the function.
156  */
157  double threshold = 0;
158  for (std::vector<double>::size_type i = 0; i < params.size(); ++i) {
159  threshold += params[i] * pow(abs_x, (int)i);
160  }
161  return threshold;
162 } //double HcalHF_PETalgorithm::CalcThreshold(double abs_x,std::vector<double> params)
uint16_t size_type
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ GetLong_Energy_Thresh()

std::vector<double> HcalHF_PETalgorithm::GetLong_Energy_Thresh ( )
inline

Definition at line 58 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh.

58 { return long_Energy_Thresh; }
std::vector< double > long_Energy_Thresh

◆ GetLong_ET_Thresh()

std::vector<double> HcalHF_PETalgorithm::GetLong_ET_Thresh ( )
inline

Definition at line 57 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh.

57 { return long_ET_Thresh; }
std::vector< double > long_ET_Thresh

◆ GetLong_R()

std::vector<double> HcalHF_PETalgorithm::GetLong_R ( )
inline

Definition at line 56 of file HcalHF_PETalgorithm.h.

References long_R.

56 { return long_R; }
std::vector< double > long_R

◆ GetShort_Energy_Thresh()

std::vector<double> HcalHF_PETalgorithm::GetShort_Energy_Thresh ( )
inline

Definition at line 55 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh.

55 { return short_Energy_Thresh; }
std::vector< double > short_Energy_Thresh

◆ GetShort_ET_Thresh()

std::vector<double> HcalHF_PETalgorithm::GetShort_ET_Thresh ( )
inline

Definition at line 54 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh.

54 { return short_ET_Thresh; }
std::vector< double > short_ET_Thresh

◆ GetShort_R()

std::vector<double> HcalHF_PETalgorithm::GetShort_R ( )
inline

Definition at line 53 of file HcalHF_PETalgorithm.h.

References short_R.

53 { return short_R; }
std::vector< double > short_R

◆ HFSetFlagFromPET()

void HcalHF_PETalgorithm::HFSetFlagFromPET ( HFRecHit hf,
HFRecHitCollection rec,
const HcalChannelQuality myqual,
const HcalSeverityLevelComputer mySeverity 
)

Definition at line 67 of file HcalHF_PETalgorithm.cc.

References funct::abs(), CalcThreshold(), hcalRecHitTable_cff::depth, HcalSeverityLevelComputer::dropChannel(), edm::SortedCollection< T, SORT >::end(), hcalRecHitTable_cff::energy, ET, HLT_2024v14_cff::eta1, HLT_2024v14_cff::eta2, HcalTopology::etaRange(), EnergyCorrector::etas, l1ScoutingRun3::ugmt::fEta(), edm::SortedCollection< T, SORT >::find(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalAcceptSeverityLevel_, HcalForward, photonIsolationHIProducer_cfi::hf, HcalCaloFlagLabels::HFLongShort, HcalCaloFlagLabels::HFPET, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, DetId::rawId(), short_Energy_Thresh, short_ET_Thresh, short_R, short_R_29, and HcalCondObjectContainerBase::topo().

Referenced by HcalHitReconstructor::produce().

70  {
71  /* Set the HFLongShort flag by comparing the ratio |L-S|/|L+S|. Channels must first pass energy and ET cuts, and channels whose partners are known to be dead are skipped, since those channels can never satisfy the ratio cut. */
72 
73  int ieta = hf.id().ieta(); // get coordinates of rechit being checked
74  int depth = hf.id().depth();
75  int iphi = hf.id().iphi();
76  std::pair<double, double> etas = myqual->topo()->etaRange(HcalForward, abs(ieta));
77  double eta1 = etas.first;
78  double eta2 = etas.second;
79  double fEta = 0.5 * (eta1 + eta2); // calculate eta as average of eta values at ieta boundaries
80  double energy = hf.energy();
81  double ET = energy / fabs(cosh(fEta));
82 
83  // Step 1: Check energy and ET cuts
84  double ETthresh = 0, Energythresh = 0; // set ET, energy thresholds
85 
86  if (depth == 1) // set thresholds for long fibers
87  {
88  Energythresh = long_Energy_Thresh[abs(ieta) - 29];
89  ETthresh = long_ET_Thresh[abs(ieta) - 29];
90  } else if (depth == 2) // short fibers
91  {
92  Energythresh = short_Energy_Thresh[abs(ieta) - 29];
93  ETthresh = short_ET_Thresh[abs(ieta) - 29];
94  }
95 
96  if (energy < Energythresh || ET < ETthresh) {
97  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
98  hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
99  return;
100  }
101 
102  // Step 2: Get partner info, check if partner is excluded from rechits already
103  HcalDetId partner(HcalForward, ieta, iphi, 3 - depth); // if depth=1, 3-depth=2, and vice versa
104  DetId detpartner = DetId(partner);
105  const HcalChannelStatus* partnerstatus = myqual->getValues(detpartner.rawId());
106 
107  // Don't set the bit if the partner has been dropped from the rechit collection ('dead' or 'off')
108  if (mySeverity->dropChannel(partnerstatus->getValue())) {
109  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
110  hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
111  return;
112  }
113 
114  // Step 3: Compute ratio
115  double Ratio = 0;
117  if (part != rec.end()) {
118  HcalDetId neighbor(part->detid().rawId());
119  const uint32_t chanstat = myqual->getValues(neighbor)->getValue();
120  int SeverityLevel = mySeverity->getSeverityLevel(neighbor, part->flags(), chanstat);
121 
123  Ratio = (energy - part->energy()) / (energy + part->energy());
124  }
125 
126  double RatioThresh = 0;
127  // Allow for the ratio cut to be parameterized in terms of energy
128  if (abs(ieta) == 29) {
129  if (depth == 1)
130  RatioThresh = CalcThreshold(energy, long_R_29);
131  else if (depth == 2)
132  RatioThresh = CalcThreshold(energy, short_R_29);
133  } else {
134  if (depth == 1)
135  RatioThresh = CalcThreshold(energy, long_R);
136  else if (depth == 2)
137  RatioThresh = CalcThreshold(energy, short_R);
138  }
139  if (Ratio <= RatioThresh) {
140  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
141  hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
142  return;
143  }
144  // Made it this far -- ratio is > threshold, and cell should be flagged!
145  // 'HFLongShort' is overall topological flag, and 'HFPET' is the flag for this
146  // specific test
147  hf.setFlagField(1, HcalCaloFlagLabels::HFLongShort);
148  hf.setFlagField(1, HcalCaloFlagLabels::HFPET);
149 } //void HcalHF_PETalgorithm::HFSetFlagFromPET
std::vector< double > long_ET_Thresh
std::vector< T >::const_iterator const_iterator
std::vector< double > long_Energy_Thresh
std::vector< double > short_R
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalTopology * topo() const
std::vector< double > long_R
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double CalcThreshold(double abs_energy, const std::vector< double > &params)
std::vector< double > long_R_29
uint32_t getValue() const
const_iterator end() const
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
part
Definition: HCALResponse.h:20
std::vector< double > short_ET_Thresh
std::vector< double > short_Energy_Thresh
iterator find(key_type k)
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
#define ET
float fEta(int hwEta)
Definition: conversion.h:17
std::vector< double > short_R_29
bool dropChannel(const uint32_t &mystatus) const

◆ SetLong_Energy_Thresh()

void HcalHF_PETalgorithm::SetLong_Energy_Thresh ( const std::vector< double > &  x)
inline

Definition at line 51 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh, and x.

51 { long_Energy_Thresh = x; }
std::vector< double > long_Energy_Thresh

◆ SetLong_ET_Thresh()

void HcalHF_PETalgorithm::SetLong_ET_Thresh ( const std::vector< double > &  x)
inline

Definition at line 50 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh, and x.

50 { long_ET_Thresh = x; }
std::vector< double > long_ET_Thresh

◆ SetLong_R()

void HcalHF_PETalgorithm::SetLong_R ( const std::vector< double > &  x)
inline

Definition at line 49 of file HcalHF_PETalgorithm.h.

References long_R, and x.

49 { long_R = x; }
std::vector< double > long_R

◆ SetShort_Energy_Thresh()

void HcalHF_PETalgorithm::SetShort_Energy_Thresh ( const std::vector< double > &  x)
inline

Definition at line 48 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh, and x.

std::vector< double > short_Energy_Thresh

◆ SetShort_ET_Thresh()

void HcalHF_PETalgorithm::SetShort_ET_Thresh ( const std::vector< double > &  x)
inline

Definition at line 47 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh, and x.

47 { short_ET_Thresh = x; }
std::vector< double > short_ET_Thresh

◆ SetShort_R()

void HcalHF_PETalgorithm::SetShort_R ( const std::vector< double > &  x)
inline

Definition at line 46 of file HcalHF_PETalgorithm.h.

References short_R, and x.

46 { short_R = x; }
std::vector< double > short_R

Member Data Documentation

◆ HcalAcceptSeverityLevel_

int HcalHF_PETalgorithm::HcalAcceptSeverityLevel_
private

Definition at line 70 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

◆ long_Energy_Thresh

std::vector<double> HcalHF_PETalgorithm::long_Energy_Thresh
private

◆ long_ET_Thresh

std::vector<double> HcalHF_PETalgorithm::long_ET_Thresh
private

◆ long_R

std::vector<double> HcalHF_PETalgorithm::long_R
private

Definition at line 67 of file HcalHF_PETalgorithm.h.

Referenced by GetLong_R(), HcalHF_PETalgorithm(), HFSetFlagFromPET(), and SetLong_R().

◆ long_R_29

std::vector<double> HcalHF_PETalgorithm::long_R_29
private

Definition at line 72 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

◆ short_Energy_Thresh

std::vector<double> HcalHF_PETalgorithm::short_Energy_Thresh
private

◆ short_ET_Thresh

std::vector<double> HcalHF_PETalgorithm::short_ET_Thresh
private

◆ short_R

std::vector<double> HcalHF_PETalgorithm::short_R
private

◆ short_R_29

std::vector<double> HcalHF_PETalgorithm::short_R_29
private

Definition at line 71 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().