CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
ZSEnergy_impl Namespace Reference

Functions

template<class DIGI >
bool keepMe (const HcalDbService &db, const DIGI &inp, int threshold, int firstSample, int samples, bool twosided)
 

Function Documentation

template<class DIGI >
bool ZSEnergy_impl::keepMe ( const HcalDbService db,
const DIGI &  inp,
int  threshold,
int  firstSample,
int  samples,
bool  twosided 
)

Definition at line 19 of file HcalZSAlgoEnergy.cc.

References HcalQIECoder::charge(), castor_dqm_sourceclient_file_cfg::firstSample, HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalDbService::getPedestal(), HcalPedestal::getValue(), j, HLT_25ns14e33_v1_cff::offset, and slope.

19  {
20  bool keepIt=false;
21  const HcalQIECoder* channelCoder = db.getHcalCoder (inp.id());
22  const HcalQIEShape* shape = db.getHcalShape (channelCoder);
23 
24  // determine average pedestal for channel
25  float pedsum=0, pedave=0, offset=0, slope=0;
26  const HcalPedestal* ped=db.getPedestal(inp.id());
27  for (int j=0; j<4; j++) {
28  pedave+=ped->getValue(j)/4.0;
29  offset+=channelCoder->charge(*shape,0,j)/4.0;
30  slope+=channelCoder->charge(*shape,1,j)/4.0;
31  }
32  slope-=offset;
33  pedave-=offset;
34  pedave/=slope;
35 
36  int sum=0;
37 
38  for (int j=0; j<samples && j+firstSample < inp.size(); j++) {
39  sum+=inp[j+firstSample].adc();
40  pedsum+=pedave;
41  }
42  // int presum=sum;
43  sum-=(int)(pedsum);
44 
45  if (sum>=threshold) keepIt=true;
46  else if (sum<=(-threshold) && twosided) keepIt=true;
47  /*
48  else
49  std::cout << inp.id() << " " << sum << ":" << presum << " " << threshold
50  << " " << pedsum << " " << pedave
51  << " " << offset << " " << slope
52  << std::endl;
53  */
54  return keepIt;
55  }
static const double slope[3]
int j
Definition: DBlmapReader.cc:9
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalPedestal.h:21
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalPedestal * getPedestal(const HcalGenericDetId &fId) const
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:22