![]() |
![]() |
Functions | |
template<class Digi , class RecHit > | |
RecHit | reco1 (const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor) |
template<class Digi , class RecHit > | |
RecHit | reco2 (const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor) |
RecHit ZdcSimpleRecAlgoImpl::reco1 | ( | const Digi & | digi, |
const HcalCoder & | coder, | ||
const HcalCalibrations & | calibs, | ||
int | ifirst, | ||
int | n, | ||
bool | slewCorrect, | ||
const HcalPulseContainmentCorrection * | corr, | ||
HcalTimeSlew::BiasSetting | slewFlavor | ||
) | [inline] |
Definition at line 32 of file ZdcSimpleRecAlgo.cc.
References HcalCoder::adc2fC(), HcalTimeSlew::delay(), HcalPulseContainmentCorrection::getCorrection(), i, LogDebug, max(), findQualityFiles::maxI, HcalCalibrations::pedestal(), HcalCalibrations::respcorrgain(), CaloSamples::size(), cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_zdc().
{ CaloSamples tool; coder.adc2fC(digi,tool); double ampl=0; int maxI = -1; double maxA = -1e10; double 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; } } double time=-9999; if(maxI==0 || maxI==(tool.size()-1)) { LogDebug("HCAL Pulse") << "ZdcSimpleRecAlgo::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(); double t0 = fabs((tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) ); capid=digi[maxI+1].capid(); double t2 = fabs((tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) ); double wpksamp = (t0 + maxA + t2); if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp; time = (maxI - digi.presamples())*25.0 + timeshift_ns_zdc(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 return RecHit(digi.id(),ampl,time); }
RecHit ZdcSimpleRecAlgoImpl::reco2 | ( | const Digi & | digi, |
const HcalCoder & | coder, | ||
const HcalCalibrations & | calibs, | ||
int | ifirst, | ||
int | n, | ||
bool | slewCorrect, | ||
const HcalPulseContainmentCorrection * | corr, | ||
HcalTimeSlew::BiasSetting | slewFlavor | ||
) | [inline] |
Definition at line 85 of file ZdcSimpleRecAlgo.cc.
References HcalCoder::adc2fC(), HcalPulseContainmentCorrection::getCorrection(), i, gen::k, LogDebug, findQualityFiles::maxI, HcalCalibrations::respcorrgain(), CaloSamples::size(), and cond::rpcobgas::time.
{ CaloSamples tool; coder.adc2fC(digi,tool); double ampl=0; int maxI = -1; double maxA = -1e10; double ta=0; double prenoise = 0; double postnoise = 0; int noiseslices = 0; double noise = 0; double fc_ampl=0; for(int k = 0 ; k < tool.size() && k < ifirst; k++){ prenoise += tool[k]; noiseslices++; } // for(int j = (n + ifirst + 1); j <tool.size(); j++){ // postnoise += tool[j]; // noiseslices++; // } // removed postnoise due to significant signal seen in TS 7,8,9 (Heavy Ion run 2010) // Future ZdcSimpleRecAlgo will have better configurable noise calculation postnoise=0; if(noiseslices != 0) { noise = (prenoise+postnoise)/double(noiseslices); } else { noise = 0; } // factor to multiply by noise to make 0 or 1 to handle negative noise situations double noisefactor=1.; for (int i=ifirst; i<tool.size() && i<n+ifirst; i++) { int capid=digi[i].capid(); if(noise<0){ // flag hit as having negative noise, and don't subtract anything, because // it will falsely increase the energy noisefactor=0.; } ta = tool[i]-noisefactor*noise; fc_ampl+=ta; ta*= calibs.respcorrgain(capid) ; // fC --> GeV ampl+=ta; if(ta>maxA){ maxA=ta; maxI=i; } } // if(ta<0){ // // flag hits that have negative energy // } double time=-9999; if(maxI==0 || maxI==(tool.size()-1)) { LogDebug("HCAL Pulse") << "ZdcSimpleRecAlgo::reco2 :" << " Invalid max amplitude position, " << " max Amplitude: "<< maxI << " first: "<<ifirst << " last: "<<(tool.size()-1) << std::endl; } else { int capid=digi[maxI-1].capid(); double Energy0 = ((tool[maxI-1])*calibs.respcorrgain(capid) ); // if any of the energies used in the weight are negative, make them 0 instead // these are actually QIE values, not energy if(Energy0<0){Energy0=0.;} capid=digi[maxI].capid(); double Energy1 = ((tool[maxI])*calibs.respcorrgain(capid) ) ; if(Energy1<0){Energy1=0.;} capid=digi[maxI+1].capid(); double Energy2 = ((tool[maxI+1])*calibs.respcorrgain(capid) ); if(Energy2<0){Energy2=0.;} // double TSWeightEnergy = ((maxI-1)*Energy0 + maxI*Energy1 + (maxI+1)*Energy2); double EnergySum=Energy0+Energy1+Energy2; double AvgTSPos=0.; if (EnergySum!=0) AvgTSPos=TSWeightEnergy/ EnergySum; // If time is zero, set it to the "nonsensical" -99 // Time should be between 75ns and 175ns (Timeslices 3-7) if(AvgTSPos==0){ time=-99; } else { time = (AvgTSPos*25.0); } if (corr!=0) { // Apply phase-based amplitude correction: ampl *= corr->getCorrection(fc_ampl); } } return RecHit(digi.id(),ampl,time); }