CMS 3D CMS Logo

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 13 of file HcalZSAlgoEnergy.cc.

References HcalQIECoder::charge(), castor_dqm_sourceclient-live_cfg::firstSample, HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalDbService::getPedestal(), HcalPedestal::getValue(), createfilelist::int, dqmiolumiharvest::j, hltrates_dqm_sourceclient-live_cfg::offset, and slope.

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