Project
Loading...
Searching...
No Matches
o2::emcal::CaloRawFitter Class Referenceabstract

#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, intpreFitEvaluateSamples (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, intgetMaxAmplitudeBunch (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, shortselectMaximumBunch (const gsl::span< const Bunch > &bunchvector)
 We select the bunch with the highest amplitude unless any time constraints is set.
 
std::tuple< int, intfindPeakRegion (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 chargetErrorTypeName (RawFitterError_t fiterror)
 Get the name connected to the fit error type.
 
static const chargetErrorTypeName (unsigned int fiterror)
 Get the name connected to the fit error type.
 
static const chargetErrorTypeTitle (RawFitterError_t fiterror)
 Get the title connected to the fit error type.
 
static const chargetErrorTypeTitle (unsigned int fiterror)
 Get the title connected to the fit error type.
 
static const chargetErrorTypeDescription (RawFitterError_t fiterror)
 Get the description connected to the fit error type.
 
static const chargetErrorTypeDescription (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.
 

Detailed Description

Definition at line 40 of file CaloRawFitter.h.

Member Enumeration Documentation

◆ RawFitterError_t

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 & Destructor Documentation

◆ CaloRawFitter()

CaloRawFitter::CaloRawFitter ( const char name,
const char nameshort 
)

Constructor.

Definition at line 129 of file CaloRawFitter.cxx.

◆ ~CaloRawFitter()

virtual o2::emcal::CaloRawFitter::~CaloRawFitter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ calculateChi2()

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.

Parameters
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)
Returns
chi2

Definition at line 304 of file CaloRawFitter.cxx.

◆ ClassDefNV()

o2::emcal::CaloRawFitter::ClassDefNV ( CaloRawFitter  ,
 
)
protected

◆ createErrorMessage()

static std::string o2::emcal::CaloRawFitter::createErrorMessage ( RawFitterError_t  fiterror)
inlinestatic

Create error message for a given error type.

Parameters
fiterrorFit error type
Returns
Error message connected to the error type

Definition at line 59 of file CaloRawFitter.h.

◆ evaluate()

virtual CaloFitResults o2::emcal::CaloRawFitter::evaluate ( const gsl::span< const Bunch bunchvector)
pure virtual

◆ evaluatePedestal()

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.

Parameters
dataADC values from which to calculate the pedestal
lengthOptional bunch length
Returns
Pedestal value

Definition at line 221 of file CaloRawFitter.cxx.

◆ findPeakRegion()

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.

Parameters
adcValuesADC values of the bunch
indexMaxADCIndex of the maximum ADC value
thresholdMin. ADC value accepted in peak region
Returns
Index of the closest minimum before the peak
Index of the closest minimum after the pea

Definition at line 158 of file CaloRawFitter.cxx.

◆ getAlgo()

FitAlgorithm o2::emcal::CaloRawFitter::getAlgo ( ) const
inline

Get Type of the fit algorithm.

Returns
Fit algorithm type

Definition at line 181 of file CaloRawFitter.h.

◆ getAlgoAbbr()

const std::string_view o2::emcal::CaloRawFitter::getAlgoAbbr ( ) const
inline

Definition at line 177 of file CaloRawFitter.h.

◆ getAlgoName()

const std::string_view o2::emcal::CaloRawFitter::getAlgoName ( ) const
inline

Definition at line 176 of file CaloRawFitter.h.

◆ getAmpCut()

float o2::emcal::CaloRawFitter::getAmpCut ( ) const
inline

Definition at line 171 of file CaloRawFitter.h.

◆ getErrorNumber()

int CaloRawFitter::getErrorNumber ( CaloRawFitter::RawFitterError_t  fiterror)
static

Convert error type to numeric representation.

Parameters
fiterrorFit error type
Returns
Numeric representation of the raw fitter error

Definition at line 29 of file CaloRawFitter.cxx.

◆ getErrorTypeDescription() [1/2]

const char * CaloRawFitter::getErrorTypeDescription ( CaloRawFitter::RawFitterError_t  fiterror)
static

Get the description connected to the fit error type.

A detailed description i.e. used for error message on the stdout is produced.

Parameters
errortypeError type raising the exception (symbolic representation)
Returns
Description connected to the fit error type

Definition at line 109 of file CaloRawFitter.cxx.

◆ getErrorTypeDescription() [2/2]

static const char * o2::emcal::CaloRawFitter::getErrorTypeDescription ( unsigned int  fiterror)
inlinestatic

Get the description connected to the fit error type.

A detailed description i.e. used for error message on the stdout is produced.

Parameters
errortypeError type raising the exception (numeric representation)
Returns
Description connected to the fit error type

Definition at line 136 of file CaloRawFitter.h.

◆ getErrorTypeName() [1/2]

const char * CaloRawFitter::getErrorTypeName ( CaloRawFitter::RawFitterError_t  fiterror)
static

Get the name connected to the fit error type.

A single word descriptor i.e. used for object names is produced.

Parameters
errortypeError type raising the exception (symbolic representation)
Returns
Name of the fit error type

Definition at line 71 of file CaloRawFitter.cxx.

◆ getErrorTypeName() [2/2]

static const char * o2::emcal::CaloRawFitter::getErrorTypeName ( unsigned int  fiterror)
inlinestatic

Get the name connected to the fit error type.

A single word descriptor i.e. used for object names is produced.

Parameters
errortypeError type raising the exception (numeric representation)
Returns
Name of the fit error type

Definition at line 94 of file CaloRawFitter.h.

◆ getErrorTypeTitle() [1/2]

const char * CaloRawFitter::getErrorTypeTitle ( CaloRawFitter::RawFitterError_t  fiterror)
static

Get the title connected to the fit error type.

A short description i.e. used for bin labels or histogam titles is produced.

Parameters
errortypeError type raising the exception (symbolic representation)
Returns
Title of the fit error type

Definition at line 90 of file CaloRawFitter.cxx.

◆ getErrorTypeTitle() [2/2]

static const char * o2::emcal::CaloRawFitter::getErrorTypeTitle ( unsigned int  fiterror)
inlinestatic

Get the title connected to the fit error type.

A short description i.e. used for bin labels or histogam titles is produced.

Parameters
errortypeError type raising the exception (numeric representation)
Returns
Title of the fit error type

Definition at line 115 of file CaloRawFitter.h.

◆ getIsZeroSuppressed()

bool o2::emcal::CaloRawFitter::getIsZeroSuppressed ( ) const
inline

Definition at line 170 of file CaloRawFitter.h.

◆ getMaxAmplitudeBunch() [1/2]

std::tuple< short, int > CaloRawFitter::getMaxAmplitudeBunch ( const Bunch bunchx) const

Get the maximum amplitude and its index of a bunch array.

Returns
Maximum ADC value of the bunch
Index of the max. ADC value of the bunch

Definition at line 232 of file CaloRawFitter.cxx.

◆ getMaxAmplitudeBunch() [2/2]

unsigned short CaloRawFitter::getMaxAmplitudeBunch ( const gsl::span< unsigned short data) const

Get maximum of array.

Returns
Maximum amplitute

Definition at line 153 of file CaloRawFitter.cxx.

◆ getMaxTimeIndex()

int o2::emcal::CaloRawFitter::getMaxTimeIndex ( ) const
inline

Definition at line 247 of file CaloRawFitter.h.

◆ getMinTimeIndex()

int o2::emcal::CaloRawFitter::getMinTimeIndex ( ) const
inline

Definition at line 246 of file CaloRawFitter.h.

◆ getNsamplePed()

int o2::emcal::CaloRawFitter::getNsamplePed ( ) const
inline

Definition at line 172 of file CaloRawFitter.h.

◆ getNumberOfErrorTypes()

static constexpr int o2::emcal::CaloRawFitter::getNumberOfErrorTypes ( )
inlinestaticconstexprnoexcept

Get the number of raw fit error types supported.

Returns
Number of error types (5)

Definition at line 76 of file CaloRawFitter.h.

◆ getReversed()

double o2::emcal::CaloRawFitter::getReversed ( const int  i) const
inline

Definition at line 175 of file CaloRawFitter.h.

◆ intToErrorType()

CaloRawFitter::RawFitterError_t CaloRawFitter::intToErrorType ( unsigned int  fiterror)
static

Convert numeric representation of error type to RawFitterError_t.

Expect the error code provided to be a valid error code.

Parameters
fiterrorNumeric representation of fit error
Returns
Symbolic representation of the error code

Definition at line 48 of file CaloRawFitter.cxx.

◆ isInTimeRange()

bool CaloRawFitter::isInTimeRange ( int  indexMaxADC,
int  maxtime,
int  mintime 
) const

Check if the index of the max ADC vaue is within accepted time range.

Parameters
indexMaxADCIndex of the max. ADC value
maxtimeMax. time value of the accepted range
mintimeMin. time value of the accepted range
Returns
True of the index of the max ADC is within the accepted time range, false otherwise

Definition at line 295 of file CaloRawFitter.cxx.

◆ isMaxADCBunchEdge()

bool CaloRawFitter::isMaxADCBunchEdge ( const Bunch bunch) const

Check if the max. ADC value is at the edge of a bunch.

Parameters
bunchThe bunch to be checked
Returns
True if the Max. ADC value is either the first or the last value of a bunch

Definition at line 248 of file CaloRawFitter.cxx.

◆ preFitEvaluateSamples()

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.

Parameters
bunchvectorALTRO bunches for the current channel
adcThresholdADC threshold applied in peak finding
Returns
Size of the sub-selected sample,
index of the bunch with maximum signal,
maximum signal,
maximum aplitude,
index of max aplitude in array,
pedestal,
first time bin,
last time bin,

Definition at line 336 of file CaloRawFitter.cxx.

◆ reverseAndSubtractPed()

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.

Returns
Pedestal
Array with revered and pedestal subtracted ADC signals

Definition at line 206 of file CaloRawFitter.cxx.

◆ selectMaximumBunch()

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.

Parameters
bunchvectorBunches of the channel among which to select the maximium
Returns
The index of the array with the maximum aplitude
The bin where we have a maximum amp
The maximum ADC signal
Exceptions
RawFitterError_t::BUNCH_NOT_OKADC value is at a bunch edge

Definition at line 269 of file CaloRawFitter.cxx.

◆ setAmpCut()

void o2::emcal::CaloRawFitter::setAmpCut ( float  cut)
inline

Definition at line 166 of file CaloRawFitter.h.

◆ setIsZeroSuppressed()

void o2::emcal::CaloRawFitter::setIsZeroSuppressed ( bool  iszs = true)
inline

Definition at line 165 of file CaloRawFitter.h.

◆ setL1Phase()

void o2::emcal::CaloRawFitter::setL1Phase ( double  phase)
inline

Definition at line 168 of file CaloRawFitter.h.

◆ setNsamplePed()

void o2::emcal::CaloRawFitter::setNsamplePed ( int  i)
inline

Definition at line 167 of file CaloRawFitter.h.

◆ setTimeConstraint()

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.

Member Data Documentation

◆ mAlgo

FitAlgorithm o2::emcal::CaloRawFitter::mAlgo
protected

Which algorithm to use.

Definition at line 264 of file CaloRawFitter.h.

◆ mAmp

double o2::emcal::CaloRawFitter::mAmp
protected

The amplitude in entities of ADC counts.

Definition at line 268 of file CaloRawFitter.h.

◆ mAmpCut

float o2::emcal::CaloRawFitter::mAmpCut
protected

Max ADC - pedestal must be higher than this befor attemting to extract the amplitude.

Definition at line 255 of file CaloRawFitter.h.

◆ mIsZerosupressed

bool o2::emcal::CaloRawFitter::mIsZerosupressed
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.

◆ mL1Phase

double o2::emcal::CaloRawFitter::mL1Phase
protected

Phase of the ADC sampling clock relative to the LHC clock.

Definition at line 266 of file CaloRawFitter.h.

◆ mMaxTimeIndex

int o2::emcal::CaloRawFitter::mMaxTimeIndex
protected

The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.

Definition at line 253 of file CaloRawFitter.h.

◆ mMinTimeIndex

int o2::emcal::CaloRawFitter::mMinTimeIndex
protected

The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.

Definition at line 252 of file CaloRawFitter.h.

◆ mName

std::string o2::emcal::CaloRawFitter::mName
protected

Name of the algorithm.

Definition at line 261 of file CaloRawFitter.h.

◆ mNameShort

std::string o2::emcal::CaloRawFitter::mNameShort
protected

Abbrevation for the name.

Definition at line 262 of file CaloRawFitter.h.

◆ mNsamplePed

int o2::emcal::CaloRawFitter::mNsamplePed
protected

Number of samples used for pedestal calculation (first in bunch)

Definition at line 257 of file CaloRawFitter.h.

◆ mReversed

std::array<double, constants::EMCAL_MAXTIMEBINS> o2::emcal::CaloRawFitter::mReversed
protected

Reversed sequence of samples (pedestalsubtracted)

Definition at line 250 of file CaloRawFitter.h.


The documentation for this class was generated from the following files: