11#ifndef ALCEO2_EMCAL_CELLRECALIBRATOR_H
12#define ALCEO2_EMCAL_CELLRECALIBRATOR_H
76 const
char*
what() const noexcept final
78 return "Only possible to calibrate cells of type high gain or low gain";
134 template <
typename T>
137 if (!(inputcell.getHighGain() || inputcell.getLowGain())) {
142 return std::optional<T>();
146 float calibratedEnergy = inputcell.getEnergy();
147 float calibratedTime = inputcell.getTimeStamp();
150 calibratedTime -= mTimeCalibration->
getTimeCalibParam(inputcell.getTower(), inputcell.getLowGain());
168 template <
typename T>
173 int currentindex = 0;
174 for (
const auto& cellToCalibrate : inputcells) {
175 if (!(cellToCalibrate.getHighGain() || cellToCalibrate.getLowGain())) {
181 result.push_back(calibrated.value());
182 indices.emplace_back(currentindex);
205std::ostream&
operator<<(std::ostream& in,
const CellRecalibrator& calib);
CCDB container for masked cells in EMCAL.
MaskType_t getChannelStatus(unsigned short channelID) const
Get the status of a certain cell.
@ GOOD_CELL
GOOD cell, can be used without problems.
Handling of invalid cell types in calibration.
~CellTypeException() noexcept final=default
Destructor.
const char * what() const noexcept final
Get error message of the exception.
CellTypeException()=default
Constructor.
Tool for recalibration at cell level.
bool hasBadChannelMap() const
Check if the bad channel calibration is enabled.
std::tuple< std::vector< T >, std::vector< int > > getCalibratedCells(const gsl::span< const T > inputcells)
Get list of calibrated cells based on a cell input collection.
const TimeCalibrationParams * getTimeCalibration() const
Get time calibration parameters currently used in the calibrator.
const BadChannelMap * getBadChannelMap() const
Get bad channel map currently used in the calibrator.
void setGainCalibration(const GainCalibrationFactors *gcf)
Set the gain calibration params.
void setTimeCalibration(const TimeCalibrationParams *tcp)
Set the time calibration params.
void printStream(std::ostream &stream) const
Print settings to the stream.
~CellRecalibrator()=default
Destructor.
void setBadChannelMap(const BadChannelMap *bcm)
Set the bad channel map.
std::optional< T > getCalibratedCell(const T &inputcell) const
Calibrate single cell.
const GainCalibrationFactors * getGainCalibration() const
Get gain calibration factors currently used in the calibrator.
bool hasGainCalibration() const
Check if the energy calibration is enabled.
CellRecalibrator()=default
Constructor.
bool hasTimeCalibration() const
Check if the time calibration is enabled.
CCDB container for the gain calibration factors.
float getGainCalibFactors(unsigned short iCell) const
Get the gain calibration factor for a certain cell.
short getTimeCalibParam(unsigned short cellID, bool isLowGain) const
Get the time calibration coefficient for a certain cell.
GLsizei GLenum const void * indices
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
@ HIGH_GAIN
High gain channel.
@ LOW_GAIN
Low gain channel.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...