Functions | |
template<class Digi , class RecHit > | |
RecHit | reco (const Digi &digi, const CastorCoder &coder, const CastorCalibrations &calibs, int ifirst, int n, bool slewCorrect, const CastorPulseContainmentCorrection *corr, CastorTimeSlew::BiasSetting slewFlavor) |
RecHit CastorSimpleRecAlgoImpl::reco | ( | const Digi & | digi, |
const CastorCoder & | coder, | ||
const CastorCalibrations & | calibs, | ||
int | ifirst, | ||
int | n, | ||
bool | slewCorrect, | ||
const CastorPulseContainmentCorrection * | corr, | ||
CastorTimeSlew::BiasSetting | slewFlavor | ||
) | [inline] |
Definition at line 36 of file CastorSimpleRecAlgo.cc.
References CastorCoder::adc2fC(), CastorTimeSlew::delay(), CastorCalibrations::gain(), CastorPulseContainmentCorrection::getCorrection(), i, max(), findQualityFiles::maxI, CastorCalibrations::pedestal(), CaloSamples::size(), cond::rpcobgas::time, and timeshift_ns_hf().
{ 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.gain(capid); // fC --> GeV ampl+=ta; if(ta>maxA){ maxA=ta; maxI=i; } } float time=-9999; if(maxI==0 || maxI==(tool.size()-1)) { // supress warning and use dummy time value for 2009 data /* edm::LogWarning("HCAL/CASTOR Pulse") << "CastorSimpleRecAlgo::reconstruct :" << " Invalid max amplitude position, " << " max Amplitude: "<< maxI << " first: "<<ifirst << " last: "<<(tool.size()-1) << std::endl; */ } else { maxA=fabs(maxA); int capid=digi[maxI-1].capid(); float t0 = fabs((tool[maxI-1]-calibs.pedestal(capid))*calibs.gain(capid)); capid=digi[maxI+1].capid(); float t2 = fabs((tool[maxI+1]-calibs.pedestal(capid))*calibs.gain(capid)); float wpksamp = (t0 + maxA + t2); if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp; time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(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-=CastorTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor); } return RecHit(digi.id(),ampl,time); }