Skip to content

Commit cc2bb5d

Browse files
committed
Add common mode per pad saturation
1 parent 94e30e8 commit cc2bb5d

5 files changed

Lines changed: 42 additions & 28 deletions

File tree

‎Detectors/TPC/base/include/TPCBase/ParameterElectronics.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct ParameterElectronics : public o2::conf::ConfigurableParamHelper<Parameter
4848
bool doIonTail = false; ///< add ion tail in simulation
4949
bool doIonTailPerPad = false; ///< add ion tail in simulation using pad-by-pad values
5050
bool doCommonModePerPad = true; ///< add common mode in simulation using pad-by-pad values
51+
bool doCommonModePerPadSaturation = true; ///< Saturate the common mode seen by each pad at its pedestal value
5152
bool doSaturationTail = false; ///< add saturation tail in simulation
5253
bool doNoiseEmptyPads = false; ///< add noise in pads without signal in simulation
5354
bool applyDeadMap = true; ///< apply dead channel map

‎Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ class DigitContainer
9696
void updateCalibrations();
9797

9898
private:
99-
TimeBin mFirstTimeBin = 0; ///< First time bin to consider
100-
TimeBin mEffectiveTimeBin = 0; ///< Effective time bin of that digit
101-
TimeBin mTmaxTriggered = 0; ///< Maximum time bin in case of triggered mode (hard cut at average drift speed with additional margin)
102-
TimeBin mOffset; ///< Size of the container for one event
103-
std::deque<DigitTime*> mTimeBins; ///< Time bin Container for the ADC value
104-
std::unique_ptr<DigitTime::PrevDigitInfoArray> mPrevDigArr; ///< Keep track of ToT and ion tail cumul from last time bin
105-
o2::utils::DebugStreamer mStreamer; ///< Debug streamer
106-
const CalPad* mPadParams[3] = {nullptr, nullptr, nullptr}; //!< Ion tail fraction, ion tail slope and common mode k-values per pad
107-
const CalDet<bool>* mDeadMap = nullptr; //!< Dead channel map
108-
bool mCMCEnabled = false; //!< Common mode correction enabled in the FEE config (DigiMode Auto)
109-
bool mCalibrationsUpdated = false; //!< Whether updateCalibrations was called
110-
SAMPAProcessing* mSAMPAProcessing = nullptr; //!< SAMPAProcessing used for the output, the singleton if not set
111-
std::vector<std::pair<MCCompLabel, int>> mLabelCollector; //!< Workspace to sort the MC labels of a digit
99+
TimeBin mFirstTimeBin = 0; ///< First time bin to consider
100+
TimeBin mEffectiveTimeBin = 0; ///< Effective time bin of that digit
101+
TimeBin mTmaxTriggered = 0; ///< Maximum time bin in case of triggered mode (hard cut at average drift speed with additional margin)
102+
TimeBin mOffset; ///< Size of the container for one event
103+
std::deque<DigitTime*> mTimeBins; ///< Time bin Container for the ADC value
104+
std::unique_ptr<DigitTime::PrevDigitInfoArray> mPrevDigArr; ///< Keep track of ToT and ion tail cumul from last time bin
105+
o2::utils::DebugStreamer mStreamer; ///< Debug streamer
106+
const CalPad* mPadParams[4] = {nullptr, nullptr, nullptr, nullptr}; //!< Ion tail fraction, ion tail slope, common mode k-values and pedestals per pad
107+
const CalDet<bool>* mDeadMap = nullptr; //!< Dead channel map
108+
bool mCMCEnabled = false; //!< Common mode correction enabled in the FEE config (DigiMode Auto)
109+
bool mCalibrationsUpdated = false; //!< Whether updateCalibrations was called
110+
SAMPAProcessing* mSAMPAProcessing = nullptr; //!< SAMPAProcessing used for the output, the singleton if not set
111+
std::vector<std::pair<MCCompLabel, int>> mLabelCollector; //!< Workspace to sort the MC labels of a digit
112112

