13 firstSample_(firstSample),
14 samplesToAdd_(samplesToAdd),
15 recoMethod_(recoMethod),
16 correctForTimeslew_(correctForTimeslew) {
22 firstSample_(firstSample),
23 samplesToAdd_(samplesToAdd),
24 recoMethod_(recoMethod),
25 correctForTimeslew_(
false) {
30 namespace ZdcSimpleRecAlgoImpl {
31 template<
class Digi,
class RecHit>
36 double ampl=0;
int maxI = -1;
double maxA = -1e10;
double ta=0;
38 for (
int i=ifirst;
i<tool.
size() &&
i<n+ifirst;
i++) {
39 int capid=digi[
i].capid();
52 if(maxI==0 || maxI==(tool.
size()-1)) {
53 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reconstruct :"
54 <<
" Invalid max amplitude position, "
55 <<
" max Amplitude: "<< maxI
57 <<
" last: "<<(tool.
size()-1)
61 int capid=digi[maxI-1].capid();
63 capid=digi[maxI+1].capid();
65 double wpksamp = (t0 + maxA + t2);
66 if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
78 return RecHit(digi.id(),ampl,
time);
83 namespace ZdcSimpleRecAlgoImpl {
84 template<
class Digi,
class RecHit>
89 double ampl=0;
int maxI = -1;
double maxA = -1e10;
double ta=0;
90 double prenoise = 0;
double postnoise = 0;
95 for(
int k = 0 ;
k < tool.
size() &&
k < ifirst;
k++){
106 if(noiseslices != 0) {
107 noise = (prenoise+postnoise)/
double(noiseslices);
112 double noisefactor=1.;
113 for (
int i=ifirst;
i<tool.
size() &&
i<n+ifirst;
i++) {
114 int capid=digi[
i].capid();
120 ta = tool[
i]-noisefactor*noise;
135 if(maxI==0 || maxI==(tool.
size()-1)) {
136 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reco2 :"
137 <<
" Invalid max amplitude position, "
138 <<
" max Amplitude: "<< maxI
139 <<
" first: "<<ifirst
140 <<
" last: "<<(tool.
size()-1)
143 int capid=digi[maxI-1].capid();
144 double Energy0 = ((tool[maxI-1])*calibs.
respcorrgain(capid) );
147 if(Energy0<0){Energy0=0.;}
148 capid=digi[
maxI].capid();
150 if(Energy1<0){Energy1=0.;}
151 capid=digi[maxI+1].capid();
152 double Energy2 = ((tool[maxI+1])*calibs.
respcorrgain(capid) );
153 if(Energy2<0){Energy2=0.;}
155 double TSWeightEnergy = ((maxI-1)*Energy0 + maxI*Energy1 + (maxI+1)*Energy2);
156 double EnergySum=Energy0+Energy1+Energy2;
158 if (EnergySum!=0) AvgTSPos=TSWeightEnergy/ EnergySum;
164 time = (AvgTSPos*25.0);
171 return RecHit(digi.id(),ampl,
time);
178 return ZdcSimpleRecAlgoImpl::reco1<ZDCDataFrame,ZDCRecHit>(digi,coder,calibs,
183 return ZdcSimpleRecAlgoImpl::reco2<ZDCDataFrame,ZDCRecHit>(digi,coder,calibs,
187 edm::LogError(
"ZDCSimpleRecAlgoImpl::reconstruct, recoMethod was not declared");
301 int index = (int)flx;
314 yval = y1 + (y2-y1)*(flx-(
float)
index);
RecHit reco1(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor)
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
static const float scale_zdc
static const float wpksamp0_zdc
double getCorrection(double fc_ampl) const
RecHit reco2(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor)
double pedestal(int fCapId) const
get pedestal for capid=0..3
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calibs) const
ZdcSimpleRecAlgo(int firstSample, int samplesToAdd, bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs, int recoMethod)
std::auto_ptr< HcalPulseContainmentCorrection > pulseCorr_
static float timeshift_ns_zdc(float wpksamp)
const T & max(const T &a, const T &b)
static double MaximumFractionalError
static const float actual_ns_zdc[num_bins_zdc]
int size() const
get the size
double timecorr() const
get time correction factor
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
static const int num_bins_zdc
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...