16#ifndef ALICEO2_TPC_SAMPAProcessing_H_
17#define ALICEO2_TPC_SAMPAProcessing_H_
46 return sampaProcessing;
71 template <DigitzationMode MODE>
72 float makeSignal(
float ADCcounts,
const int sector,
const int globalPadInSector,
const float commonMode,
float& pedestal,
float& noise,
float tot = 0);
80 void getShapedSignal(
float ADCsignal,
float driftTime, std::vector<float>& signalArray)
const;
119 float getNoise(
const int sector,
const int globalPadInSector);
128 float getPedestal(
const int sector,
const int globalPadInSector)
const;
134 float getPedestalCRU(
const int sector,
const int globalPadInSector)
const;
142 const CalPad* mPedestalMap;
143 const CalPad* mPedestalMapCRU;
144 const CalPad* mZeroSuppression;
154 return nElectrons * conversion;
157template <DigitzationMode MODE>
159 float& pedestal,
float& noise,
float tot)
161 float signal = ADCcounts;
164 noise =
getNoise(sector, globalPadInSector);
167 signal -= commonMode;
174 signal -= commonMode;
177 signal += (tot > 0) ? 80 : 0;
178 const float signalSubtractPedestal =
getADCSaturation(signal) - pedestalCRU;
180 if (signalSubtractPedestal < zeroSuppression) {
183 return signalSubtractPedestal;
189 signal += (tot > 0) ? 80 : 0;
190 const float signalSubtractPedestal =
getADCSaturation(signal) - pedestalCRU;
192 if (signalSubtractPedestal < zeroSuppression) {
195 return signalSubtractPedestal;
199 signal -= commonMode;
202 const float signalSubtractPedestal =
getADCSaturation(signal) - pedestalCRU;
203 return signalSubtractPedestal;
207 signal -= commonMode;
224 if (signal > adcSaturation - 1) {
225 return adcSaturation - 1;
234 const auto cond = (tmp0 > 0);
236 if constexpr (std::is_floating_point_v<T>) {
244 const auto tmp2 = tmp * tmp;
245 return 55.f * ADC * std::exp(-4.f * tmp) * tmp2 * tmp2;
255 const float zSign = (s == 0) ? 1 : -1;
270 return static_cast<float>(timeBin) * mEleParam->
ZbinWidth;
285 return mZeroSuppression->
getValue(sector, globalPadInSector);
290 return mPedestalMap->
getValue(sector, globalPadInSector);
295 return mPedestalMapCRU->
getValue(sector, globalPadInSector);
Definition of the parameter class for the detector.
Definition of the parameter class for the detector electronics.
Definition of the parameter class for the detector gas.
const T getValue(const int sec, const int globalPadInSector) const
float getZeroSuppression(const int sector, const int globalPadInSector) const
Get the zero suppression threshold for a given channel.
float getNoise(const int sector, const int globalPadInSector)
void getShapedSignal(float ADCsignal, float driftTime, std::vector< float > &signalArray) const
T getADCvalue(T nElectrons) const
static SAMPAProcessing & instance()
float getTimeBinTime(float time) const
float getTimeFromBin(TimeBin timeBin) const
float makeSignal(float ADCcounts, const int sector, const int globalPadInSector, const float commonMode, float &pedestal, float &noise, float tot=0)
float getZfromTimeBin(float timeBin, Side s) const
void updateParameters(float vdrift=0)
Update the OCDB parameters cached in the class. To be called once per event.
float getPedestalCRU(const int sector, const int globalPadInSector) const
TimeBin getTimeBin(float zPos) const
~SAMPAProcessing()=default
Destructor.
float getADCSaturation(const float signal) const
T getGamma4(T time, T startTime, T ADC) const
TimeBin getTimeBinFromTime(float time) const
float getPedestal(const int sector, const int globalPadInSector) const
@ ZeroSuppressionCMCorr
Apply noise, pedestal and saturation and then from that subtract the pedestal and apply zero suppress...
@ ZeroSuppression
Apply noise, pedestal, common mode and saturation and then from that subtract the pedestal and apply ...
@ PropagateADC
Just propagate the bare ADC value.
@ FullMode
Apply noise, pedestal and saturation.
@ SubtractPedestal
Apply noise, pedestal and saturation and then from that subtract the pedestal.
@ NoSaturation
Apply only noise and pedestal.
unsigned int TimeBin
global time bin
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
float TPClength
Length of the TPC [cm].
float ADCdynamicRange
Dynamic range of the ADC [mV].
float ADCsaturation
ADC saturation [ADC counts].
float ZbinWidth
Width of a z bin [us].
float PeakingTime
Peaking time of the SAMPA [us].
float ElectronCharge
Electron charge [C].
float ChipGain
Gain of the SAMPA [mV/fC] - may be either 20 or 30.