113113
void reportSettings();
114114
};

‎Detectors/TPC/simulation/include/TPCSimulation/DigitGlobalPad.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class DigitGlobalPad
8080
o2::dataformats::LabelContainer<std::pair<MCCompLabel, int>, false>&);
8181

8282
/// Fold signal with previous pad signal add ion tail and ToT for sigmal saturation
83-
void foldSignal(PrevDigitInfo& prevDigit, const int sector, const int pad, const TimeBin time, Streamer* debugStream = nullptr, const CalPad* padParams[3] = nullptr);
83+
void foldSignal(PrevDigitInfo& prevDigit, const int sector, const int pad, const TimeBin time, Streamer* debugStream = nullptr, const CalPad* padParams[4] = nullptr);
8484

8585
void setID(int id) { mID = id; }
8686
int getID() const { return mID; }
@@ -132,7 +132,7 @@ inline void DigitGlobalPad::addDigit(const MCCompLabel& label, float signal,
132132
mChargePad += signal;
133133
}
134134

135-
inline void DigitGlobalPad::foldSignal(PrevDigitInfo& prevDigit, const int sector, const int pad, const TimeBin time, Streamer* debugStream, const CalPad* padParams[3])
135+
inline void DigitGlobalPad::foldSignal(PrevDigitInfo& prevDigit, const int sector, const int pad, const TimeBin time, Streamer* debugStream, const CalPad* padParams[4])
136136
{
137137
const auto& eleParam = ParameterElectronics::Instance();
138138
const auto& itSettings = IonTailSettings::Instance();

‎Detectors/TPC/simulation/include/TPCSimulation/DigitTime.h‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class DigitTime
8080
std::vector<CommonMode>& commonModeOutput, const Sector& sector, TimeBin timeBin,
8181
SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
8282
PrevDigitInfoArray* prevTime = nullptr, Streamer* debugStream = nullptr,
83-
const CalPad* padParams[3] = nullptr, const CalDet<bool>* deadMap = nullptr);
83+
const CalPad* padParams[4] = nullptr, const CalDet<bool>* deadMap = nullptr);
8484

