diff --git a/Detectors/TPC/base/include/TPCBase/CDBTypes.h b/Detectors/TPC/base/include/TPCBase/CDBTypes.h index 84f732b82f963..27cc2e5a79589 100644 --- a/Detectors/TPC/base/include/TPCBase/CDBTypes.h +++ b/Detectors/TPC/base/include/TPCBase/CDBTypes.h @@ -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 @@ -98,6 +99,7 @@ const std::unordered_map 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"}, diff --git a/Detectors/TPC/base/include/TPCBase/ParameterGEM.h b/Detectors/TPC/base/include/TPCBase/ParameterGEM.h index 291058c0bc61e..2d55a550764ac 100644 --- a/Detectors/TPC/base/include/TPCBase/ParameterGEM.h +++ b/Detectors/TPC/base/include/TPCBase/ParameterGEM.h @@ -62,6 +62,16 @@ struct ParameterGEM : public o2::conf::ConfigurableParamHelper { O2ParamDef(ParameterGEM, "TPCGEMParam"); }; } // namespace tpc + +namespace framework +{ +template +struct is_messageable; +template <> +struct is_messageable : std::true_type { +}; +} // namespace framework + } // namespace o2 #endif // ALICEO2_TPC_ParameterGEM_H_ diff --git a/Detectors/TPC/base/include/TPCBase/ParameterGas.h b/Detectors/TPC/base/include/TPCBase/ParameterGas.h index 5e532a277b18e..d9bc65a08173a 100644 --- a/Detectors/TPC/base/include/TPCBase/ParameterGas.h +++ b/Detectors/TPC/base/include/TPCBase/ParameterGas.h @@ -47,6 +47,16 @@ struct ParameterGas : public o2::conf::ConfigurableParamHelper { }; } // namespace tpc + +namespace framework +{ +template +struct is_messageable; +template <> +struct is_messageable : std::true_type { +}; +} // namespace framework + } // namespace o2 #endif // ALICEO2_TPC_ParameterGas_H_ diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h b/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h index 768376ffe4e57..f86afc310b04c 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/RecoWorkflow.h @@ -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(); diff --git a/Detectors/TPC/workflow/src/RecoWorkflow.cxx b/Detectors/TPC/workflow/src/RecoWorkflow.cxx index be7af6ff1bcdc..0edd23de7c57d 100644 --- a/Detectors/TPC/workflow/src/RecoWorkflow.cxx +++ b/Detectors/TPC/workflow/src/RecoWorkflow.cxx @@ -100,7 +100,7 @@ const std::unordered_map OutputMap{ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vector const& tpcSectors, unsigned long tpcSectorMask, std::vector 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 { @@ -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(false, true, false, true, true, o2::base::GRPGeomRequest::Aligned, ggInputs, true); diff --git a/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx b/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx index c9bf62f974d77..4d364e74bb620 100644 --- a/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx +++ b/Detectors/TPC/workflow/src/tpc-reco-workflow.cxx @@ -72,6 +72,7 @@ void customize(std::vector& 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); @@ -185,7 +186,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) !cfgc.options().get("ignore-dist-stf"), // cfgc.options().get("select-ir-frames"), cfgc.options().get("filtered-input"), - cfgc.options().get("tpc-deadMap-sources")); + cfgc.options().get("tpc-deadMap-sources"), + cfgc.options().get("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); diff --git a/GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h b/GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h index b4b240f3bd541..b218a21306a34 100644 --- a/GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h +++ b/GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h @@ -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; diff --git a/GPU/Workflow/src/GPUWorkflowSpec.cxx b/GPU/Workflow/src/GPUWorkflowSpec.cxx index 0360a352b0a90..94b1c3c2b8a7b 100644 --- a/GPU/Workflow/src/GPUWorkflowSpec.cxx +++ b/GPU/Workflow/src/GPUWorkflowSpec.cxx @@ -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); diff --git a/GPU/Workflow/src/gpu-reco-workflow.cxx b/GPU/Workflow/src/gpu-reco-workflow.cxx index 5e15dde97a146..4583e138b7579 100644 --- a/GPU/Workflow/src/gpu-reco-workflow.cxx +++ b/GPU/Workflow/src/gpu-reco-workflow.cxx @@ -61,6 +61,7 @@ void customize(std::vector& 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); @@ -185,6 +186,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) cfg.tpcTriggerHandling = isEnabled(outputTypes, ioType::TPCTriggers) || cfg.caClusterer; cfg.enableDoublePipeline = cfgc.options().get("enableDoublePipeline"); cfg.tpcDeadMapSources = cfgc.options().get("tpc-deadMap-sources"); + cfg.tpcUseMCTimeGain = cfgc.options().get("tpc-mc-time-gain"); cfg.runITSTracking = isEnabled(outputTypes, ioType::ITSTracks); cfg.itsOverrBeamEst = isEnabled(inputTypes, ioType::MeanVertex); diff --git a/Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx index e1f366080fd9f..381e1ecdd3e91 100644 --- a/Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx @@ -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" @@ -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) @@ -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("gasparam"); + pc.inputs().get("gemparam"); if (mDistortionType) { pc.inputs().get("tpcdistortions"); if (mDistortionType == 2) { @@ -539,6 +550,8 @@ o2::framework::WorkflowSpec getTPCDigitizerSpec(int nLanes, std::vector 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