CMS 3D CMS Logo

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

#include <HcalHFStatusBitFromDigis.h>

Public Member Functions

 HcalHFStatusBitFromDigis ()
 
 HcalHFStatusBitFromDigis (const edm::ParameterSet &HFDigiTimeParams, const edm::ParameterSet &HFTimeInWindowParams)
 
void hfSetFlagFromDigi (HFRecHit &hf, const HFDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
 
void resetFlagTimeSamples (int firstSample, int samplesToAdd, int expectedPeak)
 
void resetParamsFromDB (int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
 
 ~HcalHFStatusBitFromDigis ()
 

Private Attributes

std::vector< double > coef_
 
int expectedPeak_
 
int firstSample_
 
double HFlongwindowEthresh_
 
std::vector< double > HFlongwindowMaxTime_
 
std::vector< double > HFlongwindowMinTime_
 
double HFshortwindowEthresh_
 
std::vector< double > HFshortwindowMaxTime_
 
std::vector< double > HFshortwindowMinTime_
 
double minthreshold_
 
int recoFirstSample_
 
int recoSamplesToAdd_
 
int samplesToAdd_
 

Detailed Description

This class sets status bit in the status words for the revised CaloRecHit objets according to informatino from the digi associated to the hit.

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

Definition at line 18 of file HcalHFStatusBitFromDigis.h.

Constructor & Destructor Documentation

◆ HcalHFStatusBitFromDigis() [1/2]

HcalHFStatusBitFromDigis::HcalHFStatusBitFromDigis ( )

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

Definition at line 8 of file HcalHFStatusBitFromDigis.cc.

References coef_, expectedPeak_, firstSample_, HFlongwindowEthresh_, HFlongwindowMaxTime_, HFlongwindowMinTime_, HFshortwindowEthresh_, HFshortwindowMaxTime_, HFshortwindowMinTime_, minthreshold_, and samplesToAdd_.

8  {
9  // use simple values in default constructor
10  minthreshold_ = 40; // minimum energy threshold (in GeV)
11 
12  firstSample_ =
13  1; // these are the firstSample, samplesToAdd value of Igor's algorithm -- not necessarily the same as the reco first, toadd values (which are supplied individually for each hit)
14  samplesToAdd_ = 3;
15  expectedPeak_ = 2;
16 
17  // Based on Igor V's algorithm:
18  //TS4/(TS3+TS4+TS5+TS6) > 0.93 - exp(-0.38275-0.012667*E)
19  coef_.push_back(0.93);
20  coef_.push_back(-0.38275);
21  coef_.push_back(-0.012667);
22  // Minimum energy of 10 GeV required
24  HFlongwindowMinTime_.clear();
25  HFlongwindowMinTime_.push_back(-10);
26  HFlongwindowMaxTime_.clear();
27  HFlongwindowMaxTime_.push_back(8);
29  HFshortwindowMinTime_.clear();
30  HFshortwindowMinTime_.push_back(-10);
31  HFshortwindowMaxTime_.clear();
32  HFshortwindowMaxTime_.push_back(8);
33 }
std::vector< double > HFlongwindowMaxTime_
std::vector< double > HFshortwindowMinTime_
std::vector< double > HFlongwindowMinTime_
std::vector< double > HFshortwindowMaxTime_

◆ HcalHFStatusBitFromDigis() [2/2]

HcalHFStatusBitFromDigis::HcalHFStatusBitFromDigis ( const edm::ParameterSet HFDigiTimeParams,
const edm::ParameterSet HFTimeInWindowParams 
)

Definition at line 35 of file HcalHFStatusBitFromDigis.cc.

References coef_, expectedPeak_, firstSample_, edm::ParameterSet::getParameter(), HFlongwindowEthresh_, HFlongwindowMaxTime_, HFlongwindowMinTime_, HFshortwindowEthresh_, HFshortwindowMaxTime_, HFshortwindowMinTime_, minthreshold_, and samplesToAdd_.

36  {
37  // Specify parameters used in forming the HFDigiTime flag
38  firstSample_ = HFDigiTimeParams.getParameter<int>("HFdigiflagFirstSample");
39  samplesToAdd_ = HFDigiTimeParams.getParameter<int>("HFdigiflagSamplesToAdd");
40  expectedPeak_ = HFDigiTimeParams.getParameter<int>("HFdigiflagExpectedPeak");
41  minthreshold_ = HFDigiTimeParams.getParameter<double>("HFdigiflagMinEthreshold");
42  coef_ = HFDigiTimeParams.getParameter<std::vector<double> >("HFdigiflagCoef");
43 
44  // Specify parameters used in forming HFInTimeWindow flag
45  HFlongwindowMinTime_ = HFTimeInWindowParams.getParameter<std::vector<double> >("hflongMinWindowTime");
46  HFlongwindowMaxTime_ = HFTimeInWindowParams.getParameter<std::vector<double> >("hflongMaxWindowTime");
47  HFlongwindowEthresh_ = HFTimeInWindowParams.getParameter<double>("hflongEthresh");
48  HFshortwindowMinTime_ = HFTimeInWindowParams.getParameter<std::vector<double> >("hfshortMinWindowTime");
49  HFshortwindowMaxTime_ = HFTimeInWindowParams.getParameter<std::vector<double> >("hfshortMaxWindowTime");
50  HFshortwindowEthresh_ = HFTimeInWindowParams.getParameter<double>("hfshortEthresh");
51 }
std::vector< double > HFlongwindowMaxTime_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< double > HFshortwindowMinTime_
std::vector< double > HFlongwindowMinTime_
std::vector< double > HFshortwindowMaxTime_

◆ ~HcalHFStatusBitFromDigis()

HcalHFStatusBitFromDigis::~HcalHFStatusBitFromDigis ( )

Definition at line 53 of file HcalHFStatusBitFromDigis.cc.

53 {}

Member Function Documentation

◆ hfSetFlagFromDigi()

void HcalHFStatusBitFromDigis::hfSetFlagFromDigi ( HFRecHit hf,
const HFDataFrame digi,
const HcalCoder coder,
const HcalCalibrations calib 
)

Definition at line 73 of file HcalHFStatusBitFromDigis.cc.

References HcalCoder::adc2fC(), HcalQIESample::capid(), coef_, EcalSCDynamicDPhiParametersESProducer_cfi::cutoff, JetChargeProducer_cfi::exp, expectedPeak_, firstSample_, photonIsolationHIProducer_cfi::hf, HcalCaloFlagLabels::HFDigiTime, HcalCaloFlagLabels::HFInTimeWindow, HFlongwindowEthresh_, HFlongwindowMaxTime_, HFlongwindowMinTime_, HFshortwindowEthresh_, HFshortwindowMaxTime_, HFshortwindowMinTime_, mps_fire::i, CastorTowerReco_cfi::maxtime, minthreshold_, CastorTowerReco_cfi::mintime, VarParsing::mult, HFDataFrame::sample(), samplesToAdd_, HFDataFrame::size(), relativeConstraints::value, and geometryCSVtoXML::zz.

Referenced by HcalHitReconstructor::produce().

76  {
77  // The following 3 values are computed by Igor's algorithm
78  //only in the window [firstSample_, firstSample_ + samplesToAdd_),
79  //which may not be the same as the default reco window.
80 
81  double totalCharge = 0;
82  double peakCharge = 0;
83  double RecomputedEnergy = 0;
84 
85  CaloSamples tool;
86  coder.adc2fC(digi, tool);
87 
88  // Compute quantities needed for HFDigiTime, Fraction2TS FLAGS
89  for (int i = 0; i < digi.size(); ++i) {
90  int capid = digi.sample(i).capid();
91  double value = tool[i] - calib.pedestal(capid);
92 
93  // Sum all charge within flagging window, find charge in expected peak time slice
94  if (i >= firstSample_ && i < firstSample_ + samplesToAdd_) {
95  totalCharge += value;
96  RecomputedEnergy += value * calib.respcorrgain(capid);
97  if (i == expectedPeak_)
98  peakCharge = value;
99  }
100  } // for (int i=0;i<digi.size();++i)
101 
102  // FLAG: HcalCaloLabels::HFDigiTime
103  // Igor's algorithm: compare charge in peak to total charge in window
104  if (RecomputedEnergy >= minthreshold_) // don't set noise flags for cells below a given threshold
105  {
106  // Calculate allowed minimum value of (TS4/TS3+4+5+6):
107  double cutoff = 0; // no arguments specified; no cutoff applied
108  if (!coef_.empty())
109  cutoff = coef_[0];
110  // default cutoff takes the form:
111  // cutoff = coef_[0] - exp(coef_[1]+coef_[2]*E+coef_[3]*E^2+...)
112  double powRE = 1;
113  double expo_arg = 0;
114  for (unsigned int zz = 1; zz < coef_.size(); ++zz) {
115  expo_arg += coef_[zz] * powRE;
116  powRE *= RecomputedEnergy;
117  }
118  cutoff -= exp(expo_arg);
119 
120  if (peakCharge / totalCharge < cutoff)
121  hf.setFlagField(1, HcalCaloFlagLabels::HFDigiTime);
122  }
123 
124  // FLAG: HcalCaloLabels:: HFInTimeWindow
125  // Timing algorithm
126  if (hf.id().depth() == 1) {
127  if (hf.energy() >= HFlongwindowEthresh_) {
128  float mult = 1. / hf.energy();
129  float enPow = 1.;
130  float mintime = 0;
131  float maxtime = 0;
132  for (unsigned int i = 0; i < HFlongwindowMinTime_.size(); ++i) {
133  mintime += HFlongwindowMinTime_[i] * enPow;
134  maxtime += HFlongwindowMaxTime_[i] * enPow;
135  enPow *= mult;
136  }
137  if (hf.time() < mintime || hf.time() > maxtime)
138  hf.setFlagField(1, HcalCaloFlagLabels::HFInTimeWindow);
139  }
140  } else if (hf.id().depth() == 2) {
141  if (hf.energy() >= HFshortwindowEthresh_) {
142  float mult = 1. / hf.energy();
143  float enPow = 1.;
144  float mintime = 0;
145  float maxtime = 0;
146  for (unsigned int i = 0; i < HFshortwindowMinTime_.size(); ++i) {
147  mintime += HFshortwindowMinTime_[i] * enPow;
148  maxtime += HFshortwindowMaxTime_[i] * enPow;
149  enPow *= mult;
150  }
151  if (hf.time() < mintime || hf.time() > maxtime)
152  hf.setFlagField(1, HcalCaloFlagLabels::HFInTimeWindow);
153  }
154  }
155 
156  return;
157 }
std::vector< double > HFlongwindowMaxTime_
std::vector< double > HFshortwindowMinTime_
constexpr HcalQIESample const & sample(int i) const
access a sample
Definition: HFDataFrame.h:40
std::vector< double > HFlongwindowMinTime_
Definition: value.py:1
constexpr int size() const
total number of samples in the digi
Definition: HFDataFrame.h:27
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
std::vector< double > HFshortwindowMaxTime_

◆ resetFlagTimeSamples()

void HcalHFStatusBitFromDigis::resetFlagTimeSamples ( int  firstSample,
int  samplesToAdd,
int  expectedPeak 
)

Definition at line 65 of file HcalHFStatusBitFromDigis.cc.

References expectedPeak_, castor_dqm_sourceclient-live_cfg::firstSample, firstSample_, castor_dqm_sourceclient-live_cfg::samplesToAdd, and samplesToAdd_.

65  {
66  // This resets the time samples used in the HF flag. These samples are not necessarily the same
67  // as the flags used by the energy reconstruction
70  expectedPeak_ = expectedPeak;
71 } // void HcalHFStatusBitFromDigis

◆ resetParamsFromDB()

void HcalHFStatusBitFromDigis::resetParamsFromDB ( int  firstSample,
int  samplesToAdd,
int  expectedPeak,
double  minthreshold,
const std::vector< double > &  coef 
)

Member Data Documentation

◆ coef_

std::vector<double> HcalHFStatusBitFromDigis::coef_
private

◆ expectedPeak_

int HcalHFStatusBitFromDigis::expectedPeak_
private

◆ firstSample_

int HcalHFStatusBitFromDigis::firstSample_
private

◆ HFlongwindowEthresh_

double HcalHFStatusBitFromDigis::HFlongwindowEthresh_
private

Definition at line 50 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ HFlongwindowMaxTime_

std::vector<double> HcalHFStatusBitFromDigis::HFlongwindowMaxTime_
private

Definition at line 52 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ HFlongwindowMinTime_

std::vector<double> HcalHFStatusBitFromDigis::HFlongwindowMinTime_
private

Definition at line 51 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ HFshortwindowEthresh_

double HcalHFStatusBitFromDigis::HFshortwindowEthresh_
private

Definition at line 53 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ HFshortwindowMaxTime_

std::vector<double> HcalHFStatusBitFromDigis::HFshortwindowMaxTime_
private

Definition at line 55 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ HFshortwindowMinTime_

std::vector<double> HcalHFStatusBitFromDigis::HFshortwindowMinTime_
private

Definition at line 54 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

◆ minthreshold_

double HcalHFStatusBitFromDigis::minthreshold_
private

◆ recoFirstSample_

int HcalHFStatusBitFromDigis::recoFirstSample_
private

Definition at line 38 of file HcalHFStatusBitFromDigis.h.

◆ recoSamplesToAdd_

int HcalHFStatusBitFromDigis::recoSamplesToAdd_
private

Definition at line 39 of file HcalHFStatusBitFromDigis.h.

◆ samplesToAdd_

int HcalHFStatusBitFromDigis::samplesToAdd_
private