14 correctForPulse_(correctForPulse),
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;
51 double lowGfc_ampl = 0;
60 for (
int i = ifirst;
i < tool.
size() &&
i <
n + ifirst;
i++) {
61 int capid = digi[
i].capid();
78 for (
int iLG = (ifirst +
lowGainOffset); iLG < tool.
size() && iLG < topLowGain; iLG++) {
79 int capid = digi[iLG].capid();
80 TempLGAmp = (tool[iLG] - calibs.
pedestal(capid));
81 lowGfc_ampl += TempLGAmp;
84 lowGEnergy += TempLGAmp;
90 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reco1 :"
91 <<
" Invalid max amplitude position, "
92 <<
" max Amplitude: " <<
maxI <<
" first: " << ifirst <<
" last: " << (tool.
size() - 1)
95 int capid = digi[
maxI - 1].capid();
102 capid = digi[
maxI].capid();
107 capid = digi[
maxI + 1].capid();
113 double TSWeightEnergy = ((
maxI - 1) * Energy0 +
maxI * Energy1 + (
maxI + 1) * Energy2);
114 double EnergySum = Energy0 + Energy1 + Energy2;
115 double AvgTSPos = 0.;
117 AvgTSPos = TSWeightEnergy / EnergySum;
123 time = (AvgTSPos * 25.0);
125 if (
corr !=
nullptr) {
127 ampl *=
corr->getCorrection(fc_ampl);
130 return RecHit(digi.id(), ampl,
time, lowGEnergy);
135 template <
class Digi,
class RecHit>
139 const std::vector<unsigned int>& myNoiseTS,
140 const std::vector<unsigned int>& mySignalTS,
149 int ifirst = mySignalTS[0];
156 double lowGEnergy = 0;
157 double lowGfc_ampl = 0;
158 double TempLGAmp = 0;
170 for (
unsigned int iv = 0; iv < myNoiseTS.size(); ++iv) {
171 CurrentTS = myNoiseTS[iv];
172 if (CurrentTS >= digi.size())
174 Allnoise += tool[CurrentTS];
177 if (noiseslices != 0) {
178 noise = (Allnoise) /
double(noiseslices);
182 for (
unsigned int ivs = 0; ivs < mySignalTS.size(); ++ivs) {
183 CurrentTS = mySignalTS[ivs];
184 if (CurrentTS >= digi.size())
186 int capid = digi[CurrentTS].capid();
192 ta = tool[CurrentTS] -
noise;
202 for (
unsigned int iLGvs = 0; iLGvs < mySignalTS.size(); ++iLGvs) {
204 if (CurrentTS >= digi.size())
206 int capid = digi[CurrentTS].capid();
207 TempLGAmp = tool[CurrentTS] -
noise;
208 lowGfc_ampl += TempLGAmp;
211 lowGEnergy += TempLGAmp;
221 LogDebug(
"HCAL Pulse") <<
"ZdcSimpleRecAlgo::reco2 :"
222 <<
" Invalid max amplitude position, "
223 <<
" max Amplitude: " <<
maxI <<
" first: " << ifirst <<
" last: " << (tool.
size() - 1)
226 int capid = digi[
maxI - 1].capid();
233 capid = digi[
maxI].capid();
238 capid = digi[
maxI + 1].capid();
244 double TSWeightEnergy = ((
maxI - 1) * Energy0 +
maxI * Energy1 + (
maxI + 1) * Energy2);
245 double EnergySum = Energy0 + Energy1 + Energy2;
246 double AvgTSPos = 0.;
248 AvgTSPos = TSWeightEnergy / EnergySum;
254 time = (AvgTSPos * 25.0);
256 if (
corr !=
nullptr) {
258 ampl *=
corr->getCorrection(fc_ampl);
261 return RecHit(digi.id(), ampl,
time, lowGEnergy);
266 const std::vector<unsigned int>& myNoiseTS,
267 const std::vector<unsigned int>& mySignalTS,
271 return ZdcSimpleRecAlgoImpl::reco1<ZDCDataFrame, ZDCRecHit>(
274 return ZdcSimpleRecAlgoImpl::reco2<ZDCDataFrame, ZDCRecHit>(
277 edm::LogError(
"ZDCSimpleRecAlgoImpl::reconstruct, recoMethod was not declared");