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
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::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_.

9 {
10  // use simple values in default constructor
11  minthreshold_=40; // minimum energy threshold (in GeV)
12 
13  firstSample_=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::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_.

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

Definition at line 54 of file HcalHFStatusBitFromDigis.cc.

54 {}

Member Function Documentation

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

Definition at line 76 of file HcalHFStatusBitFromDigis.cc.

References HcalCoder::adc2fC(), HcalQIESample::capid(), coef_, prof2calltree::cutoff, HcalDetId::depth(), CaloRecHit::energy(), create_public_lumi_plots::exp, expectedPeak_, firstSample_, HcalCaloFlagLabels::HFDigiTime, HcalCaloFlagLabels::HFInTimeWindow, HFlongwindowEthresh_, HFlongwindowMaxTime_, HFlongwindowMinTime_, HFshortwindowEthresh_, HFshortwindowMaxTime_, HFshortwindowMinTime_, i, HFRecHit::id(), minthreshold_, VarParsing::mult, HcalCalibrations::pedestal(), HcalCalibrations::respcorrgain(), HFDataFrame::sample(), samplesToAdd_, CaloRecHit::setFlagField(), HFDataFrame::size(), CaloRecHit::time(), and relativeConstraints::value.

Referenced by HcalHitReconstructor::produce().

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

Definition at line 67 of file HcalHFStatusBitFromDigis.cc.

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

68 {
69  // This resets the time samples used in the HF flag. These samples are not necessarily the same
70  // as the flags used by the energy reconstruction
73  expectedPeak_ = expectedPeak;
74 } // void HcalHFStatusBitFromDigis
void HcalHFStatusBitFromDigis::resetParamsFromDB ( int  firstSample,
int  samplesToAdd,
int  expectedPeak,
double  minthreshold,
const std::vector< double > &  coef 
)

Member Data Documentation

std::vector<double> HcalHFStatusBitFromDigis::coef_
private
int HcalHFStatusBitFromDigis::expectedPeak_
private
int HcalHFStatusBitFromDigis::firstSample_
private
double HcalHFStatusBitFromDigis::HFlongwindowEthresh_
private

Definition at line 54 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

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

Definition at line 56 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

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

Definition at line 55 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

double HcalHFStatusBitFromDigis::HFshortwindowEthresh_
private

Definition at line 57 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

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

Definition at line 59 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

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

Definition at line 58 of file HcalHFStatusBitFromDigis.h.

Referenced by HcalHFStatusBitFromDigis(), and hfSetFlagFromDigi().

double HcalHFStatusBitFromDigis::minthreshold_
private
int HcalHFStatusBitFromDigis::recoFirstSample_
private

Definition at line 41 of file HcalHFStatusBitFromDigis.h.

int HcalHFStatusBitFromDigis::recoSamplesToAdd_
private

Definition at line 42 of file HcalHFStatusBitFromDigis.h.

int HcalHFStatusBitFromDigis::samplesToAdd_
private