Functions | |
template<class Digi , class RecHit > | |
RecHit | reco (const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor, bool forData) |
RecHit HcalSimpleRecAlgoImpl::reco | ( | const Digi & | digi, |
const HcalCoder & | coder, | ||
const HcalCalibrations & | calibs, | ||
int | ifirst, | ||
int | n, | ||
bool | slewCorrect, | ||
const HcalPulseContainmentCorrection * | corr, | ||
HcalTimeSlew::BiasSetting | slewFlavor, | ||
bool | forData | ||
) | [inline] |
Definition at line 43 of file HcalSimpleRecAlgo.cc.
References HcalCoder::adc2fC(), HcalTimeSlew::delay(), eCorr(), HcalPulseContainmentCorrection::getCorrection(), i, HcalDetId::ieta(), LogDebug, max(), findQualityFiles::maxI, HcalCalibrations::pedestal(), HcalCalibrations::respcorrgain(), CaloSamples::size(), cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_hbheho().
{ CaloSamples tool; coder.adc2fC(digi,tool); double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0; double fc_ampl=0; for (int i=ifirst; i<tool.size() && i<n+ifirst; i++) { int capid=digi[i].capid(); ta = (tool[i]-calibs.pedestal(capid)); // pedestal subtraction fc_ampl+=ta; ta*= calibs.respcorrgain(capid) ; // fC --> GeV ampl+=ta; if(ta>maxA){ maxA=ta; maxI=i; } } float time = -9999; if(maxI==0 || maxI==(tool.size()-1)) { LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :" << " Invalid max amplitude position, " << " max Amplitude: "<< maxI << " first: "<<ifirst << " last: "<<(tool.size()-1) << std::endl; } else { int capid=digi[maxI-1].capid(); float t0 = ((tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) ); capid=digi[maxI+1].capid(); float t2 = ((tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) ); // Handle negative excursions by moving "zero": float minA=t0; if (maxA<minA) minA=maxA; if (t2<minA) minA=t2; if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; } // positivizes all samples float wpksamp = (t0 + maxA + t2); if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp; time = (maxI - digi.presamples())*25.0 + timeshift_ns_hbheho(wpksamp); if (corr!=0) { // Apply phase-based amplitude correction: ampl *= corr->getCorrection(fc_ampl); // std::cout << fc_ampl << " --> " << corr->getCorrection(fc_ampl) << std::endl; } if (slewCorrect) time-=HcalTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor); time=time-calibs.timecorr(); // time calibration } // Temoprary Ugly Hack to apply energy-dependent corrections on some // HB- cells if(forData) { HcalDetId cell(digi.id()); int ieta = cell.ieta(); int iphi = cell.iphi(); ampl *= eCorr(ieta,iphi,ampl); } return RecHit(digi.id(),ampl,time); }