31 template <
class Digi,
class RecHit>
48 for (
int i = ifirst;
i < tool.
size() &&
i <
n + ifirst;
i++) {
49 int capid = digi[
i].capid();
52 ta *= calibs.
gain(capid);
74 int capid = digi[
maxI - 1].capid();
76 capid = digi[
maxI + 1].capid();
78 float wpksamp = (
t0 + maxA +
t2);
80 wpksamp = (maxA + 2.0 *
t2) / wpksamp;
83 if (
corr !=
nullptr) {
85 ampl *=
corr->getCorrection(fc_ampl);
92 return RecHit(digi.id(), ampl,
time);
98 for (
int i = ifirst;
i < digi.size() &&
i <
n + ifirst;
i++) {
108 template <
class Digi,
class RecHit>
114 const double& satCorrConst,
122 if (ifirst +
n > digi.size())
134 int capid = digi[ifirst].capid();
135 float ta = tool[ifirst] - calibs.
pedestal(capid);
136 float ta1 = ta * calibs.
gain(capid);
139 capid = digi[ifirst + 1].capid();
140 ta = tool[ifirst + 1] - calibs.
pedestal(capid);
141 float ta2 = ta * calibs.
gain(capid);
146 if (ta2 / satCorrConst <= ta1)
151 ampl = ta2 + ta2 / satCorrConst;
154 rechit.setEnergy(ampl);
166 return CastorSimpleRecAlgoImpl::reco<CastorDataFrame, CastorRecHit>(
183 const double& satCorrConst)
const {
184 if (CastorSimpleRecAlgoImpl::corrSaturation<CastorDataFrame, CastorRecHit>(
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...
int size() const
get the size
CastorSimpleRecAlgo(int firstSample, int samplesToAdd, bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs)
void recoverADCSaturation(CastorRecHit &rechit, const CastorCoder &coder, const CastorCalibrations &calibs, const CastorDataFrame &digi, const int &maxADCvalue, const double &satCorrConst) const
double gain(int fCapId) const
get gain for capid=0..3
virtual void adc2fC(const CastorDataFrame &df, CaloSamples &lf) const =0
constexpr void setFlagField(uint32_t value, int base, int width=1)
bool corrSaturation(RecHit &rechit, const CastorCoder &coder, const CastorCalibrations &calibs, const Digi &digi, const int &maxADCvalue, const double &satCorrConst, int ifirst, int n)
std::unique_ptr< CastorPulseContainmentCorrection > pulseCorr_
static const float wpksamp0_hf
static const float actual_ns_hf[num_bins_hf]
static const float scale_hf
double pedestal(int fCapId) const
get pedestal for capid=0..3
constexpr double MaximumFractionalError
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
void checkADCSaturation(CastorRecHit &rechit, const CastorDataFrame &digi, const int &maxADCvalue) const
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
static const int num_bins_hf
CastorRecHit reconstruct(const CastorDataFrame &digi, const CastorCoder &coder, const CastorCalibrations &calibs) const
RecHit reco(const Digi &digi, const CastorCoder &coder, const CastorCalibrations &calibs, int ifirst, int n, bool slewCorrect, const CastorPulseContainmentCorrection *corr, CastorTimeSlew::BiasSetting slewFlavor)
uint16_t *__restrict__ uint16_t const *__restrict__ adc