8585
private:
8686
std::array<float, GEMSTACKSPERSECTOR> mCommonMode; ///< Common mode container - 4 GEM ROCs per sector
@@ -131,7 +131,7 @@ template <DigitzationMode MODE>
131131
inline void DigitTime::fillOutputContainer(std::vector<Digit>& output, dataformats::MCTruthContainer<MCCompLabel>& mcTruth,
132132
std::vector<CommonMode>& commonModeOutput, const Sector& sector, TimeBin timeBin,
133133
SAMPAProcessing& sampaProcessing, std::vector<std::pair<MCCompLabel, int>>& labelCollector,
134-
PrevDigitInfoArray* prevTime, Streamer* debugStream, const CalPad* padParams[3],
134+
PrevDigitInfoArray* prevTime, Streamer* debugStream, const CalPad* padParams[4],
135135
const CalDet<bool>* deadMap)
136136
{
137137
const auto& mapper = Mapper::instance();
@@ -153,23 +153,33 @@ inline void DigitTime::fillOutputContainer(std::vector<Digit>& output, dataforma
153153
mCommonMode[cru.gemStack()] += digit.getChargePad() * eleParam.commonModeCoupling * cmKValue; // TODO: Add stack-by-stack variation?
154154
}
155155

156-
// fill common mode output container
157-
for (size_t i = 0; i < mCommonMode.size(); ++i) {
158-
const float cm = getCommonMode(GEMstack(i));
159-
if (cm > 0.) {
160-
commonModeOutput.push_back({cm, timeBin, static_cast<unsigned char>(i)});
161-
}
162-
}
156+
// the common mode is induced on all pads of the GEM stack, but the baseline of a pad can at most drop to 0 ADC,
157+
// so the common mode seen by a pad saturates at its pedestal value
158+
const CalPad* pedestals = eleParam.doCommonModePerPadSaturation ? padParams[3] : nullptr;
159+
std::array<double, GEMSTACKSPERSECTOR> commonModeSeen{}; // double: sum of ~3000 values per stack
163160

164161
for (size_t iPad = 0; iPad < mGlobalPads.size(); ++iPad) {
165162
auto& digit = mGlobalPads[iPad];
163+
const CRU cru = mapper.getCRU(sector, iPad);
164+
float commonMode = getCommonMode(cru);
165+
if (pedestals) {
166+
commonMode = std::min(commonMode, pedestals->getValue(sector.getSector(), iPad));
167+
commonModeSeen[cru.gemStack()] += commonMode;
168+
}
166169
if (eleParam.doNoiseEmptyPads || (digit.getChargePad() > 0.f)) {
167170
PrevDigitInfo prevDigit;
168171
if (prevTime) {
169172
prevDigit = (*prevTime)[iPad];
170173
}
171-
const CRU cru = mapper.getCRU(sector, iPad);
172-
digit.fillOutputContainer<MODE>(output, mcTruth, cru, timeBin, iPad, mLabels, sampaProcessing, labelCollector, getCommonMode(cru), prevDigit, debugStream, deadMap);
174+
digit.fillOutputContainer<MODE>(output, mcTruth, cru, timeBin, iPad, mLabels, sampaProcessing, labelCollector, commonMode, prevDigit, debugStream, deadMap);
175+
}
176+
}
177+
178+
// fill common mode output container, with saturation the average common mode seen by the pads of the GEM stack
179+
for (size_t i = 0; i < mCommonMode.size(); ++i) {
180+
const float cm = pedestals ? static_cast<float>(commonModeSeen[i] / mapper.getNumberOfPads(GEMstack(i))) : getCommonMode(GEMstack(i));
181+
if (cm > 0.) {
182+
commonModeOutput.push_back({cm, timeBin, static_cast<unsigned char>(i)});
173183
}
174184
}
175185
}

‎Detectors/TPC/simulation/src/DigitContainer.cxx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ void DigitContainer::updateCalibrations()
160160
mPadParams[2] = &cdb.getCMkValues();
161161
}
162162

163+
// pedestals for the common mode saturation per pad
164+
mPadParams[3] = eleParam.doCommonModePerPadSaturation ? &cdb.getPedestals() : nullptr;
165+
163166
// dead channel map
164167
mDeadMap = eleParam.applyDeadMap ? &cdb.getDeadChannelMap() : nullptr;
165168

@@ -174,7 +177,7 @@ void DigitContainer::reportSettings()
174177
auto& cdb = CDBInterface::instance();
175178
const auto& eleParam = ParameterElectronics::Instance();
176179
const auto& feeConfig = cdb.getFEEConfig();
177-
LOGP(info, "ParameterElectronics: doIonTail={}, doIonTailPerPad={}, doCommonModePerPad={}, doSaturationTail={}, doNoiseEmptyPads={}, applyDeadMap={}, commonModeCoupling={}, DigiMode={}",
178-
eleParam.doIonTail, eleParam.doIonTailPerPad, eleParam.doCommonModePerPad, eleParam.doSaturationTail, eleParam.doNoiseEmptyPads, eleParam.applyDeadMap, eleParam.commonModeCoupling, (int)eleParam.DigiMode);
180+
LOGP(info, "ParameterElectronics: doIonTail={}, doIonTailPerPad={}, doCommonModePerPad={}, doCommonModePerPadSaturation={}, doSaturationTail={}, doNoiseEmptyPads={}, applyDeadMap={}, commonModeCoupling={}, DigiMode={}",
181+
eleParam.doIonTail, eleParam.doIonTailPerPad, eleParam.doCommonModePerPad, eleParam.doCommonModePerPadSaturation, eleParam.doSaturationTail, eleParam.doNoiseEmptyPads, eleParam.applyDeadMap, eleParam.commonModeCoupling, (int)eleParam.DigiMode);
179182
feeConfig.printShort();
180183
}

0 commit comments

Comments
 (0)