11#ifndef EMCALRAWFITTER_H_
12#define EMCALRAWFITTER_H_
160 std::tuple<int, int, float, short, short, float, int, int>
preFitEvaluateSamples(
const gsl::span<const Bunch> bunchvector,
int adcThreshold);
202 bool isInTimeRange(
int indexMaxADC,
int maxtime,
int mintime)
const;
215 std::tuple<short, short, short>
selectMaximumBunch(
const gsl::span<const Bunch>& bunchvector);
223 std::tuple<int, int>
findPeakRegion(
const gsl::span<double> adcValues,
short indexMaxADC,
int threshold)
const;
244 double tau = 2.35)
const;
250 std::array<double, constants::EMCAL_MAXTIMEBINS>
mReversed;
Container class to hold results from fitting.
float mAmpCut
Max ADC - pedestal must be higher than this befor attemting to extract the amplitude.
static constexpr int getNumberOfErrorTypes() noexcept
Get the number of raw fit error types supported.
ClassDefNV(CaloRawFitter, 1)
static const char * getErrorTypeDescription(unsigned int fiterror)
Get the description connected to the fit error type.
void setAmpCut(float cut)
bool isMaxADCBunchEdge(const Bunch &bunch) const
Check if the max. ADC value is at the edge of a bunch.
void setIsZeroSuppressed(bool iszs=true)
std::string mNameShort
Abbrevation for the name.
double getReversed(const int i) const
std::tuple< short, short, short > selectMaximumBunch(const gsl::span< const Bunch > &bunchvector)
We select the bunch with the highest amplitude unless any time constraints is set.
FitAlgorithm getAlgo() const
Get Type of the fit algorithm.
static const char * getErrorTypeTitle(RawFitterError_t fiterror)
Get the title connected to the fit error type.
static const char * getErrorTypeTitle(unsigned int fiterror)
Get the title connected to the fit error type.
int getMaxTimeIndex() const
std::tuple< int, int, float, short, short, float, int, int > preFitEvaluateSamples(const gsl::span< const Bunch > bunchvector, int adcThreshold)
Method to do the selection of what should possibly be fitted.
virtual CaloFitResults evaluate(const gsl::span< const Bunch > bunchvector)=0
int mMaxTimeIndex
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
std::array< double, constants::EMCAL_MAXTIMEBINS > mReversed
Reversed sequence of samples (pedestalsubtracted)
std::string mName
Name of the algorithm.
double mL1Phase
Phase of the ADC sampling clock relative to the LHC clock.
std::tuple< short, int > getMaxAmplitudeBunch(const Bunch &bunchx) const
Get the maximum amplitude and its index of a bunch array.
bool isInTimeRange(int indexMaxADC, int maxtime, int mintime) const
Check if the index of the max ADC vaue is within accepted time range.
int getMinTimeIndex() const
const std::string_view getAlgoName() const
bool getIsZeroSuppressed() const
int getNsamplePed() const
double evaluatePedestal(const gsl::span< const uint16_t > data, std::optional< int > length) const
Calculate the pedestal from the ADC values in a bunch.
void setNsamplePed(int i)
static const char * getErrorTypeName(unsigned int fiterror)
Get the name connected to the fit error type.
const std::string_view getAlgoAbbr() const
double mAmp
The amplitude in entities of ADC counts.
static int getErrorNumber(RawFitterError_t fiterror)
Convert error type to numeric representation.
static const char * getErrorTypeDescription(RawFitterError_t fiterror)
Get the description connected to the fit error type.
std::tuple< int, int > findPeakRegion(const gsl::span< double > adcValues, short indexMaxADC, int threshold) const
Find region constrainded by its closest minima around the main peak.
std::tuple< float, std::array< double, constants::EMCAL_MAXTIMEBINS > > reverseAndSubtractPed(const Bunch &bunch) const
Time sample comes in reversed order, revers them back Subtract the baseline based on content of altro...
double calculateChi2(double amp, double time, int first, int last, double adcErr=1, double tau=2.35) const
Calculates the chi2 of the fit.
virtual ~CaloRawFitter()=default
Destructor.
RawFitterError_t
Error codes for failures in raw fitter procedure.
@ LOW_SIGNAL
No ADC value above threshold found.
@ FIT_ERROR
Fit procedure failed.
@ BUNCH_NOT_OK
Bunch selection failed.
@ SAMPLE_UNINITIALIZED
Samples not initialized or length is 0.
@ CHI2_ERROR
Chi2 cannot be determined (usually due to insufficient amount of samples)
static const char * getErrorTypeName(RawFitterError_t fiterror)
Get the name connected to the fit error type.
FitAlgorithm mAlgo
Which algorithm to use.
static RawFitterError_t intToErrorType(unsigned int fiterror)
Convert numeric representation of error type to RawFitterError_t.
void setTimeConstraint(int min, int max)
The require time range if the maximum ADC value is between min and max (timebin)
bool mIsZerosupressed
Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracte...
int mMinTimeIndex
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
static std::string createErrorMessage(RawFitterError_t fiterror)
Create error message for a given error type.
void setL1Phase(double phase)
int mNsamplePed
Number of samples used for pedestal calculation (first in bunch)
GLuint const GLchar * name
GLuint GLsizei GLsizei * length
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...