14 correctForPulse_(correctForPulse),
23 pulseCorr_ = std::make_unique<HcalPulseContainmentCorrection>(
30 template <
class Digi,
class RecHit>
34 const std::vector<unsigned int>& myNoiseTS,
35 const std::vector<unsigned int>& mySignalTS,
43 int ifirst = mySignalTS[0];
44 int n = mySignalTS.size();
50 double lowGEnergy = 0;
59 for (
int i = ifirst;
i < tool.
size() &&
i <
n + ifirst;
i++) {
60 int capid = digi[
i].capid();
77 for (
int iLG = (ifirst +
lowGainOffset); iLG < tool.
size() && iLG < topLowGain; iLG++) {
78 int capid = digi[iLG].capid();
79 TempLGAmp = (tool[iLG] - calibs.
pedestal(capid));
82 lowGEnergy += TempLGAmp;
88 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reco1 :" 89 <<
" Invalid max amplitude position, " 90 <<
" max Amplitude: " <<
maxI <<
" first: " << ifirst <<
" last: " << (tool.
size() - 1)
93 int capid = digi[
maxI - 1].capid();
100 capid = digi[
maxI].capid();
105 capid = digi[
maxI + 1].capid();
111 double TSWeightEnergy = ((
maxI - 1) * Energy0 +
maxI * Energy1 + (
maxI + 1) * Energy2);
112 double EnergySum = Energy0 + Energy1 + Energy2;
113 double AvgTSPos = 0.;
115 AvgTSPos = TSWeightEnergy / EnergySum;
121 time = (AvgTSPos * 25.0);
123 if (
corr !=
nullptr) {
125 ampl *=
corr->getCorrection(fc_ampl);
128 return RecHit(digi.id(), ampl,
time, lowGEnergy);
133 template <
class Digi,
class RecHit>
137 const std::vector<unsigned int>& myNoiseTS,
138 const std::vector<unsigned int>& mySignalTS,
147 int ifirst = mySignalTS[0];
154 double lowGEnergy = 0;
155 double TempLGAmp = 0;
167 for (
unsigned int iv = 0;
iv < myNoiseTS.size(); ++
iv) {
168 CurrentTS = myNoiseTS[
iv];
169 if (CurrentTS >= digi.size())
171 Allnoise += tool[CurrentTS];
174 if (noiseslices != 0) {
175 noise = (Allnoise) /
double(noiseslices);
179 for (
unsigned int ivs = 0; ivs < mySignalTS.size(); ++ivs) {
180 CurrentTS = mySignalTS[ivs];
181 if (CurrentTS >= digi.size())
183 int capid = digi[CurrentTS].capid();
189 ta = tool[CurrentTS] -
noise;
199 for (
unsigned int iLGvs = 0; iLGvs < mySignalTS.size(); ++iLGvs) {
201 if (CurrentTS >= digi.size())
203 int capid = digi[CurrentTS].capid();
204 TempLGAmp = tool[CurrentTS] -
noise;
207 lowGEnergy += TempLGAmp;
217 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reco2 :" 218 <<
" Invalid max amplitude position, " 219 <<
" max Amplitude: " <<
maxI <<
" first: " << ifirst <<
" last: " << (tool.
size() - 1)
222 int capid = digi[
maxI - 1].capid();
229 capid = digi[
maxI].capid();
234 capid = digi[
maxI + 1].capid();
240 double TSWeightEnergy = ((
maxI - 1) * Energy0 +
maxI * Energy1 + (
maxI + 1) * Energy2);
241 double EnergySum = Energy0 + Energy1 + Energy2;
242 double AvgTSPos = 0.;
244 AvgTSPos = TSWeightEnergy / EnergySum;
250 time = (AvgTSPos * 25.0);
252 if (
corr !=
nullptr) {
254 ampl *=
corr->getCorrection(fc_ampl);
257 return RecHit(digi.id(), ampl,
time, lowGEnergy);
262 const std::vector<unsigned int>& myNoiseTS,
263 const std::vector<unsigned int>& mySignalTS,
267 return ZdcSimpleRecAlgoImpl::reco1<ZDCDataFrame, ZDCRecHit>(
270 return ZdcSimpleRecAlgoImpl::reco2<ZDCDataFrame, ZDCRecHit>(
273 edm::LogError(
"ZDCSimpleRecAlgoImpl::reconstruct, recoMethod was not declared");
RecHit reco1(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, int lowGainOffset, double lowGainFrac, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor)
int size() const
get the size
void initPulseCorr(int toadd, const HcalTimeSlew *hcalTimeSlew_delay)
Log< level::Error, false > LogError
constexpr double pedestal(int fCapId) const
get pedestal for capid=0..3
ZdcSimpleRecAlgo(bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs, int recoMethod, int lowGainOffset, double lowGainFrac)
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
std::unique_ptr< HcalPulseContainmentCorrection > pulseCorr_
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
RecHit reco2(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, int lowGainOffset, double lowGainFrac, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor)
constexpr double MaximumFractionalError