Skip to content

Commit

Permalink
TPC: adding MC ccdb objects for simulation and reconstruction
Browse files Browse the repository at this point in the history
Digitization:
- adding loading of gas parameters from CCDB for tuning the electron
attachment
- adding loading of GEM parameters for gain tuning

Reconstruction:
- adding option to load MC time gain calibration
  • Loading branch information
matthias-kleiner authored and sawenzel committed Nov 20, 2024
1 parent b63541a commit 2de9c5c
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Detectors/TPC/base/include/TPCBase/CDBTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum class CDBType {
CalLaserTracks, ///< Laser track calibration data
CalVDriftTgl, ///< ITS-TPC difTgl vdrift calibration
CalTimeGain, ///< Gain variation over time
CalTimeGainMC, ///< Gain variation over time for MC
CalGas, ///< DCS gas measurements
CalTemperature, ///< DCS temperature measurements
CalHV, ///< DCS HV measurements
Expand Down Expand Up @@ -98,6 +99,7 @@ const std::unordered_map<CDBType, const std::string> CDBTypeMap{
{CDBType::CalPadGainResidual, "TPC/Calib/PadGainResidual"},
{CDBType::CalLaserTracks, "TPC/Calib/LaserTracks"},
{CDBType::CalTimeGain, "TPC/Calib/TimeGain"},
{CDBType::CalTimeGainMC, "TPC/Calib/TimeGainMC"},
{CDBType::CalGas, "TPC/Calib/Gas"},
{CDBType::CalTemperature, "TPC/Calib/Temperature"},
{CDBType::CalHV, "TPC/Calib/HV"},
Expand Down
10 changes: 10 additions & 0 deletions Detectors/TPC/base/include/TPCBase/ParameterGEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ struct ParameterGEM : public o2::conf::ConfigurableParamHelper<ParameterGEM> {
O2ParamDef(ParameterGEM, "TPCGEMParam");
};
} // namespace tpc

namespace framework
{
template <typename T>
struct is_messageable;
template <>
struct is_messageable<o2::tpc::ParameterGEM> : std::true_type {
};
} // namespace framework

} // namespace o2

#endif // ALICEO2_TPC_ParameterGEM_H_
10 changes: 10 additions & 0 deletions Detectors/TPC/base/include/TPCBase/ParameterGas.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ struct ParameterGas : public o2::conf::ConfigurableParamHelper<ParameterGas> {
};

} // namespace tpc

namespace framework
{
template <typename T>
struct is_messageable;
template <>
struct is_messageable<o2::tpc::ParameterGas> : std::true_type {
};
} // namespace framework

} // namespace o2

#endif // ALICEO2_TPC_ParameterGas_H_
3 changes: 2 additions & 1 deletion Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData,
bool askDISTSTF = true,
bool selIR = false,
bool filteredInp = false,
int deadMapSources = -1);
int deadMapSources = -1,
bool useMCTimeGain = false);

void cleanupCallback();

Expand Down
3 changes: 2 additions & 1 deletion Detectors/TPC/workflow/src/RecoWorkflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const std::unordered_map<std::string, OutputType> OutputMap{

framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vector<int> const& tpcSectors, unsigned long tpcSectorMask, std::vector<int> const& laneConfiguration,
const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool propagateMC, unsigned nLanes, std::string const& cfgInput, std::string const& cfgOutput, bool disableRootInput,
int caClusterer, int zsOnTheFly, bool askDISTSTF, bool selIR, bool filteredInp, int deadMapSources)
int caClusterer, int zsOnTheFly, bool askDISTSTF, bool selIR, bool filteredInp, int deadMapSources, bool useMCTimeGain)
{
InputType inputType;
try {
Expand Down Expand Up @@ -473,6 +473,7 @@ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vecto
cfg.askDISTSTF = askDISTSTF;
cfg.tpcTriggerHandling = isEnabled(OutputType::TPCTriggers) || cfg.caClusterer;
cfg.tpcDeadMapSources = deadMapSources;
cfg.tpcUseMCTimeGain = useMCTimeGain;

Inputs ggInputs;
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, true, false, true, true, o2::base::GRPGeomRequest::Aligned, ggInputs, true);
Expand Down
4 changes: 3 additions & 1 deletion Detectors/TPC/workflow/src/tpc-reco-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{"filtered-input", VariantType::Bool, false, {"Filtered tracks, clusters input, prefix dataDescriptors with F"}},
{"select-ir-frames", VariantType::Bool, false, {"Subscribe and filter according to external IR Frames"}},
{"tpc-deadMap-sources", VariantType::Int, -1, {"Sources to consider for TPC dead channel map creation; -1=all, 0=deactivated"}},
{"tpc-mc-time-gain", VariantType::Bool, false, {"use time gain calibration for MC (true) or for data (false)"}},
};
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
o2::raw::HBFUtilsInitializer::addConfigOption(options);
Expand Down Expand Up @@ -185,7 +186,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
!cfgc.options().get<bool>("ignore-dist-stf"), //
cfgc.options().get<bool>("select-ir-frames"),
cfgc.options().get<bool>("filtered-input"),
cfgc.options().get<int>("tpc-deadMap-sources"));
cfgc.options().get<int>("tpc-deadMap-sources"),
cfgc.options().get<bool>("tpc-mc-time-gain"));

// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
o2::raw::HBFUtilsInitializer hbfIni(cfgc, wf);
Expand Down
1 change: 1 addition & 0 deletions GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class GPURecoWorkflowSpec : public o2::framework::Task
bool enableCTPLumi = false;
int32_t enableDoublePipeline = 0;
int32_t tpcDeadMapSources = -1;
bool tpcUseMCTimeGain = false; // use time gain calibration for MC (true) or from data (false)
bool decompressTPC = false;
bool decompressTPCFromROOT = false;
bool caClusterer = false;
Expand Down
6 changes: 5 additions & 1 deletion GPU/Workflow/src/GPUWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,11 @@ Inputs GPURecoWorkflowSpec::inputs()
}
inputs.emplace_back("tpcgain", gDataOriginTPC, "PADGAINFULL", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalPadGainFull)));
inputs.emplace_back("tpcgainresidual", gDataOriginTPC, "PADGAINRESIDUAL", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalPadGainResidual), {}, 1)); // time-dependent
inputs.emplace_back("tpctimegain", gDataOriginTPC, "TIMEGAIN", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalTimeGain), {}, 1)); // time-dependent
if (mSpecConfig.tpcUseMCTimeGain) {
inputs.emplace_back("tpctimegain", gDataOriginTPC, "TIMEGAIN", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalTimeGainMC), {}, 1)); // time-dependent
} else {
inputs.emplace_back("tpctimegain", gDataOriginTPC, "TIMEGAIN", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalTimeGain), {}, 1)); // time-dependent
}
inputs.emplace_back("tpctopologygain", gDataOriginTPC, "TOPOLOGYGAIN", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalTopologyGain)));
inputs.emplace_back("tpcthreshold", gDataOriginTPC, "PADTHRESHOLD", 0, Lifetime::Condition, ccdbParamSpec("TPC/Config/FEEPad"));
o2::tpc::VDriftHelper::requestCCDBInputs(inputs);
Expand Down
2 changes: 2 additions & 0 deletions GPU/Workflow/src/gpu-reco-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
{"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
{"enableDoublePipeline", VariantType::Bool, false, {"enable GPU double pipeline mode"}},
{"tpc-deadMap-sources", VariantType::Int, -1, {"Sources to consider for TPC dead channel map creation; -1=all, 0=deactivated"}},
{"tpc-mc-time-gain", VariantType::Bool, false, {"use time gain calibration for MC (true) or for data (false)"}},
};
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
o2::raw::HBFUtilsInitializer::addConfigOption(options);
Expand Down Expand Up @@ -185,6 +186,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
cfg.tpcTriggerHandling = isEnabled(outputTypes, ioType::TPCTriggers) || cfg.caClusterer;
cfg.enableDoublePipeline = cfgc.options().get<bool>("enableDoublePipeline");
cfg.tpcDeadMapSources = cfgc.options().get<int32_t>("tpc-deadMap-sources");
cfg.tpcUseMCTimeGain = cfgc.options().get<bool>("tpc-mc-time-gain");
cfg.runITSTracking = isEnabled(outputTypes, ioType::ITSTracks);
cfg.itsOverrBeamEst = isEnabled(inputTypes, ioType::MeanVertex);

Expand Down
13 changes: 13 additions & 0 deletions Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsTPC/TPCSectorHeader.h"
#include "TPCBase/CDBInterface.h"
#include "TPCBase/ParameterGEM.h"
#include "DataFormatsTPC/Digit.h"
#include "TPCSimulation/Digitizer.h"
#include "TPCSimulation/Detector.h"
Expand Down Expand Up @@ -207,6 +208,14 @@ class TPCDPLDigitizerTask : public BaseDPLDigitizer
mDigitizer.setMeanLumiDistortionsDerivative(mMeanLumiDistortionsDerivative);
}
}
if (matcher == ConcreteDataMatcher(o2::header::gDataOriginTPC, "TPCGASPARAM", 0)) {
LOGP(info, "TPC gas param updated");
ParameterGas::Instance().printKeyValues(true, true);
}
if (matcher == ConcreteDataMatcher(o2::header::gDataOriginTPC, "TPCGEMPARAM", 0)) {
LOGP(info, "TPC GEM param updated");
ParameterGEM::Instance().printKeyValues(true, true);
}
}

void run(framework::ProcessingContext& pc)
Expand All @@ -218,6 +227,8 @@ class TPCDPLDigitizerTask : public BaseDPLDigitizer
cdb.setUseDefaults(!mUseCalibrationsFromCCDB);
// whatever are global settings for CCDB usage, we have to extract the TPC vdrift from CCDB for anchored simulations
mTPCVDriftHelper.extractCCDBInputs(pc);
pc.inputs().get<ParameterGas*>("gasparam");
pc.inputs().get<ParameterGEM*>("gemparam");
if (mDistortionType) {
pc.inputs().get<SC*>("tpcdistortions");
if (mDistortionType == 2) {
Expand Down Expand Up @@ -539,6 +550,8 @@ o2::framework::WorkflowSpec getTPCDigitizerSpec(int nLanes, std::vector<int> con
// add the channel for the GRP information to the first processor
for (auto& spec : pipelines) {
o2::tpc::VDriftHelper::requestCCDBInputs(spec.inputs); // add the same CCDB request to each pipeline
spec.inputs.emplace_back("gasparam", o2::header::gDataOriginTPC, "TPCGASPARAM", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::ParGas)));
spec.inputs.emplace_back("gemparam", o2::header::gDataOriginTPC, "TPCGEMPARAM", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::ParGEM)));
if (distortionType) {
spec.inputs.emplace_back("tpcdistortions", o2::header::gDataOriginTPC, "TPCDIST", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::DistortionMapMC), {}, 1)); // time-dependent
// load derivative map in case scaling was requested
Expand Down

0 comments on commit 2de9c5c

Please sign in to comment.