Functions | |
template<class DIGI > | |
bool | keepMe (const HcalDbService &db, const DIGI &inp, int threshold, int firstSample, int samples, bool twosided) |
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, evf::evtn::offset(), and slope.
{ bool keepIt=false; const HcalQIECoder* channelCoder = db.getHcalCoder (inp.id()); const HcalQIEShape* shape = db.getHcalShape (channelCoder); // determine average pedestal for channel float pedsum=0, pedave=0, offset=0, slope=0; const HcalPedestal* ped=db.getPedestal(inp.id()); for (int j=0; j<4; j++) { pedave+=ped->getValue(j)/4.0; offset+=channelCoder->charge(*shape,0,j)/4.0; slope+=channelCoder->charge(*shape,1,j)/4.0; } slope-=offset; pedave-=offset; pedave/=slope; int sum=0; for (int j=0; j<samples && j+firstSample < inp.size(); j++) { sum+=inp[j+firstSample].adc(); pedsum+=pedave; } // int presum=sum; sum-=(int)(pedsum); if (sum>=threshold) keepIt=true; else if (sum<=(-threshold) && twosided) keepIt=true; /* else std::cout << inp.id() << " " << sum << ":" << presum << " " << threshold << " " << pedsum << " " << pedave << " " << offset << " " << slope << std::endl; */ return keepIt; }