CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, 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 (std::vector< double > short_R, std::vector< double > short_Energy, std::vector< double > short_ET, std::vector< double > long_R, std::vector< double > long_Energy, std::vector< double > long_ET, int flagsToSkip, std::vector< double > short_R_29, std::vector< double > long_R_29)
 
void HFSetFlagFromPET (HFRecHit &hf, HFRecHitCollection &rec, HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
 
void SetLong_Energy_Thresh (std::vector< double > x)
 
void SetLong_ET_Thresh (std::vector< double > x)
 
void SetLong_R (std::vector< double > x)
 
void SetShort_Energy_Thresh (std::vector< double > x)
 
void SetShort_ET_Thresh (std::vector< double > x)
 
void SetShort_R (std::vector< double > x)
 
 ~HcalHF_PETalgorithm ()
 

Private Attributes

int flagsToSkip_
 
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.

Date:
2010/03/18 13:08:58
Revision:
1.1
Author
J. Temple and D. Ferencek

Definition at line 24 of file HcalHF_PETalgorithm.h.

Constructor & Destructor Documentation

HcalHF_PETalgorithm::HcalHF_PETalgorithm ( )

Constructors

Definition at line 14 of file HcalHF_PETalgorithm.cc.

15 {
16  // no params given; revert to old 'algo 1' fixed settings
17  short_R.clear();
18  short_R.push_back(0.995);
19  short_R_29.clear();
20  short_R_29.push_back(0.995);
21  short_Energy_Thresh.clear();
22  short_Energy_Thresh.push_back(50);
23  short_ET_Thresh.clear();
24  short_ET_Thresh.push_back(0);
25 
26  long_R.clear();
27  long_R.push_back(0.995);
28  long_R_29.clear();
29  long_R_29.push_back(0.995);
30  long_Energy_Thresh.clear();
31  long_Energy_Thresh.push_back(50);
32  long_ET_Thresh.clear();
33  long_ET_Thresh.push_back(0);
34  flagsToSkip_=0;
35 }
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 ( std::vector< double >  short_R,
std::vector< double >  short_Energy,
std::vector< double >  short_ET,
std::vector< double >  long_R,
std::vector< double >  long_Energy,
std::vector< double >  long_ET,
int  flagsToSkip,
std::vector< double >  short_R_29,
std::vector< double >  long_R_29 
)

Definition at line 37 of file HcalHF_PETalgorithm.cc.

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

68 {}

Member Function Documentation

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

Definition at line 156 of file HcalHF_PETalgorithm.cc.

References i, funct::pow(), and crabWrap::threshold.

157 {
158  /* CalcEnergyThreshold calculates the polynomial [0]+[1]*x + [2]*x^2 + ....,
159  where x is an integer provided by the first argument (int double abs_x),
160  and [0],[1],[2] is a vector of doubles provided by the second (std::vector<double> params).
161  The output of the polynomial calculation (threshold) is returned by the function.
162  */
163  double threshold=0;
164  for (std::vector<double>::size_type i=0;i<params.size();++i)
165  {
166  threshold+=params[i]*pow(abs_x, (int)i);
167  }
168  return threshold;
169 } //double HcalHF_PETalgorithm::CalcThreshold(double abs_x,std::vector<double> params)
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
float threshold
Definition: crabWrap.py:319
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 61 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh.

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

Definition at line 60 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh.

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

Definition at line 59 of file HcalHF_PETalgorithm.h.

References long_R.

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

Definition at line 58 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh.

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

Definition at line 57 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh.

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

Definition at line 56 of file HcalHF_PETalgorithm.h.

References short_R.

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

Definition at line 72 of file HcalHF_PETalgorithm.cc.

References abs, HcalDetId::depth(), HcalSeverityLevelComputer::dropChannel(), edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), relval_parameters_module::energy, ET, edm::SortedCollection< T, SORT >::find(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalForward, HcalCaloFlagLabels::HFLongShort, HcalCaloFlagLabels::HFPET, HFRecHit::id(), HcalDetId::ieta(), HcalDetId::iphi(), DetId::rawId(), CaloRecHit::setFlagField(), and theHFEtaBounds.

Referenced by HcalHitReconstructor::produce().

76 {
77  /* 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. */
78 
79  int ieta=hf.id().ieta(); // get coordinates of rechit being checked
80  int depth=hf.id().depth();
81  int iphi=hf.id().iphi();
82  double fEta = 0.5*(theHFEtaBounds[abs(ieta)-29] + theHFEtaBounds[abs(ieta)-28]); // calculate eta as average of eta values at ieta boundaries
83  double energy=hf.energy();
84  double ET = energy/fabs(cosh(fEta));
85 
86  // Step 1: Check energy and ET cuts
87  double ETthresh=0, Energythresh=0; // set ET, energy thresholds
88 
89  if (depth==1) // set thresholds for long fibers
90  {
91  Energythresh = long_Energy_Thresh[abs(ieta)-29];
92  ETthresh = long_ET_Thresh[abs(ieta)-29];
93  }
94  else if (depth==2) // short fibers
95  {
96  Energythresh = short_Energy_Thresh[abs(ieta)-29];
97  ETthresh = short_ET_Thresh[abs(ieta)-29];
98  }
99 
100  if (energy<Energythresh || ET < ETthresh)
101  {
102  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
104  return;
105  }
106 
107  // Step 2: Get partner info, check if partner is excluded from rechits already
108  HcalDetId partner(HcalForward, ieta, iphi, 3-depth); // if depth=1, 3-depth=2, and vice versa
109  DetId detpartner=DetId(partner);
110  const HcalChannelStatus* partnerstatus=myqual->getValues(detpartner.rawId());
111 
112  // Don't set the bit if the partner has been dropped from the rechit collection ('dead' or 'off')
113  if (mySeverity->dropChannel(partnerstatus->getValue() ) )
114  {
115  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
117  return;
118  }
119 
120  // Step 3: Compute ratio
121  double Ratio=1;
123  if (part!=rec.end())
124  {
125  if ((flagsToSkip_&part->flags())==0)
126  Ratio=(energy-part->energy())/(energy+part->energy());
127  }
128 
129  double RatioThresh=0;
130  // Allow for the ratio cut to be parameterized in terms of energy
131  if (abs(ieta)==29)
132  {
133  if (depth==1) RatioThresh=CalcThreshold(energy,long_R_29);
134  else if (depth==2) RatioThresh=CalcThreshold(energy,short_R_29);
135  }
136  else
137  {
138  if (depth==1) RatioThresh=CalcThreshold(energy,long_R);
139  else if (depth==2) RatioThresh=CalcThreshold(energy,short_R);
140  }
141  if (Ratio<=RatioThresh)
142  {
143  hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
145  return;
146  }
147  // Made it this far -- ratio is > threshold, and cell should be flagged!
148  // 'HFLongShort' is overall topological flag, and 'HFPET' is the flag for this
149  // specific test
152 }//void HcalHF_PETalgorithm::HFSetFlagFromPET
std::vector< double > long_ET_Thresh
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:22
std::vector< T >::const_iterator const_iterator
std::vector< double > long_Energy_Thresh
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< double > short_R
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int depth() const
get the tower depth
Definition: HcalDetId.h:42
std::vector< double > long_R
float energy() const
Definition: CaloRecHit.h:19
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
bool dropChannel(const uint32_t &mystatus) const
std::vector< double > long_R_29
const_iterator end() const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
Definition: DetId.h:20
static const double theHFEtaBounds[]
part
Definition: HCALResponse.h:21
std::vector< double > short_ET_Thresh
std::vector< double > short_Energy_Thresh
iterator find(key_type k)
#define ET
HcalDetId id() const
get the id
Definition: HFRecHit.h:21
uint32_t getValue() const
const Item * getValues(DetId fId) const
double CalcThreshold(double abs_energy, std::vector< double > params)
std::vector< double > short_R_29
void HcalHF_PETalgorithm::SetLong_Energy_Thresh ( std::vector< double >  x)
inline
void HcalHF_PETalgorithm::SetLong_ET_Thresh ( std::vector< double >  x)
inline
void HcalHF_PETalgorithm::SetLong_R ( std::vector< double >  x)
inline
void HcalHF_PETalgorithm::SetShort_Energy_Thresh ( std::vector< double >  x)
inline
void HcalHF_PETalgorithm::SetShort_ET_Thresh ( std::vector< double >  x)
inline
void HcalHF_PETalgorithm::SetShort_R ( std::vector< double >  x)
inline

Member Data Documentation

int HcalHF_PETalgorithm::flagsToSkip_
private

Definition at line 73 of file HcalHF_PETalgorithm.h.

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

Definition at line 72 of file HcalHF_PETalgorithm.h.

Referenced by GetLong_Energy_Thresh(), and SetLong_Energy_Thresh().

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

Definition at line 71 of file HcalHF_PETalgorithm.h.

Referenced by GetLong_ET_Thresh(), and SetLong_ET_Thresh().

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

Definition at line 70 of file HcalHF_PETalgorithm.h.

Referenced by GetLong_R().

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

Definition at line 75 of file HcalHF_PETalgorithm.h.

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

Definition at line 68 of file HcalHF_PETalgorithm.h.

Referenced by GetShort_Energy_Thresh(), and SetShort_Energy_Thresh().

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

Definition at line 67 of file HcalHF_PETalgorithm.h.

Referenced by GetShort_ET_Thresh(), and SetShort_ET_Thresh().

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

Definition at line 66 of file HcalHF_PETalgorithm.h.

Referenced by GetShort_R().

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

Definition at line 74 of file HcalHF_PETalgorithm.h.