4 : startTime_(
startTime), stopTime_(stopTime) {}
7 const std::vector<double>& amplitudes,
13 const float targetTimePrecision,
14 const bool correctForOOT)
const {
20 std::vector<float> pedSubSamples(nsample);
21 for (
unsigned int iSample = 0; iSample < nsample; iSample++) {
28 double gainratio = 1.;
53 pulsenorm += fullpulse(iSample);
58 for (
auto const& amplit : amplitudes) {
60 int bxp3 = ipulse - 2;
61 int firstsamplet =
std::max(0, bxp3);
64 for (
unsigned int isample = firstsamplet; isample < nsample; ++isample) {
66 pedSubSamples[isample] =
std::max(0., pedSubSamples[isample] - amplit *
pulse / pulsenorm);
79 float cc1 =
computeCC(pedSubSamples, fullpulse,
t1);
81 float cc2 =
computeCC(pedSubSamples, fullpulse,
t2);
114 const float time)
const {
124 auto facM1orP2 = 0.25 *
tt * (
tt - 1);
125 auto fac = (0.25 * (
tt - 2) - 0.5 * (
tt + 1)) * (
tt - 1);
126 auto facP1 = (0.25 * (
tt + 1) - 0.5 * (
tt - 2)) *
tt;
129 facM1orP2 * fullpulse[
i - 1] + fac * fullpulse[
i] + facP1 * fullpulse[
i + 1] + facM1orP2 * fullpulse[
i + 2];
135 interpPulse[0] = facM1orP2 * fullpulse[0] + facP1 * fullpulse[1] + facM1orP2 * fullpulse[2];
143 for (
int i = 0;
i < interpPulseShifted.size(); ++
i) {
145 interpPulseShifted[
i] = interpPulse[
i +
shift];
147 interpPulseShifted[
i] = 0;
149 return interpPulseShifted;
154 const float time)
const {
155 constexpr
int exclude = 1;
156 float powerSamples = 0.;
157 float powerTemplate = 0.;
160 for (
int i = exclude;
i <
int(
samples.size() - exclude); ++
i) {
162 powerTemplate +=
std::pow(interpolated[
i], 2);
uint32_t cc[maxCellsPerHit]
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
static constexpr int TIME_WHEN_NOT_CONVERGING
static constexpr int MAX_NUM_OF_ITERATIONS
static constexpr float GOLDEN_RATIO
Abs< T >::type abs(const T &t)
EcalMGPASample sample(int i) const
static constexpr double Samp_Period
float computeCC(const std::vector< float > &samples, const FullSampleVector &sigmalTemplate, const float t) const
float gain12Over6() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
static constexpr float GLOBAL_TIME_SHIFT
double pulse(double x, double y, double z, double t)
EcalUncalibRecHitTimingCCAlgo(const float startTime, const float stopTime)
static std::atomic< unsigned int > counter
static unsigned int const shift
double computeTimeCC(const EcalDataFrame &dataFrame, const std::vector< double > &litudes, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const FullSampleVector &fullpulse, EcalUncalibratedRecHit &uncalibRecHit, float &errOnTime, const float targetTimePrecision, const bool correctForOOT=true) const
static constexpr int MAXSAMPLES
static constexpr float ONE_MINUS_GOLDEN_RATIO
FullSampleVector interpolatePulse(const FullSampleVector &fullpulse, const float t=0) const