16#ifndef ALICEO2_TPC_DigitGlobalPad_H_
17#define ALICEO2_TPC_DigitGlobalPad_H_
21#include <fmt/format.h>
86 int getID()
const {
return mID; }
95 template <DigitzationMode MODE>
100 SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
110 float mChargePad = 0.;
117 bool isKnown =
false;
118 auto view =
labels.getLabels(mID);
119 for (
auto& mcLabel : view) {
120 if (compareMClabels(
label, mcLabel.first)) {
129 std::pair<MCCompLabel, int> newlabel(
label, 1);
130 labels.addLabel(mID, newlabel);
132 mChargePad += signal;
139 const float kAmp = (padParams[0]) ? padParams[0]->
getValue(
sector, pad) * itSettings.ITMultFactor : itSettings.ITMultFactor * 0.1276;
140 const float expLambda = (padParams[1]) ? padParams[1]->
getValue(
sector, pad) : std::exp(-itSettings.kTime);
144 if (eleParam.doSaturationTail) {
145 if (prevDigit.
signal > 1023.f) {
146 prevDigit.
tot += int(std::round(mChargePad * eleParam.adcToT));
148 if (prevDigit.
tot > 0) {
155 float modCharge = mChargePad;
156 if ((prevDigit.
tot == 0) && (eleParam.doIonTail || eleParam.doIonTailPerPad)) {
157 modCharge = mChargePad + kAmp * (1 - expLambda) * prevDigit.
cumul;
159 prevDigit.
cumul *= expLambda;
160 if (prevDigit.
cumul < 0.1) {
164 prevDigit.
signal = modCharge;
168 float kAmpTmp = kAmp;
169 float tailSlopeUnitTmp = expLambda;
170 float cmKValue = (padParams[2]) ? padParams[2]->
getValue(
sector, pad) : 1.f;
173 unsigned int timeBin =
time;
177 debugStream->getStreamer() <<
"foldSignal"
180 <<
"timeBin=" << timeBin
181 <<
"kAmp=" << kAmpTmp
182 <<
"tailSlopeUnit=" << tailSlopeUnitTmp
183 <<
"cmKValue=" << cmKValue
184 <<
"charge=" << mChargePad
185 <<
"prevDig=" << prevDigInfTmp
186 <<
"dig=" << prevDigit
190 mChargePad = modCharge;
208template <DigitzationMode MODE>
214 SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
223 float noise, pedestal;
224 const float mADC = sampaProcessing.
makeSignal<MODE>(mChargePad, cru.
sector(), globalPad, commonMode, pedestal, noise, prevDigit.
tot);
225 const bool isDead = (deadMap ==
nullptr) ?
false : deadMap->
getValue(cru.
sector(), globalPad);
232 debugStream->getStreamer() <<
"digit"
234 <<
"pad=" << globalPad
235 <<
"timeBin=" << timeBin
236 <<
"charge=" << mChargePad
238 <<
"prevDig=" << prevDigitTmp
239 <<
"cm=" << commonMode
240 <<
"isDead=" << isDead
245 if (!isDead && (mADC > 0)) {
248 const auto digiPos =
output.size();
249 output.emplace_back(cru, mADC, pad.getRow(), pad.getPad(), timeBin);
253 mcTruth.addNoLabelIndex(digiPos);
255 auto labelview =
labels.getLabels(mID);
256 labelCollector.clear();
257 for (
auto& mcLabel : labelview) {
258 labelCollector.push_back(mcLabel);
260 if (labelview.size() > 1) {
262 using P = std::pair<MCCompLabel, int>;
263 std::sort(labelCollector.begin(), labelCollector.end(), [](
const P&
a,
const P&
b) { return a.second > b.second; });
265 for (
auto& mcLabel : labelCollector) {
266 mcTruth.addElement(digiPos, mcLabel.first);
Definition of class for writing debug informations.
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
std::vector< o2::MCCompLabel > labels
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the SAMPA response.
uint64_t getRawValue() const
static const ParameterElectronics & Instance()
const Sector sector() const
const T getValue(const int sec, const int globalPadInSector) const
void foldSignal(PrevDigitInfo &prevDigit, const int sector, const int pad, const TimeBin time, Streamer *debugStream=nullptr, const CalPad *padParams[3]=nullptr)
Fold signal with previous pad signal add ion tail and ToT for sigmal saturation.
void reset()
Resets the container.
void addDigit(const MCCompLabel &label, float signal, o2::dataformats::LabelContainer< std::pair< MCCompLabel, int >, false > &)
o2::utils::DebugStreamer Streamer
DigitGlobalPad()=default
Constructor.
void fillOutputContainer(std::vector< Digit > &output, dataformats::MCTruthContainer< MCCompLabel > &mcTruth, const CRU &cru, TimeBin timeBin, GlobalPadNumber globalPad, o2::dataformats::LabelContainer< std::pair< MCCompLabel, int >, false > &labelContainer, SAMPAProcessing &sampaProcessing, std::vector< std::pair< MCCompLabel, int > > &labelCollector, float commonMode=0.f, const PrevDigitInfo &prevDigit=PrevDigitInfo(), Streamer *debugStream=nullptr, const CalDet< bool > *deadMap=nullptr)
float getChargePad() const
~DigitGlobalPad()=default
Destructor.
const PadPos & padPos(GlobalPadNumber padNumber) const
static Mapper & instance(const std::string mappingDir="")
float makeSignal(float ADCcounts, const int sector, const int globalPadInSector, const float commonMode, float &pedestal, float &noise, float tot=0)
class to enable streaming debug information to root files
GLboolean GLboolean GLboolean b
GLuint GLsizei const GLchar * label
GLboolean GLboolean GLboolean GLboolean a
Global TPC definitions and constants.
unsigned short GlobalPadNumber
global pad number
@ streamDigits
stream digit information
@ streamDigitFolding
stream ion tail and saturatio information
double getValue(DPVAL dp)
float cumul
cumulative signal of prev time bins
ClassDefNV(PrevDigitInfo, 1)
int tot
remaining time over threshold