![]() |
Project
|
#include <CaloRawFitter.h>
Inherited by o2::emcal::CaloRawFitterGamma2, and o2::emcal::CaloRawFitterStandard.
Public Types | |
| enum class | RawFitterError_t { SAMPLE_UNINITIALIZED , FIT_ERROR , CHI2_ERROR , BUNCH_NOT_OK , LOW_SIGNAL } |
| Error codes for failures in raw fitter procedure. More... | |
Public Member Functions | |
| CaloRawFitter (const char *name, const char *nameshort) | |
| Constructor. | |
| virtual | ~CaloRawFitter ()=default |
| Destructor. | |
| virtual CaloFitResults | evaluate (const gsl::span< const Bunch > bunchvector)=0 |
| 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. | |
| void | setTimeConstraint (int min, int max) |
| The require time range if the maximum ADC value is between min and max (timebin) | |
| void | setIsZeroSuppressed (bool iszs=true) |
| void | setAmpCut (float cut) |
| void | setNsamplePed (int i) |
| void | setL1Phase (double phase) |
| bool | getIsZeroSuppressed () const |
| float | getAmpCut () const |
| int | getNsamplePed () const |
| double | getReversed (const int i) const |
| const std::string_view | getAlgoName () const |
| const std::string_view | getAlgoAbbr () const |
| FitAlgorithm | getAlgo () const |
| Get Type of the fit algorithm. | |
| std::tuple< short, int > | getMaxAmplitudeBunch (const Bunch &bunchx) const |
| Get the maximum amplitude and its index of a bunch array. | |
| unsigned short | getMaxAmplitudeBunch (const gsl::span< unsigned short > data) const |
| Get maximum of array. | |
| bool | isMaxADCBunchEdge (const Bunch &bunch) const |
| Check if the max. ADC value is at the edge of a bunch. | |
| bool | isInTimeRange (int indexMaxADC, int maxtime, int mintime) const |
| Check if the index of the max ADC vaue is within accepted time range. | |
| 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 altrocfg1 and altrocfg2. | |
| 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. | |
| 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. | |
| double | evaluatePedestal (const gsl::span< const uint16_t > data, std::optional< int > length) const |
| Calculate the pedestal from the ADC values in a bunch. | |
| double | calculateChi2 (double amp, double time, int first, int last, double adcErr=1, double tau=2.35) const |
| Calculates the chi2 of the fit. | |
| int | getMinTimeIndex () const |
| int | getMaxTimeIndex () const |
Static Public Member Functions | |
| static std::string | createErrorMessage (RawFitterError_t fiterror) |
| Create error message for a given error type. | |
| static int | getErrorNumber (RawFitterError_t fiterror) |
| Convert error type to numeric representation. | |
| static RawFitterError_t | intToErrorType (unsigned int fiterror) |
| Convert numeric representation of error type to RawFitterError_t. | |
| static constexpr int | getNumberOfErrorTypes () noexcept |
| Get the number of raw fit error types supported. | |
| static const char * | getErrorTypeName (RawFitterError_t fiterror) |
| Get the name connected to the fit error type. | |
| static const char * | getErrorTypeName (unsigned int fiterror) |
| Get the name connected to the fit error type. | |
| 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. | |
| static const char * | getErrorTypeDescription (RawFitterError_t fiterror) |
| Get the description connected to the fit error type. | |
| static const char * | getErrorTypeDescription (unsigned int fiterror) |
| Get the description connected to the fit error type. | |
Protected Member Functions | |
| ClassDefNV (CaloRawFitter, 1) | |
Protected Attributes | |
| std::array< double, constants::EMCAL_MAXTIMEBINS > | mReversed |
| Reversed sequence of samples (pedestalsubtracted) | |
| int | mMinTimeIndex |
| The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex. | |
| int | mMaxTimeIndex |
| The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex. | |
| float | mAmpCut |
| Max ADC - pedestal must be higher than this befor attemting to extract the amplitude. | |
| int | mNsamplePed |
| Number of samples used for pedestal calculation (first in bunch) | |
| bool | mIsZerosupressed |
| Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true. | |
| std::string | mName |
| Name of the algorithm. | |
| std::string | mNameShort |
| Abbrevation for the name. | |
| FitAlgorithm | mAlgo |
| Which algorithm to use. | |
| double | mL1Phase |
| Phase of the ADC sampling clock relative to the LHC clock. | |
| double | mAmp |
| The amplitude in entities of ADC counts. | |
Definition at line 40 of file CaloRawFitter.h.
|
strong |
Error codes for failures in raw fitter procedure.
| Enumerator | |
|---|---|
| SAMPLE_UNINITIALIZED | Samples not initialized or length is 0. |
| FIT_ERROR | Fit procedure failed. |
| CHI2_ERROR | Chi2 cannot be determined (usually due to insufficient amount of samples) |
| BUNCH_NOT_OK | Bunch selection failed. |
| LOW_SIGNAL | No ADC value above threshold found. |
Definition at line 48 of file CaloRawFitter.h.
Constructor.
Definition at line 129 of file CaloRawFitter.cxx.
|
virtualdefault |
Destructor.
| double CaloRawFitter::calculateChi2 | ( | double | amp, |
| double | time, | ||
| int | first, | ||
| int | last, | ||
| double | adcErr = 1, |
||
| double | tau = 2.35 |
||
| ) | const |
Calculates the chi2 of the fit.
| amp | - max amplitude; |
| time | - time of max amplitude; |
| first | - sample array indices to be used |
| last | - sample array indices to be used |
| adcErr | - nominal error of amplitude measurement (one value for all channels) if adcErr<0 that mean adcErr=1. |
| tau | - filter time response (in timebin units) |
Definition at line 304 of file CaloRawFitter.cxx.
|
protected |
|
inlinestatic |
Create error message for a given error type.
| fiterror | Fit error type |
Definition at line 59 of file CaloRawFitter.h.
|
pure virtual |
Implemented in o2::emcal::CaloRawFitterGamma2, and o2::emcal::CaloRawFitterStandard.
| double CaloRawFitter::evaluatePedestal | ( | const gsl::span< const uint16_t > | data, |
| std::optional< int > | length | ||
| ) | const |
Calculate the pedestal from the ADC values in a bunch.
| data | ADC values from which to calculate the pedestal |
| length | Optional bunch length |
Definition at line 221 of file CaloRawFitter.cxx.
| std::tuple< int, int > CaloRawFitter::findPeakRegion | ( | const gsl::span< double > | adcValues, |
| short | indexMaxADC, | ||
| int | threshold | ||
| ) | const |
Find region constrainded by its closest minima around the main peak.
| adcValues | ADC values of the bunch |
| indexMaxADC | Index of the maximum ADC value |
| threshold | Min. ADC value accepted in peak region |
Definition at line 158 of file CaloRawFitter.cxx.
|
inline |
Get Type of the fit algorithm.
Definition at line 181 of file CaloRawFitter.h.
|
inline |
Definition at line 177 of file CaloRawFitter.h.
|
inline |
Definition at line 176 of file CaloRawFitter.h.
|
inline |
Definition at line 171 of file CaloRawFitter.h.
|
static |
Convert error type to numeric representation.
| fiterror | Fit error type |
Definition at line 29 of file CaloRawFitter.cxx.
|
static |
Get the description connected to the fit error type.
A detailed description i.e. used for error message on the stdout is produced.
| errortype | Error type raising the exception (symbolic representation) |
Definition at line 109 of file CaloRawFitter.cxx.
|
inlinestatic |
Get the description connected to the fit error type.
A detailed description i.e. used for error message on the stdout is produced.
| errortype | Error type raising the exception (numeric representation) |
Definition at line 136 of file CaloRawFitter.h.
|
static |
Get the name connected to the fit error type.
A single word descriptor i.e. used for object names is produced.
| errortype | Error type raising the exception (symbolic representation) |
Definition at line 71 of file CaloRawFitter.cxx.
|
inlinestatic |
Get the name connected to the fit error type.
A single word descriptor i.e. used for object names is produced.
| errortype | Error type raising the exception (numeric representation) |
Definition at line 94 of file CaloRawFitter.h.
|
static |
Get the title connected to the fit error type.
A short description i.e. used for bin labels or histogam titles is produced.
| errortype | Error type raising the exception (symbolic representation) |
Definition at line 90 of file CaloRawFitter.cxx.
|
inlinestatic |
Get the title connected to the fit error type.
A short description i.e. used for bin labels or histogam titles is produced.
| errortype | Error type raising the exception (numeric representation) |
Definition at line 115 of file CaloRawFitter.h.
|
inline |
Definition at line 170 of file CaloRawFitter.h.
| std::tuple< short, int > CaloRawFitter::getMaxAmplitudeBunch | ( | const Bunch & | bunchx | ) | const |
Get the maximum amplitude and its index of a bunch array.
Definition at line 232 of file CaloRawFitter.cxx.
| unsigned short CaloRawFitter::getMaxAmplitudeBunch | ( | const gsl::span< unsigned short > | data | ) | const |
|
inline |
Definition at line 247 of file CaloRawFitter.h.
|
inline |
Definition at line 246 of file CaloRawFitter.h.
|
inline |
Definition at line 172 of file CaloRawFitter.h.
|
inlinestaticconstexprnoexcept |
Get the number of raw fit error types supported.
Definition at line 76 of file CaloRawFitter.h.
|
inline |
Definition at line 175 of file CaloRawFitter.h.
|
static |
Convert numeric representation of error type to RawFitterError_t.
Expect the error code provided to be a valid error code.
| fiterror | Numeric representation of fit error |
Definition at line 48 of file CaloRawFitter.cxx.
| bool CaloRawFitter::isInTimeRange | ( | int | indexMaxADC, |
| int | maxtime, | ||
| int | mintime | ||
| ) | const |
Check if the index of the max ADC vaue is within accepted time range.
| indexMaxADC | Index of the max. ADC value |
| maxtime | Max. time value of the accepted range |
| mintime | Min. time value of the accepted range |
Definition at line 295 of file CaloRawFitter.cxx.
| bool CaloRawFitter::isMaxADCBunchEdge | ( | const Bunch & | bunch | ) | const |
Check if the max. ADC value is at the edge of a bunch.
| bunch | The bunch to be checked |
Definition at line 248 of file CaloRawFitter.cxx.
| std::tuple< int, int, float, short, short, float, int, int > CaloRawFitter::preFitEvaluateSamples | ( | const gsl::span< const Bunch > | bunchvector, |
| int | adcThreshold | ||
| ) |
Method to do the selection of what should possibly be fitted.
| bunchvector | ALTRO bunches for the current channel |
| adcThreshold | ADC threshold applied in peak finding |
Definition at line 336 of file CaloRawFitter.cxx.
| std::tuple< float, std::array< double, constants::EMCAL_MAXTIMEBINS > > CaloRawFitter::reverseAndSubtractPed | ( | const Bunch & | bunch | ) | const |
Time sample comes in reversed order, revers them back Subtract the baseline based on content of altrocfg1 and altrocfg2.
Definition at line 206 of file CaloRawFitter.cxx.
| std::tuple< short, short, short > CaloRawFitter::selectMaximumBunch | ( | const gsl::span< const Bunch > & | bunchvector | ) |
We select the bunch with the highest amplitude unless any time constraints is set.
| bunchvector | Bunches of the channel among which to select the maximium |
| RawFitterError_t::BUNCH_NOT_OK | ADC value is at a bunch edge |
Definition at line 269 of file CaloRawFitter.cxx.
|
inline |
Definition at line 166 of file CaloRawFitter.h.
|
inline |
Definition at line 165 of file CaloRawFitter.h.
|
inline |
Definition at line 168 of file CaloRawFitter.h.
|
inline |
Definition at line 167 of file CaloRawFitter.h.
| void CaloRawFitter::setTimeConstraint | ( | int | min, |
| int | max | ||
| ) |
The require time range if the maximum ADC value is between min and max (timebin)
Definition at line 142 of file CaloRawFitter.cxx.
|
protected |
Which algorithm to use.
Definition at line 264 of file CaloRawFitter.h.
|
protected |
The amplitude in entities of ADC counts.
Definition at line 268 of file CaloRawFitter.h.
|
protected |
Max ADC - pedestal must be higher than this befor attemting to extract the amplitude.
Definition at line 255 of file CaloRawFitter.h.
|
protected |
Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true.
Definition at line 259 of file CaloRawFitter.h.
|
protected |
Phase of the ADC sampling clock relative to the LHC clock.
Definition at line 266 of file CaloRawFitter.h.
|
protected |
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
Definition at line 253 of file CaloRawFitter.h.
|
protected |
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
Definition at line 252 of file CaloRawFitter.h.
|
protected |
Name of the algorithm.
Definition at line 261 of file CaloRawFitter.h.
|
protected |
Abbrevation for the name.
Definition at line 262 of file CaloRawFitter.h.
|
protected |
Number of samples used for pedestal calculation (first in bunch)
Definition at line 257 of file CaloRawFitter.h.
|
protected |
Reversed sequence of samples (pedestalsubtracted)
Definition at line 250 of file CaloRawFitter.h.