Skip to content

Commit 8d815a4

Browse files
matthias-kleinerclaude
authored andcommitted
TPC digitizer: option --TPCuseGainMapMC to apply PadGainFullMC
By default the digitizer applies TPC/Calib/PadGainFull as before; with --TPCuseGainMapMC it applies TPC/Calib/PadGainFullMC. The option is passed via the Digitizer to GEMAmplification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3d97751 commit 8d815a4

7 files changed

Lines changed: 16 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ class Digitizer
168168
/// Whether flush() also flushes the process-wide debug streamer
169169
void setFlushDebugStreamer(bool flush) { mFlushDebugStreamer = flush; }
170170

171+
/// Apply the gain map for MC (TPC/Calib/PadGainFullMC) instead of the one of the reconstruction (TPC/Calib/PadGainFull)
172+
void setUseGainMapMC(bool use) { mUseGainMapMC = use; }
173+
171174
private:
172175
/// Fill the random rings of the sector seeding, if not done yet
173176
void initSectorSeeding();
@@ -183,6 +186,7 @@ class Digitizer
183186
ULong64_t mSeedingTimeframe = 0; //!< Timeframe identifier for sector seeding
184187
bool mUseSectorSeeding = false; //!< Whether sector seeding is used
185188
bool mFlushDebugStreamer = true; //!< Whether flush() flushes the debug streamer
189+
bool mUseGainMapMC = false; //!< Whether the gain map for MC is applied instead of the one of the reconstruction
186190

187191
DigitContainer mDigitContainer; ///< Container for the Digits
188192
std::vector<float> mSignalArray; //!< Workspace for the shaped signal of one electron

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class GEMAmplification
5454
void setRandomRingPositions(TRandom& rng);
5555

5656
/// Update the OCDB parameters cached in the class. To be called once per event
57-
void updateParameters();
57+
/// \param useGainMapMC apply the gain map for MC (TPC/Calib/PadGainFullMC) instead of the one of the reconstruction (TPC/Calib/PadGainFull)
58+
void updateParameters(bool useGainMapMC = false);
5859

5960
/// Compute the number of electrons after amplification in a full stack of four GEM foils
6061
/// \param nElectrons Number of electrons arriving at the first amplification stage (GEM1)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void Digitizer::init()
125125
mSAMPAProcessing->setRandomRingPositions(rng);
126126
}
127127
auto& gemAmplification = this->gemAmplification();
128-
gemAmplification.updateParameters();
128+
gemAmplification.updateParameters(mUseGainMapMC);
129129
auto& electronTransport = this->electronTransport();
130130
electronTransport.updateParameters(mVDrift);
131131
auto& sampaProcessing = this->sampaProcessing();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ void GEMAmplification::setRandomRingPositions(TRandom& rng)
117117
mGainFullStack.setRandomPosition(rng);
118118
}
119119

120-
void GEMAmplification::updateParameters()
120+
void GEMAmplification::updateParameters(bool useGainMapMC)
121121
{
122122
auto& cdb = CDBInterface::instance();
123123
mGEMParam = &(ParameterGEM::Instance());
124124
mGasParam = &(ParameterGas::Instance());
125-
mGainMap = &(cdb.getGainMapMC());
125+
mGainMap = useGainMapMC ? &(cdb.getGainMapMC()) : &(cdb.getGainMap());
126126
}
127127

128128
int GEMAmplification::getStackAmplification(int nElectrons)

‎Steer/DigitizerWorkflow/src/TPCDigitizerMTSpec.cxx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class TPCDPLDigitizerMTTask : public o2::base::BaseDPLDigitizer
115115

116116
mWithMCTruth = o2::conf::DigiParams::Instance().mctruth;
117117
const auto triggeredMode = ic.options().get<bool>("TPCtriggered");
118+
const auto useGainMapMC = ic.options().get<bool>("TPCuseGainMapMC");
119+
LOG(info) << "TPC: gain map for MC (TPC/Calib/PadGainFullMC) applied: " << useGainMapMC;
118120
mConditions.init(ic, mDistortionType);
119121

120122
// the workers share no random numbers: each digitizer seeds every sector from DigiParams.seed
@@ -130,6 +132,7 @@ class TPCDPLDigitizerMTTask : public o2::base::BaseDPLDigitizer
130132
worker->id = i;
131133
worker->digitizer.setContinuousReadout(!triggeredMode);
132134
worker->digitizer.setDistortionScaleType(mDistortionType);
135+
worker->digitizer.setUseGainMapMC(useGainMapMC);
133136
worker->digitizer.setUseSectorSeeding(sectorSeed);
134137
// the main thread flushes the process-wide debug streamer after the workers
135138
worker->digitizer.setFlushDebugStreamer(false);

‎Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ class TPCDPLDigitizerTask : public BaseDPLDigitizer
108108

109109
mWithMCTruth = o2::conf::DigiParams::Instance().mctruth;
110110
auto triggeredMode = ic.options().get<bool>("TPCtriggered");
111+
const auto useGainMapMC = ic.options().get<bool>("TPCuseGainMapMC");
112+
LOG(info) << "TPC: gain map for MC (TPC/Calib/PadGainFullMC) applied: " << useGainMapMC;
111113
mConditions.init(ic, mDistortionType);
112114

113115
mDigitizer.setContinuousReadout(!triggeredMode);
114116
mDigitizer.setDistortionScaleType(mDistortionType);
117+
mDigitizer.setUseGainMapMC(useGainMapMC);
115118

116119
if (ic.options().get<bool>("tpc-sector-seeding")) {
117120
const auto seed = o2::conf::DigiParams::Instance().seed;

‎Steer/DigitizerWorkflow/src/TPCSectorDigitization.cxx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ std::vector<framework::ConfigParamSpec> TPCDigitizerConditions::options()
134134
return {
135135
{"TPCtriggered", VariantType::Bool, false, {"Impose triggered RO mode (default: continuous)"}},
136136
{"TPCuseCCDB", VariantType::Bool, false, {"true: load calibrations from CCDB; false: use random calibratoins"}},
137+
{"TPCuseGainMapMC", VariantType::Bool, false, {"true: apply the gain map for MC (TPC/Calib/PadGainFullMC); false: apply the gain map of the reconstruction (TPC/Calib/PadGainFull)"}},
137138
{"meanLumiDistortions", VariantType::Float, -1.f, {"override lumi of distortion object if >=0"}},
138139
{"meanLumiDistortionsDerivative", VariantType::Float, -1.f, {"override lumi of derivative distortion object if >=0"}},
139140
{"do-not-recalculate-distortions", VariantType::Bool, false, {"Do not recalculate the distortions"}},

0 commit comments

Comments
 (0)