23 applyTimeSlew_=iApplyTimeSlew;
24 fPedestalSubFxn_=pedSubFxn;
39 sum= landauFrac[
int(ceil(tStart+tsWidth))];
50 sum= siPM205Frac[
int(ceil(tStart+tsWidth))];
61 sum= siPM206Frac[
int(ceil(tStart+tsWidth))];
73 sum= siPM207Frac[
int(ceil(tStart+tsWidth))];
79 case shape205: get205Frac(tStart,tEnd,sum);
break;
80 case shape206: get206Frac(tStart,tEnd,sum);
break;
81 case shape207: get207Frac(tStart,tEnd,sum);
break;
82 case shapeLandau: getLandauFrac(tStart,tEnd,sum);
break;
87 float& reconstructedEnergy,
88 float& reconstructedTime,
93 unsigned int soi=channelData.
soi();
95 std::vector<double> corrCharge;
96 std::vector<double> inputCharge;
97 std::vector<double> inputPedestal;
98 std::vector<double> inputNoise;
102 for(
unsigned int ip=0; ip<channelData.
nSamples(); ip++){
110 inputCharge.push_back(charge);
111 inputPedestal.push_back(ped);
112 inputNoise.push_back(noise);
116 fPedestalSubFxn_.calculate(inputCharge, inputPedestal, inputNoise, corrCharge, soi, channelData.
nSamples());
118 if (fTimeSlew_==0) respCorr=1.0;
119 else if (fTimeSlew_==1) channelData.
hasTimeInfo()?respCorr=rCorrSiPM[0]:respCorr=rCorr[0];
120 else if (fTimeSlew_==2) channelData.
hasTimeInfo()?respCorr=rCorrSiPM[1]:respCorr=rCorr[1];
121 else if (fTimeSlew_==3) respCorr=frespCorr_;
123 float tsShift3,tsShift4,tsShift5;
124 tsShift3=0.f,tsShift4=0.f,tsShift5=0.f;
127 tsShift3=hcalTimeSlew_delay->
delay(inputCharge[soi-1], fTimeSlew_, fTimeSlewBias_, !channelData.
hasTimeInfo());
128 tsShift4=hcalTimeSlew_delay->
delay(inputCharge[soi], fTimeSlew_, fTimeSlewBias_, !channelData.
hasTimeInfo());
129 tsShift5=hcalTimeSlew_delay->
delay(inputCharge[soi+1], fTimeSlew_, fTimeSlewBias_, !channelData.
hasTimeInfo());
132 float ch3,ch4,ch5, i3,n3,nn3, i4,n4,i5,n5;
133 ch3=0.f,ch4=0.f,ch5=0.f,i3=0.f,n3=0.f,nn3=0.f,i4=0.f,n4=0.f,i5=0.f,n5=0.f;
139 else fType = shapeLandau;
141 getFrac(-tsShift3,-tsShift3+tsWidth,i3,fType);
142 getFrac(-tsShift3+tsWidth,-tsShift3+tsWidth*2,n3,fType);
143 getFrac(-tsShift3+tsWidth*2,-tsShift3+tsWidth*3,nn3,fType);
145 getFrac(-tsShift4,-tsShift4+tsWidth,i4,fType);
146 getFrac(-tsShift4+tsWidth,-tsShift4+tsWidth*2,n4,fType);
148 getFrac(-tsShift5,-tsShift5+tsWidth,i5,fType);
149 getFrac(-tsShift5+tsWidth,-tsShift5+tsWidth*2,n5,fType);
151 if (i3 != 0 && i4 != 0 && i5 != 0) {
153 ch3=corrCharge[soi-1]/i3;
154 ch4=(i3*corrCharge[soi]-n3*corrCharge[soi-1])/(i3*i4);
155 ch5=(n3*n4*corrCharge[soi-1]-i4*nn3*corrCharge[soi-1]-i3*n4*corrCharge[soi]+i3*i4*corrCharge[soi+1])/(i3*i4*i5);
157 if (ch3<negThresh[0]) {
159 ch4=corrCharge[soi]/i4;
160 ch5=(i4*corrCharge[soi+1]-n4*corrCharge[soi])/(i4*i5);
162 if (ch5<negThresh[0] && ch4>negThresh[1]) {
163 double ratio = (corrCharge[soi]-ch3*i3)/(corrCharge[soi+1]-negThresh[0]*i5);
164 if (ratio < 5 && ratio > 0.5) {
167 getFrac(-invG,-invG+tsWidth,iG,fType);
169 ch4=(corrCharge[soi]-ch3*n3)/(iG);
180 reconstructedEnergy=ch4*gainCorr*respCorr;
181 reconstructedTime=tsShift4;
void getFrac(float, float, float &, FType) const
static constexpr float rCorr[2]
double tsGain(const unsigned ts) const
static constexpr float rCorrSiPM[2]
void get206Frac(float tStart, float tEnd, float &sum) const
static constexpr int HcalRegion[2]
double delay(double fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
double tsPedestal(const unsigned ts) const
double tsRawCharge(const unsigned ts) const
static constexpr float siPM206Frac[125]
void get205Frac(float tStart, float tEnd, float &sum) const
Abs< T >::type abs(const T &t)
static constexpr float siPM205Frac[125]
void getLandauFrac(float tStart, float tEnd, float &sum) const
void get207Frac(float tStart, float tEnd, float &sum) const
void init(HcalTimeSlew::ParaSource tsParam, HcalTimeSlew::BiasSetting bias, bool iApplyTimeSlew, PedestalSub pedSubFxn, double respCorr)
static constexpr float landauFrac[125]
double tsPedestalWidth(const unsigned ts) const
static constexpr float siPM207Frac[125]
static constexpr float negThresh[2]
unsigned nSamples() const
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, const HcalTimeSlew *hcalTimeSlew_delay) const
static constexpr float invGpar[3]