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 22 of file HcalHF_PETalgorithm.h.

Constructor & Destructor Documentation

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.

14 {
15  // no params given; revert to old 'algo 1' fixed settings
16  short_R.clear();
17  short_R.push_back(0.995);
18  short_R_29.clear();
19  short_R_29.push_back(0.995);
20  short_Energy_Thresh.clear();
21  short_Energy_Thresh.push_back(50);
22  short_ET_Thresh.clear();
23  short_ET_Thresh.push_back(0);
24 
25  long_R.clear();
26  long_R.push_back(0.995);
27  long_R_29.clear();
28  long_R_29.push_back(0.995);
29  long_Energy_Thresh.clear();
30  long_Energy_Thresh.push_back(50);
31  long_ET_Thresh.clear();
32  long_ET_Thresh.push_back(0);
34 }
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 ( 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 36 of file HcalHF_PETalgorithm.cc.

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

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

Definition at line 67 of file HcalHF_PETalgorithm.cc.

67 {}

Member Function Documentation

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

Definition at line 164 of file HcalHF_PETalgorithm.cc.

References mps_fire::i, funct::pow(), and electronIdCutBased_cfi::threshold.

Referenced by HFSetFlagFromPET().

165 {
166  /* CalcEnergyThreshold calculates the polynomial [0]+[1]*x + [2]*x^2 + ....,
167  where x is an integer provided by the first argument (int double abs_x),
168  and [0],[1],[2] is a vector of doubles provided by the second (std::vector<double> params).
169  The output of the polynomial calculation (threshold) is returned by the function.
170  */
171  double threshold=0;
172  for (std::vector<double>::size_type i=0;i<params.size();++i)
173  {
174  threshold+=params[i]*pow(abs_x, (int)i);
175  }
176  return threshold;
177 } //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:40
std::vector<double> HcalHF_PETalgorithm::GetLong_Energy_Thresh ( )
inline

Definition at line 59 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh.

59 {return long_Energy_Thresh;}
std::vector< double > long_Energy_Thresh
std::vector<double> HcalHF_PETalgorithm::GetLong_ET_Thresh ( )
inline

Definition at line 58 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh.

58 {return long_ET_Thresh;}
std::vector< double > long_ET_Thresh
std::vector<double> HcalHF_PETalgorithm::GetLong_R ( )
inline

Definition at line 57 of file HcalHF_PETalgorithm.h.

References long_R.

57 {return long_R;}
std::vector< double > long_R
std::vector<double> HcalHF_PETalgorithm::GetShort_Energy_Thresh ( )
inline

Definition at line 56 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh.

56 {return short_Energy_Thresh;}
std::vector< double > short_Energy_Thresh
std::vector<double> HcalHF_PETalgorithm::GetShort_ET_Thresh ( )
inline

Definition at line 55 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh.

55 {return short_ET_Thresh;}
std::vector< double > short_ET_Thresh
std::vector<double> HcalHF_PETalgorithm::GetShort_R ( )
inline

Definition at line 54 of file HcalHF_PETalgorithm.h.

References short_R.

54 {return short_R;}
std::vector< double > short_R
void HcalHF_PETalgorithm::HFSetFlagFromPET ( HFRecHit hf,
HFRecHitCollection rec,
const HcalChannelQuality myqual,
const HcalSeverityLevelComputer mySeverity 
)

Definition at line 71 of file HcalHF_PETalgorithm.cc.

References funct::abs(), CalcThreshold(), particleFlowClusterECALTimeSelected_cfi::depth, HcalDetId::depth(), HcalSeverityLevelComputer::dropChannel(), edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), ET, HcalTopology::etaRange(), EnergyCorrector::etas, edm::SortedCollection< T, SORT >::find(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalAcceptSeverityLevel_, HcalForward, HcalCaloFlagLabels::HFLongShort, HcalCaloFlagLabels::HFPET, HFRecHit::id(), HcalDetId::ieta(), HcalDetId::iphi(), long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, neighbor(), DetId::rawId(), CaloRecHit::setFlagField(), short_Energy_Thresh, short_ET_Thresh, short_R, short_R_29, and HcalCondObjectContainerBase::topo().

Referenced by HcalHitReconstructor::produce().

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

Definition at line 52 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh, and x.

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

Definition at line 51 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh, and x.

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

Definition at line 50 of file HcalHF_PETalgorithm.h.

References x.

50 {long_R=x;}
std::vector< double > long_R
void HcalHF_PETalgorithm::SetShort_Energy_Thresh ( const std::vector< double > &  x)
inline

Definition at line 49 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh, and x.

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

Definition at line 48 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh, and x.

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

Definition at line 47 of file HcalHF_PETalgorithm.h.

References x.

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

Member Data Documentation

int HcalHF_PETalgorithm::HcalAcceptSeverityLevel_
private

Definition at line 71 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

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

Definition at line 68 of file HcalHF_PETalgorithm.h.

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

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

Definition at line 73 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

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

Definition at line 64 of file HcalHF_PETalgorithm.h.

Referenced by GetShort_R(), HcalHF_PETalgorithm(), and HFSetFlagFromPET().

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

Definition at line 72 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().