Skip to content

Commit bff64be

Browse files
matthias-kleinerclaude
authored andcommitted
TPC digitizer: log the gain map applied with TPCuseGainMapMC
TPCDigitizerConditions reads --TPCuseGainMapMC and logs the gain map from the CCDB applied in the digitizer. A warning is given if the option has no effect (no --TPCuseCCDB, or a GainMap.root file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8d815a4 commit bff64be

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎Steer/DigitizerWorkflow/src/TPCDigitizerMTSpec.cxx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ 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;
120118
mConditions.init(ic, mDistortionType);
121119

122120
// the workers share no random numbers: each digitizer seeds every sector from DigiParams.seed
@@ -132,7 +130,7 @@ class TPCDPLDigitizerMTTask : public o2::base::BaseDPLDigitizer
132130
worker->id = i;
133131
worker->digitizer.setContinuousReadout(!triggeredMode);
134132
worker->digitizer.setDistortionScaleType(mDistortionType);
135-
worker->digitizer.setUseGainMapMC(useGainMapMC);
133+
worker->digitizer.setUseGainMapMC(mConditions.useGainMapMC());
136134
worker->digitizer.setUseSectorSeeding(sectorSeed);
137135
// the main thread flushes the process-wide debug streamer after the workers
138136
worker->digitizer.setFlushDebugStreamer(false);

‎Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ 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;
113111
mConditions.init(ic, mDistortionType);
114112

115113
mDigitizer.setContinuousReadout(!triggeredMode);
116114
mDigitizer.setDistortionScaleType(mDistortionType);
117-
mDigitizer.setUseGainMapMC(useGainMapMC);
115+
mDigitizer.setUseGainMapMC(mConditions.useGainMapMC());
118116

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

‎Steer/DigitizerWorkflow/src/TPCSectorDigitization.cxx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +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)"}},
137+
{"TPCuseGainMapMC", VariantType::Bool, false, {"with TPCuseCCDB, true: apply the gain map for MC (TPC/Calib/PadGainFullMC); false: apply TPC/Calib/PadGainFull. A GainMap.root file replaces both"}},
138138
{"meanLumiDistortions", VariantType::Float, -1.f, {"override lumi of distortion object if >=0"}},
139139
{"meanLumiDistortionsDerivative", VariantType::Float, -1.f, {"override lumi of derivative distortion object if >=0"}},
140140
{"do-not-recalculate-distortions", VariantType::Bool, false, {"Do not recalculate the distortions"}},
@@ -165,9 +165,18 @@ void TPCDigitizerConditions::init(framework::InitContext& ic, int distortionType
165165
mRecalcDistortionsMethod = ic.options().get<int>("recalculate-distortions-method");
166166
SpaceCharge<float>::setNThreads(ic.options().get<int>("n-threads-distortions"));
167167
mUseCalibrationsFromCCDB = ic.options().get<bool>("TPCuseCCDB");
168+
mUseGainMapMC = ic.options().get<bool>("TPCuseGainMapMC");
168169
mMeanLumiDistortions = ic.options().get<float>("meanLumiDistortions");
169170
mMeanLumiDistortionsDerivative = ic.options().get<float>("meanLumiDistortionsDerivative");
170171
LOG(info) << "TPC calibrations from CCDB: " << mUseCalibrationsFromCCDB;
172+
173+
if (!mUseCalibrationsFromCCDB) {
174+
if (mUseGainMapMC) {
175+
LOGP(warning, "TPC: TPCuseGainMapMC has no effect without TPCuseCCDB, the digitizer applies the default gain map");
176+
}
177+
} else {
178+
LOGP(info, "TPC: gain map from the CCDB applied in the digitizer: {}", CDBTypeMap.at(mUseGainMapMC ? CDBType::CalPadGainFullMC : CDBType::CalPadGainFull));
179+
}
171180
}
172181

173182
bool TPCDigitizerConditions::finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj, Digitizer& digitizer)
@@ -241,7 +250,7 @@ void TPCDigitizerConditions::update(framework::ProcessingContext& pc, Digitizer&
241250
}
242251

243252
if (std::filesystem::exists("GainMap.root")) {
244-
LOG(info) << "TPC: Using gain map from 'GainMap.root'";
253+
LOG(info) << "TPC: Using gain map from 'GainMap.root'" << (mUseGainMapMC ? ", TPCuseGainMapMC has no effect" : "");
245254
cdb.setGainMapFromFile("GainMap.root");
246255
}
247256
}

‎Steer/DigitizerWorkflow/src/TPCSectorDigitization.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class TPCDigitizerConditions
6565
static void addInputs(std::vector<framework::InputSpec>& inputs, int distortionType);
6666

6767
void init(framework::InitContext& ic, int distortionType);
68+
/// whether the digitizer applies the gain map for MC (TPC/Calib/PadGainFullMC) instead of TPC/Calib/PadGainFull
69+
bool useGainMapMC() const { return mUseGainMapMC; }
6870
/// pass a CCDB object to the digitizer; true if it was a TPC condition
6971
bool finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj, Digitizer& digitizer);
7072
/// fetch the conditions of a timeframe and prepare the digitizer, which then holds the distortions
@@ -75,6 +77,7 @@ class TPCDigitizerConditions
7577
VDriftHelper mVDriftHelper{};
7678
int mDistortionType = 0;
7779
bool mUseCalibrationsFromCCDB = false;
80+
bool mUseGainMapMC = false;
7881
bool mRecalcDistortions = false;
7982
int mRecalcDistortionsMethod = 1; ///< method of Digitizer::recalculateDistortions()
8083
float mMeanLumiDistortions = -1;

0 commit comments

Comments
 (0)