16#ifndef AliceO2_TPC_CommonModeCorrection_H_
17#define AliceO2_TPC_CommonModeCorrection_H_
125 void loadCalPad(std::string_view fileName, std::string_view nameInFile, std::string_view namePadMap =
"");
137 float getCMkValue(
int sector,
int row,
int pad) {
return mPadMaps[
"CMkValues"].getValue(sector,
row, pad); }
148 int getCommonMode(std::vector<Digit>&
digits, std::vector<std::vector<CMInfo>>& cmValues,
bool negativeOnly =
false,
bool hasInjectedCMValue =
false, std::vector<std::vector<CMDebug>>* cmDebug =
nullptr,
int minTimeBin = -1,
int maxTimeBin = -1)
const;
154 int correctDigits(std::vector<Digit>&
digits, std::vector<std::vector<CMInfo>>& cmValues,
bool negativeOnly =
false,
bool hasInjectedCMValue =
false, std::vector<std::vector<CMDebug>>* cmDebug =
nullptr,
int minTimeBin = -1,
int maxTimeBin = -1)
const;
156 void correctDigits(std::string_view digiFileIn, Long64_t maxEntries = -1, std::string_view digitFileOut =
"tpcdigit_cmcorr.root", std::string_view cmFileOut =
"CommonModeValues.root",
bool negativeOnly =
false,
int nThreads = 1,
bool writeOnlyCM =
false,
bool writeDebug =
false,
bool hasInjectedCMValue =
false,
int minTimeBin = -1,
int maxTimeBin = -1);
163 static void setNThreads(
const int nThreads) { sNThreads = nThreads; }
181 inline static int sNThreads{1};
182 int mNPadsCompRamdom{10};
183 int mNPadsCompMin{7};
187 float mQCompScaleThreshold{0};
188 float mQCompScale{0};
189 float mSumPosThreshold{2};
190 float mOccupancyThreshold{3};
191 bool mLimitKFactor{
false};
192 bool mLimitPedestal{
false};
193 int mSubthreshold{0};
194 float mArtificialCM{};
195 bool mCorrectOutputForPedestal{
false};
205 const std::array<pos, 10> mCMInjectIDLower{
220 const std::array<pos, 10> mCMInjectIDUpper{
238 float getCalPadValue(
const std::string calibName,
int icru,
int pad)
const;
240 bool padMapExists(
const std::string& calibName);
242 ClassDefNV(CommonModeCorrection, 2);
Frontend electronics configuration values.
float getPedestalValue(int sector, int row, int pad)
pedestal value
void setPadMaps(CalPadMapType &padMaps)
Pad maps loaded from FEEConfig.
CMdata collectCMdata(const std::vector< Digit > &digits, int cru, int timeBin)
int getNPadsCompMin() const
void loadPedestals(std::string_view fileName)
load Pedestals from file, assuming it is stored under the name "Pedestals
void setCalPad(const CalPad &calPad, std::string_view name)
Custom setting of CalPad, overwriting what was set in mPadMaps.
CMInfo getCommonMode(gsl::span< const float > values, gsl::span< const float > cmKValues, gsl::span< const float > pedestals, CMDebug *cmDebug=nullptr) const
bool getCorrectOutputForPedestal() const
float getQCompScaleThreshold() const
void addCommonMode(float cm)
add artificial common mode, only works when using the 'correctDigits' function
int correctDigits(std::vector< Digit > &digits, std::vector< std::vector< CMInfo > > &cmValues, bool negativeOnly=false, bool hasInjectedCMValue=false, std::vector< std::vector< CMDebug > > *cmDebug=nullptr, int minTimeBin=-1, int maxTimeBin=-1) const
void loadCalPad(std::string_view fileName, std::string_view nameInFile, std::string_view namePadMap="")
float getCMkValue(int sector, int row, int pad)
cmk value
void setNPadsMinCM(int n)
Minimum number of pads required in the CM calculation to be used for digit correction.
bool getAddSubthreshold() const
float getSumPosThreshold() const
void setOccupancyThreshold(float threshold)
Threshold above which a signal is considered for the occupancy.
void setAddSubthreshold(bool addSubthreshold)
Add zeros for pads without signal.
static void setNThreads(const int nThreads)
void setNPadsCompRandom(int n)
CMInfo getCommonMode(const std::vector< float > &values, const std::vector< float > &cmKValues, const std::vector< float > &pedestals) const
static float decodeInjectedCMValue(float lower, float upper)
int getNPadsCompRandom() const
void setNPadsCompMin(int n)
CMInfo getCommonMode(const CMdata &cmData) const
void loadCMkValues(std::string_view fileName)
load CMkValues from file, assuming it is stored under the name "CMkValues
std::unordered_map< std::string, CalPad > CalPadMapType
float getOccupancyThreshold() const
int getNPadsMinCM() const
void setCorrectOutputForPedestal(bool corret=true)
void setQCompScale(float q)
The mQComp will be set to (cm - mQCompScaleThreshold) * mQCompScale, if cm > mQCompScaleThreshold.
float getQCompScale() const
void limitKFactorPrecision(bool limit=true)
void loadDefaultPadMaps(FEEConfig::Tags feeTag=FEEConfig::Tags::Physics30sigma)
load the Pad maps from CCDB
void setSumPosThreshold(float threshold)
Threshold above which a signal is considered for sumPos, if debug information is used.
void limitPedestalPrecision(bool limit=true)
void setQCompScaleThreshold(float q)
The mQComp will be set to (cm - mQCompScaleThreshold) * mQCompScale, if cm > mQCompScaleThreshold.
GLuint const GLchar * name
GLenum GLsizei GLsizei GLint * values
Global TPC definitions and constants.
std::vector< uint8_t > nPadsOk
std::vector< uint16_t > adcDist
float cmValueCRU
common mode value from firmware, if available
uint16_t nSaturation
number of pads in saturation
float cmValueStd
std dev of common mode values from pseudo code
uint16_t nPadsUsed
number of pads used for CM calculation
float sumNeg
sum of negative signals <= mSumPosThreshold, corrected for k-factor
uint16_t nOccupancy
number of CM corrected pads larger than mOccupancyThreshold
float sumPos
sum of positive signals > mSumPosThreshold
float cmValue
common mode value from pseudo code
uint16_t nNeg
number of pads used for sumNeg
std::vector< float > adcValues
std::vector< float > pedestals
std::vector< float > cmKValues
void resize(size_t newSize)
Tags
Tag definitions for TPC/Config/FEE.
@ Physics30sigma
Physics configuration with 3.0 sigma thresholds.
std::vector< Digit > digits