From dcdd196bfa0af1f334b1f9361f24c177532b229b Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 24 May 2025 04:59:13 +0200 Subject: [PATCH 1/7] Common: track propagation test with modular approach --- .../TableProducer/trackPropagationTester.cxx | 307 ++---------------- Common/Tools/StandardCCDBLoader.h | 109 +++++++ Common/Tools/TrackPropagationModule.h | 254 +++++++++++++++ 3 files changed, 390 insertions(+), 280 deletions(-) create mode 100644 Common/Tools/StandardCCDBLoader.h create mode 100644 Common/Tools/TrackPropagationModule.h diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 3787c19ee19..7dea2087418 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -9,12 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +//=============================================================== // -// Task to add a table of track parameters propagated to the primary vertex +// Experimental version of the track propagation task +// this utilizes an analysis task module that can be employed elsewhere +// and allows for the re-utilization of a material LUT // -// FIXME: THIS IS AN EXPERIMENTAL TASK, MEANT ONLY FOR EXPLORATORY PURPOSES. -// FIXME: PLEASE ONLY USE IT WITH EXTREME CARE. IF IN DOUBT, STICK WITH THE DEFAULT -// FIXME: TRACKPROPAGATION +// candidate approach for core service approach +// +//=============================================================== #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -33,7 +36,8 @@ #include "Framework/runDataProcessing.h" #include "DataFormatsCalibration/MeanVertexObject.h" #include "CommonConstants/GeomConstants.h" -#include "trackSelectionRequest.h" +#include "Common/Tools/TrackPropagationModule.h" +#include "Common/Tools/StandardCCDBLoader.h" // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) // ITS layer. For a track without ITS, this is the TPC inner wall or for loopers in the TPC even a radius beyond that. @@ -48,294 +52,37 @@ using namespace o2::framework; // using namespace o2::framework::expressions; struct TrackPropagationTester { - Produces tracksParPropagated; - Produces tracksParExtensionPropagated; - - Produces tracksParCovPropagated; - Produces tracksParCovExtensionPropagated; - - Produces tracksDCA; - + o2::common::standardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::trackPropagationProducts trackPropagationProducts; + o2::common::trackPropagationConfigurables trackPropagationConfigurables; + Service ccdb; - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - bool fillTracksDCA = false; - int runNumber = -1; - - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - - const o2::dataformats::MeanVertexObject* mVtx = nullptr; - o2::parameters::GRPMagField* grpmag = nullptr; - o2::base::MatLayerCylSet* lut = nullptr; - - // Track selection object in this scope: not necessarily a configurable - trackSelectionRequest trackSels; - // Configurable based on a struct - // Configurable trackSels{"trackSels", {}, "track selections"}; + o2::common::StandardCCDBLoader ccdbLoader; + o2::common::TrackPropagationModule trackPropagation; - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; - Configurable minPropagationRadius{"minPropagationDistance", o2::constants::geom::XTPCInnerRef + 0.1, "Only tracks which are at a smaller radius will be propagated, defaults to TPC inner wall"}; - - // Configurables regarding what to propagate - // FIXME: This is dangerous and error prone for general purpose use. It is meant ONLY for testing. - Configurable propagateUnassociated{"propagateUnassociated", false, "propagate tracks with no collision assoc"}; - Configurable propagateTPConly{"propagateTPConly", false, "propagate tracks with only TPC (no ITS, TRD, TOF)"}; - Configurable minTPCClusters{"minTPCClusters", 70, "min number of TPC clusters to propagate"}; - Configurable maxPropagStep{"maxPropagStep", 2.0, "max propag step"}; // to be checked systematically - // use auto-detect configuration - Configurable d_UseAutodetectMode{"d_UseAutodetectMode", false, "Autodetect requested track criteria"}; - - bool hasEnding(std::string const& fullString, std::string const& ending) - { - if (fullString.length() >= ending.length()) { - return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending)); - } else { - return false; - } - } + HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext& initContext) { - const AxisSpec axisX{(int)4, 0.0f, +4.0f, "Track counter"}; - histos.add("hTrackCounter", "hTrackCounter", kTH1F, {axisX}); - - if (doprocessCovariance == true && doprocessStandard == true) { - LOGF(fatal, "Cannot enable processStandard and processCovariance at the same time. Please choose one."); - } - - // Checking if the tables are requested in the workflow and enabling them - auto& workflows = initContext.services().get(); - for (DeviceSpec const& device : workflows.devices) { - for (auto const& input : device.inputs) { - if (input.matcher.binding == "TracksDCA") { - fillTracksDCA = true; - } - } - } - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); - - if (d_UseAutodetectMode) { - LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); - LOGF(info, " Track propagator self-configuration"); - LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); - trackSels.SetTightSelections(); // Only loosen from this point forward - for (DeviceSpec const& device : workflows.devices) { - // Loop over options to find track selection - for (auto const& option : device.options) { - if (hasEnding(option.name, ".requireTPC")) { - bool lVal = option.defaultValue.get(); - LOGF(info, "Device %s, request TPC: %i", device.name, lVal); - if (trackSels.getRequireTPC() == false) - trackSels.setRequireTPC(lVal); - } - if (hasEnding(option.name, ".minTPCclusters")) { - int lVal = option.defaultValue.get(); - LOGF(info, "Device %s, min TPC clusters: %i", device.name, lVal); - if (trackSels.getMinTPCClusters() > lVal) - trackSels.setMinTPCClusters(lVal); - } - if (hasEnding(option.name, ".minTPCcrossedrows")) { - int lVal = option.defaultValue.get(); - LOGF(info, "Device %s, min TPC crossed rows: %i", device.name, lVal); - if (trackSels.getMinTPCCrossedRows() > lVal) - trackSels.setMinTPCCrossedRows(lVal); - } - if (hasEnding(option.name, ".minTPCcrossedrowsoverfindable")) { - float lVal = option.defaultValue.get(); - LOGF(info, "Device %s, min TPC crossed rows over findable: %.3f", device.name, lVal); - if (trackSels.getMinTPCCrossedRowsOverFindable() > lVal) - trackSels.setMinTPCCrossedRowsOverFindable(lVal); - } - if (hasEnding(option.name, ".requireITS")) { - bool lVal = option.defaultValue.get(); - LOGF(info, "Device %s, request ITS: %i", device.name, lVal); - if (trackSels.getRequireITS() == false) - trackSels.setRequireITS(lVal); - } - if (hasEnding(option.name, ".minITSclusters")) { - int lVal = option.defaultValue.get(); - LOGF(info, "Device %s, minimum ITS clusters: %i", device.name, lVal); - if (trackSels.getMinITSClusters() > lVal) - trackSels.setMinITSClusters(lVal); - } - if (hasEnding(option.name, ".maxITSChi2percluster")) { - float lVal = option.defaultValue.get(); - LOGF(info, "Device %s, max ITS chi2/clu: %.3f", device.name, lVal); - if (trackSels.getMaxITSChi2PerCluster() < lVal) - trackSels.setMaxITSChi2PerCluster(lVal); - } - } - } - LOGF(info, "-+*> Automatic self-config ended. Final settings:"); - trackSels.PrintSelections(); - } - } - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (runNumber == bc.runNumber()) { - return; - } - grpmag = ccdb->getForTimeStamp(grpmagPath, bc.timestamp()); - LOG(info) << "Setting magnetic field to current " << grpmag->getL3Current() << " A for run " << bc.runNumber() << " from its GRPMagField CCDB object"; - o2::base::Propagator::initFieldFromGRP(grpmag); - o2::base::Propagator::Instance()->setMatLUT(lut); - if (propagateUnassociated) - mVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); - runNumber = bc.runNumber(); + ccdbLoader.init(standardCCDBLoaderConfigurables, ccdb); + trackPropagation.init(trackPropagationConfigurables, registry, initContext); } - template - void FillTracksPar(TTrack& track, aod::track::TrackTypeEnum trackType, TTrackPar& trackPar) + void processReal(soa::Join const& tracks, aod::Collisions const&, aod::BCs const& bcs) { - tracksParPropagated(track.collisionId(), trackType, trackPar.getX(), trackPar.getAlpha(), trackPar.getY(), trackPar.getZ(), trackPar.getSnp(), trackPar.getTgl(), trackPar.getQ2Pt()); - tracksParExtensionPropagated(trackPar.getPt(), trackPar.getP(), trackPar.getEta(), trackPar.getPhi()); + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, tracks, trackPropagationProducts, registry); } + PROCESS_SWITCH(TrackPropagationTester, processReal, "Process Real Data", true); - void processStandard(soa::Join const& tracks, aod::Collisions const&, aod::BCsWithTimestamps const& bcs) + // ----------------------- + void processMc(soa::Join const& tracks, aod::McParticles const&, aod::Collisions const&, aod::BCs const& bcs) { - if (bcs.size() == 0) { - return; - } - initCCDB(bcs.begin()); - - std::array dcaInfo; - - int lNAll = 0; - int lNaccTPC = 0; - int lNaccNotTPCOnly = 0; - int lNPropagated = 0; - bool passTPCclu = kFALSE; - bool passNotTPCOnly = kFALSE; - - for (auto& track : tracks) { - // Selection criteria - passTPCclu = kFALSE; - passNotTPCOnly = kFALSE; - lNAll++; - if (track.tpcNClsFound() >= minTPCClusters) { - passTPCclu = kTRUE; - lNaccTPC++; - } - if ((track.hasTPC() && !track.hasITS() && !track.hasTRD() && !track.hasTOF()) || propagateTPConly) { - passNotTPCOnly = kTRUE; - lNaccNotTPCOnly++; - } - - dcaInfo[0] = 999; - dcaInfo[1] = 999; - aod::track::TrackTypeEnum trackType = (aod::track::TrackTypeEnum)track.trackType(); - auto trackPar = getTrackPar(track); - // Only propagate tracks which have passed the innermost wall of the TPC (e.g. skipping loopers etc). Others fill unpropagated. - if (track.trackType() == aod::track::TrackIU && track.x() < minPropagationRadius && passTPCclu && passNotTPCOnly) { - if (track.has_collision()) { - auto const& collision = track.collision(); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPar, maxPropagStep, matCorr, &dcaInfo); - trackType = aod::track::Track; - lNPropagated++; - } else { - if (propagateUnassociated) { - o2::base::Propagator::Instance()->propagateToDCABxByBz({mVtx->getX(), mVtx->getY(), mVtx->getZ()}, trackPar, maxPropagStep, matCorr, &dcaInfo); - trackType = aod::track::Track; - lNPropagated++; - } - } - } - FillTracksPar(track, trackType, trackPar); - if (fillTracksDCA) { - tracksDCA(dcaInfo[0], dcaInfo[1]); - } - } - // Fill only per table (not per track). ROOT FindBin is slow - histos.fill(HIST("hTrackCounter"), 0.5, lNAll); - histos.fill(HIST("hTrackCounter"), 1.5, lNaccTPC); - histos.fill(HIST("hTrackCounter"), 2.5, lNaccNotTPCOnly); - histos.fill(HIST("hTrackCounter"), 3.5, lNPropagated); - } - PROCESS_SWITCH(TrackPropagationTester, processStandard, "Process without covariance", true); - - void processCovariance(soa::Join const& tracks, aod::Collisions const&, aod::BCsWithTimestamps const& bcs) - { - if (bcs.size() == 0) { - return; - } - initCCDB(bcs.begin()); - - o2::dataformats::DCA dcaInfoCov; - o2::dataformats::VertexBase vtx; - - int lNAll = 0; - int lNaccTPC = 0; - int lNaccNotTPCOnly = 0; - int lNPropagated = 0; - bool passTPCclu = kFALSE; - bool passNotTPCOnly = kFALSE; - - for (auto& track : tracks) { - // Selection criteria - passTPCclu = kFALSE; - passNotTPCOnly = kFALSE; - lNAll++; - if (track.tpcNClsFound() >= minTPCClusters) { - passTPCclu = kTRUE; - lNaccTPC++; - } - if ((track.hasTPC() && !track.hasITS() && !track.hasTRD() && !track.hasTOF()) || propagateTPConly) { - passNotTPCOnly = kTRUE; - lNaccNotTPCOnly++; - } - - dcaInfoCov.set(999, 999, 999, 999, 999); - auto trackParCov = getTrackParCov(track); - aod::track::TrackTypeEnum trackType = (aod::track::TrackTypeEnum)track.trackType(); - // Only propagate tracks which have passed the innermost wall of the TPC (e.g. skipping loopers etc). Others fill unpropagated. - if (track.trackType() == aod::track::TrackIU && track.x() < minPropagationRadius && passTPCclu && passNotTPCOnly) { - if (track.has_collision()) { - auto const& collision = track.collision(); - vtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - vtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(vtx, trackParCov, maxPropagStep, matCorr, &dcaInfoCov); - trackType = aod::track::Track; - lNPropagated++; - } else { - if (propagateUnassociated) { - vtx.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - vtx.setCov(mVtx->getSigmaX() * mVtx->getSigmaX(), 0.0f, mVtx->getSigmaY() * mVtx->getSigmaY(), 0.0f, 0.0f, mVtx->getSigmaZ() * mVtx->getSigmaZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(vtx, trackParCov, maxPropagStep, matCorr, &dcaInfoCov); - trackType = aod::track::Track; - lNPropagated++; - } - } - } - FillTracksPar(track, trackType, trackParCov); - if (fillTracksDCA) { - tracksDCA(dcaInfoCov.getY(), dcaInfoCov.getZ()); - } - // TODO do we keep the rho as 0? Also the sigma's are duplicated information - tracksParCovPropagated(std::sqrt(trackParCov.getSigmaY2()), std::sqrt(trackParCov.getSigmaZ2()), std::sqrt(trackParCov.getSigmaSnp2()), - std::sqrt(trackParCov.getSigmaTgl2()), std::sqrt(trackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - tracksParCovExtensionPropagated(trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), - trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), trackParCov.getSigmaTglY(), trackParCov.getSigmaTglZ(), trackParCov.getSigmaTglSnp(), - trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), - trackParCov.getSigma1Pt2()); - } - // Fill only per table (not per track). ROOT FindBin is slow - histos.fill(HIST("hTrackCounter"), 0.5, lNAll); - histos.fill(HIST("hTrackCounter"), 1.5, lNaccTPC); - histos.fill(HIST("hTrackCounter"), 2.5, lNaccNotTPCOnly); - histos.fill(HIST("hTrackCounter"), 3.5, lNPropagated); + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, tracks, trackPropagationProducts, registry); } - PROCESS_SWITCH(TrackPropagationTester, processCovariance, "Process with covariance", false); + PROCESS_SWITCH(TrackPropagationTester, processMc, "Process Monte Carlo", false); }; //**************************************************************************************** diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h new file mode 100644 index 00000000000..548817222a9 --- /dev/null +++ b/Common/Tools/StandardCCDBLoader.h @@ -0,0 +1,109 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef COMMON_TOOLS_STANDARDCCDBLOADER_H_ +#define COMMON_TOOLS_STANDARDCCDBLOADER_H_ + +#include +#include +#include +#include "Framework/AnalysisDataModel.h" + +//__________________________________________ +// Standard class to load stuff +// such as matLUT, B and mean Vertex +// partial requests possible. + +namespace o2 +{ +namespace common +{ + +// ConfigurableGroup with locations +struct standardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup { + std::string prefix = "ccdb"; + o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + o2::framework::Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + o2::framework::Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + o2::framework::Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; +}; + +class StandardCCDBLoader +{ + public: + StandardCCDBLoader() + { + // constructor - null pointers + mMeanVtx = nullptr; + grpmag = nullptr; + lut = nullptr; + }; + + // commonly needed objects + const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + o2::base::MatLayerCylSet* lut = nullptr; + int runNumber = -1; + + template + void init(TConfigurableGroup const& cGroup, TCCDB& ccdb){ + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(cGroup.ccdburl.value); + } + + template + void initCCDBfromBCs(TConfigurableGroup const& cGroup, TCCDB& ccdb, TBCs& bcs, bool getMeanVertex = true) + { + // instant load from BCs table. Bonus: protect also against empty bcs + if (bcs.size() == 0) { + return; + } + auto bc = bcs.begin(); + initCCDB(cGroup, ccdb, bc.runNumber(), getMeanVertex); + } + + template + void initCCDB(TConfigurableGroup const& cGroup, TCCDB& ccdb, int currentRunNumber, bool getMeanVertex = true) + { + if (runNumber == currentRunNumber) { + return; + } + + // load matLUT for this timestamp + if (!lut) { + LOG(info) << "Loading material look-up table for timestamp: " << currentRunNumber; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->template getForRun(cGroup.lutPath.value, currentRunNumber)); + } else { + LOG(info) << "Material look-up table already in place. Not reloading."; + } + + grpmag = ccdb->template getForRun(cGroup.grpmagPath.value, currentRunNumber); + LOG(info) << "Setting global propagator magnetic field to current " << grpmag->getL3Current() << " A for run " << currentRunNumber << " from its GRPMagField CCDB object"; + o2::base::Propagator::initFieldFromGRP(grpmag); + LOG(info) << "Setting global propagator material propagation LUT"; + o2::base::Propagator::Instance()->setMatLUT(lut); + if (getMeanVertex) { + // only try this if explicitly requested + mMeanVtx = ccdb->template getForRun(cGroup.mVtxPath.value, currentRunNumber); + } else { + mMeanVtx = nullptr; + } + + runNumber = currentRunNumber; + } +}; + +} // namespace common +} // namespace o2 + +#endif // COMMON_TOOLS_STANDARDCCDBLOADER_H_ diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h new file mode 100644 index 00000000000..6fb252d1b71 --- /dev/null +++ b/Common/Tools/TrackPropagationModule.h @@ -0,0 +1,254 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ +#define COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ + +#include +#include +#include +#include "Framework/AnalysisDataModel.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramSpec.h" +#include "Common/Tools/TrackTuner.h" +#include "TableHelper.h" + +//__________________________________________ +// track propagation module +// +// this class is capable of performing the usual track propagation +// and table creation it is a demonstration of core service +// plug-in functionality that could be used to reduce the number of +// heavyweight (e.g. mat-LUT-using, propagating) core services to +// reduce overhead and make it easier to pipeline / parallelize +// bottlenecks in core services + +namespace o2 +{ +namespace common +{ + +struct trackPropagationProducts : o2::framework::ProducesGroup { + o2::framework::Produces tracksParPropagated; + o2::framework::Produces tracksParExtensionPropagated; + o2::framework::Produces tracksParCovPropagated; + o2::framework::Produces tracksParCovExtensionPropagated; + o2::framework::Produces tracksDCA; + o2::framework::Produces tracksDCACov; + o2::framework::Produces tunertable; +}; + +struct trackPropagationConfigurables : o2::framework::ConfigurableGroup { + std::string prefix = "trackPropagation"; + o2::framework::Configurable minPropagationRadius{"minPropagationDistance", o2::constants::geom::XTPCInnerRef + 0.1, "Only tracks which are at a smaller radius will be propagated, defaults to TPC inner wall"}; + // for TrackTuner only (MC smearing) + o2::framework::Configurable useTrackTuner{"useTrackTuner", false, "Apply track tuner corrections to MC"}; + o2::framework::Configurable useTrkPid{"useTrkPid", false, "use pid in tracking"}; + o2::framework::Configurable fillTrackTunerTable{"fillTrackTunerTable", false, "flag to fill track tuner table"}; + o2::framework::Configurable trackTunerConfigSource{"trackTunerConfigSource", aod::track_tuner::InputString, "1: input string; 2: TrackTuner Configurables"}; + o2::framework::Configurable trackTunerParams{"trackTunerParams", "debugInfo=0|updateTrackDCAs=1|updateTrackCovMat=1|updateCurvature=0|updateCurvatureIU=0|updatePulls=0|isInputFileFromCCDB=1|pathInputFile=Users/m/mfaggin/test/inputsTrackTuner/PbPb2022|nameInputFile=trackTuner_DataLHC22sPass5_McLHC22l1b2_run529397.root|pathFileQoverPt=Users/h/hsharma/qOverPtGraphs|nameFileQoverPt=D0sigma_Data_removal_itstps_MC_LHC22b1b.root|usePvRefitCorrections=0|qOverPtMC=-1.|qOverPtData=-1.", "TrackTuner parameter initialization (format: =|=)"}; + o2::framework::ConfigurableAxis axisPtQA{"axisPtQA", {o2::framework::VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; +}; + +class TrackPropagationModule +{ + public: + TrackPropagationModule() + { + // constructor + }; + + // controls behaviour + bool fillTracksCov = false; + bool fillTracksDCA = false; + bool fillTracksDCACov = false; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; + + // pointers to objs needed for operation + std::shared_ptr trackTunedTracks; + TrackTuner trackTunerObj; + + // Running variables + std::array mDcaInfo; + o2::dataformats::DCA mDcaInfoCov; + o2::dataformats::VertexBase mVtx; + o2::track::TrackParametrization mTrackPar; + o2::track::TrackParametrizationWithError mTrackParCov; + + template + void init(TConfigurableGroup const& cGroup, THistoRegistry& registry, TInitContext& initContext) + { + // Checking if the tables are requested in the workflow and enabling them + fillTracksCov = isTableRequiredInWorkflow(initContext, "TracksCov"); + fillTracksDCA = isTableRequiredInWorkflow(initContext, "TracksDCA"); + fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov"); + + /// TrackTuner initialization + if (cGroup.useTrackTuner.value) { + std::string outputStringParams = ""; + switch (cGroup.trackTunerConfigSource.value) { + case o2::aod::track_tuner::InputString: + outputStringParams = trackTunerObj.configParams(cGroup.trackTunerParams.value); + break; + case o2::aod::track_tuner::Configurables: + outputStringParams = trackTunerObj.configParams(); + break; + + default: + LOG(fatal) << "TrackTuner configuration source not defined. Fix it! (Supported options: input string (1); Configurables (2))"; + break; + } + + trackTunerObj.getDcaGraphs(); + } + + trackTunedTracks = registry.template add("trackTunedTracks", "trackTunedTracks", o2::framework::kTH1D, {{1, 0.5f, 1.5f}}); + + // Histograms for track tuner + o2::framework::AxisSpec axisBinsDCA = {600, -0.15f, 0.15f, "#it{dca}_{xy} (cm)"}; + registry.template add("hDCAxyVsPtRec", "hDCAxyVsPtRec", o2::framework::kTH2F, {axisBinsDCA, cGroup.axisPtQA}); + registry.template add("hDCAxyVsPtMC", "hDCAxyVsPtMC", o2::framework::kTH2F, {axisBinsDCA, cGroup.axisPtQA}); + registry.template add("hDCAzVsPtRec", "hDCAzVsPtRec", o2::framework::kTH2F, {axisBinsDCA, cGroup.axisPtQA}); + registry.template add("hDCAzVsPtMC", "hDCAzVsPtMC", o2::framework::kTH2F, {axisBinsDCA, cGroup.axisPtQA}); + } + + template + void fillTrackTables(TConfigurableGroup const& cGroup, TCCDBLoader const& ccdbLoader, TTracks const& tracks, TOutputGroup& cursors, THistoRegistry& registry) + { + if (fillTracksCov) { + cursors.tracksParCovPropagated.reserve(tracks.size()); + cursors.tracksParCovExtensionPropagated.reserve(tracks.size()); + if (fillTracksDCACov) { + cursors.tracksDCACov.reserve(tracks.size()); + } + } else { + cursors.tracksParPropagated.reserve(tracks.size()); + cursors.tracksParExtensionPropagated.reserve(tracks.size()); + if (fillTracksDCA) { + cursors.tracksDCA.reserve(tracks.size()); + } + } + + for (auto& track : tracks) { + if (fillTracksCov) { + if (fillTracksDCA || fillTracksDCACov) { + mDcaInfoCov.set(999, 999, 999, 999, 999); + } + setTrackParCov(track, mTrackParCov); + if (cGroup.useTrkPid.value) { + mTrackParCov.setPID(track.pidForTracking()); + } + } else { + if (fillTracksDCA) { + mDcaInfo[0] = 999; + mDcaInfo[1] = 999; + } + setTrackPar(track, mTrackPar); + if (cGroup.useTrkPid.value) { + mTrackPar.setPID(track.pidForTracking()); + } + } + // auto trackParCov = getTrackParCov(track); + o2::aod::track::TrackTypeEnum trackType = (o2::aod::track::TrackTypeEnum)track.trackType(); + // std::array trackPxPyPz; + // std::array trackPxPyPzTuned = {0.0, 0.0, 0.0}; + double q2OverPtNew = -9999.; + // Only propagate tracks which have passed the innermost wall of the TPC (e.g. skipping loopers etc). Others fill unpropagated. + if (track.trackType() == o2::aod::track::TrackIU && track.x() < cGroup.minPropagationRadius.value) { + if (fillTracksCov) { + if constexpr (isMc) { // checking MC and fillCovMat block begins + // bool hasMcParticle = track.has_mcParticle(); + if (cGroup.useTrackTuner) { + trackTunedTracks->Fill(1); // all tracks + bool hasMcParticle = track.has_mcParticle(); + if (hasMcParticle) { + auto mcParticle = track.mcParticle(); + trackTunerObj.tuneTrackParams(mcParticle, mTrackParCov, matCorr, &mDcaInfoCov, trackTunedTracks); + q2OverPtNew = mTrackParCov.getQ2Pt(); + } + } + } // MC and fillCovMat block ends + } + bool isPropagationOK = true; + + if (track.has_collision()) { + auto const& collision = track.collision(); + if (fillTracksCov) { + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + isPropagationOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCov, 2.f, matCorr, &mDcaInfoCov); + } else { + isPropagationOK = o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo); + } + } else { + if (fillTracksCov) { + mVtx.setPos({ccdbLoader.mMeanVtx->getX(), ccdbLoader.mMeanVtx->getY(), ccdbLoader.mMeanVtx->getZ()}); + mVtx.setCov(ccdbLoader.mMeanVtx->getSigmaX() * ccdbLoader.mMeanVtx->getSigmaX(), 0.0f, ccdbLoader.mMeanVtx->getSigmaY() * ccdbLoader.mMeanVtx->getSigmaY(), 0.0f, 0.0f, ccdbLoader.mMeanVtx->getSigmaZ() * ccdbLoader.mMeanVtx->getSigmaZ()); + isPropagationOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCov, 2.f, matCorr, &mDcaInfoCov); + } else { + isPropagationOK = o2::base::Propagator::Instance()->propagateToDCABxByBz({ccdbLoader.mMeanVtx->getX(), ccdbLoader.mMeanVtx->getY(), ccdbLoader.mMeanVtx->getZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo); + } + } + if (isPropagationOK) { + trackType = o2::aod::track::Track; + } + // filling some QA histograms for track tuner test purpose + if (fillTracksCov) { + if constexpr (isMc) { // checking MC and fillCovMat block begins + if (track.has_mcParticle() && isPropagationOK) { + auto mcParticle1 = track.mcParticle(); + // && abs(mcParticle1.pdgCode())==211 + if (mcParticle1.isPhysicalPrimary()) { + registry.fill(HIST("hDCAxyVsPtRec"), mDcaInfoCov.getY(), mTrackParCov.getPt()); + registry.fill(HIST("hDCAxyVsPtMC"), mDcaInfoCov.getY(), mcParticle1.pt()); + registry.fill(HIST("hDCAzVsPtRec"), mDcaInfoCov.getZ(), mTrackParCov.getPt()); + registry.fill(HIST("hDCAzVsPtMC"), mDcaInfoCov.getZ(), mcParticle1.pt()); + } + } + } // MC and fillCovMat block ends + } + } + // Filling modified Q/Pt values at IU/production point by track tuner in track tuner table + if (cGroup.useTrackTuner.value && cGroup.fillTrackTunerTable.value) { + cursors.tunertable(q2OverPtNew); + } + // LOG(info) << " trackPropagation (this value filled in tuner table)--> " << q2OverPtNew; + if (fillTracksCov) { + cursors.tracksParPropagated(track.collisionId(), trackType, mTrackParCov.getX(), mTrackParCov.getAlpha(), mTrackParCov.getY(), mTrackParCov.getZ(), mTrackParCov.getSnp(), mTrackParCov.getTgl(), mTrackParCov.getQ2Pt()); + cursors.tracksParExtensionPropagated(mTrackParCov.getPt(), mTrackParCov.getP(), mTrackParCov.getEta(), mTrackParCov.getPhi()); + // TODO do we keep the rho as 0? Also the sigma's are duplicated information + cursors.tracksParCovPropagated(std::sqrt(mTrackParCov.getSigmaY2()), std::sqrt(mTrackParCov.getSigmaZ2()), std::sqrt(mTrackParCov.getSigmaSnp2()), + std::sqrt(mTrackParCov.getSigmaTgl2()), std::sqrt(mTrackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + cursors.tracksParCovExtensionPropagated(mTrackParCov.getSigmaY2(), mTrackParCov.getSigmaZY(), mTrackParCov.getSigmaZ2(), mTrackParCov.getSigmaSnpY(), + mTrackParCov.getSigmaSnpZ(), mTrackParCov.getSigmaSnp2(), mTrackParCov.getSigmaTglY(), mTrackParCov.getSigmaTglZ(), mTrackParCov.getSigmaTglSnp(), + mTrackParCov.getSigmaTgl2(), mTrackParCov.getSigma1PtY(), mTrackParCov.getSigma1PtZ(), mTrackParCov.getSigma1PtSnp(), mTrackParCov.getSigma1PtTgl(), + mTrackParCov.getSigma1Pt2()); + if (fillTracksDCA) { + cursors.tracksDCA(mDcaInfoCov.getY(), mDcaInfoCov.getZ()); + } + if (fillTracksDCACov) { + cursors.tracksDCACov(mDcaInfoCov.getSigmaY2(), mDcaInfoCov.getSigmaZ2()); + } + } else { + cursors.tracksParPropagated(track.collisionId(), trackType, mTrackPar.getX(), mTrackPar.getAlpha(), mTrackPar.getY(), mTrackPar.getZ(), mTrackPar.getSnp(), mTrackPar.getTgl(), mTrackPar.getQ2Pt()); + cursors.tracksParExtensionPropagated(mTrackPar.getPt(), mTrackPar.getP(), mTrackPar.getEta(), mTrackPar.getPhi()); + if (fillTracksDCA) { + cursors.tracksDCA(mDcaInfo[0], mDcaInfo[1]); + } + } + } + } +}; + +} // namespace common +} // namespace o2 + +#endif // COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ From 5492d1c06b4a4bcaae676368d689fe677dea9c5d Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sat, 24 May 2025 05:01:19 +0200 Subject: [PATCH 2/7] Please consider the following formatting changes (#416) --- .../TableProducer/trackPropagationTester.cxx | 8 +++---- Common/Tools/StandardCCDBLoader.h | 21 ++++++++++--------- Common/Tools/TrackPropagationModule.h | 3 +-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 7dea2087418..97408af1263 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -52,10 +52,10 @@ using namespace o2::framework; // using namespace o2::framework::expressions; struct TrackPropagationTester { - o2::common::standardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; - o2::common::trackPropagationProducts trackPropagationProducts; - o2::common::trackPropagationConfigurables trackPropagationConfigurables; - + o2::common::standardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::trackPropagationProducts trackPropagationProducts; + o2::common::trackPropagationConfigurables trackPropagationConfigurables; + Service ccdb; o2::common::StandardCCDBLoader ccdbLoader; diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 548817222a9..185799ecc8a 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -27,14 +27,14 @@ namespace o2 namespace common { -// ConfigurableGroup with locations +// ConfigurableGroup with locations struct standardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup { - std::string prefix = "ccdb"; - o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - o2::framework::Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - o2::framework::Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - o2::framework::Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + std::string prefix = "ccdb"; + o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + o2::framework::Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + o2::framework::Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + o2::framework::Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; }; class StandardCCDBLoader @@ -54,8 +54,9 @@ class StandardCCDBLoader o2::base::MatLayerCylSet* lut = nullptr; int runNumber = -1; - template - void init(TConfigurableGroup const& cGroup, TCCDB& ccdb){ + template + void init(TConfigurableGroup const& cGroup, TCCDB& ccdb) + { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setURL(cGroup.ccdburl.value); @@ -103,7 +104,7 @@ class StandardCCDBLoader } }; -} // namespace common +} // namespace common } // namespace o2 #endif // COMMON_TOOLS_STANDARDCCDBLOADER_H_ diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 6fb252d1b71..d720dab432a 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -61,8 +61,7 @@ struct trackPropagationConfigurables : o2::framework::ConfigurableGroup { class TrackPropagationModule { public: - TrackPropagationModule() - { + TrackPropagationModule(){ // constructor }; From beb88540e314cae73f38ab0c60c02f3aa603a8a7 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 24 May 2025 05:59:00 +0200 Subject: [PATCH 3/7] Fix linter errors --- Common/TableProducer/trackPropagationTester.cxx | 10 +++++++--- Common/Tools/StandardCCDBLoader.h | 7 +++++-- Common/Tools/TrackPropagationModule.h | 16 ++++++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 97408af1263..d91a50f3057 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file trackPropagationTester.cxx +/// \brief testing ground for track propagation +/// \author ALICE + //=============================================================== // // Experimental version of the track propagation task @@ -52,9 +56,9 @@ using namespace o2::framework; // using namespace o2::framework::expressions; struct TrackPropagationTester { - o2::common::standardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; - o2::common::trackPropagationProducts trackPropagationProducts; - o2::common::trackPropagationConfigurables trackPropagationConfigurables; + o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::TrackPropagationProducts trackPropagationProducts; + o2::common::TrackPropagationConfigurables trackPropagationConfigurables; Service ccdb; diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 185799ecc8a..7269e77ed26 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file StandardCCDBLoader.cxx +/// \brief A simple object to handle ccdb queries +/// \author ALICE + #ifndef COMMON_TOOLS_STANDARDCCDBLOADER_H_ #define COMMON_TOOLS_STANDARDCCDBLOADER_H_ @@ -28,11 +32,10 @@ namespace common { // ConfigurableGroup with locations -struct standardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup { +struct StandardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup { std::string prefix = "ccdb"; o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; o2::framework::Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - o2::framework::Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; o2::framework::Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; }; diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index d720dab432a..3065e8ebb8a 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -9,8 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ -#define COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ +/// \file TrackPropagationModule.h +/// \brief track propagation module functionality to be used in tasks +/// \author ALICE + +#ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ +#define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #include #include @@ -36,7 +40,7 @@ namespace o2 namespace common { -struct trackPropagationProducts : o2::framework::ProducesGroup { +struct TrackPropagationProducts : o2::framework::ProducesGroup { o2::framework::Produces tracksParPropagated; o2::framework::Produces tracksParExtensionPropagated; o2::framework::Produces tracksParCovPropagated; @@ -46,7 +50,7 @@ struct trackPropagationProducts : o2::framework::ProducesGroup { o2::framework::Produces tunertable; }; -struct trackPropagationConfigurables : o2::framework::ConfigurableGroup { +struct TrackPropagationConfigurables : o2::framework::ConfigurableGroup { std::string prefix = "trackPropagation"; o2::framework::Configurable minPropagationRadius{"minPropagationDistance", o2::constants::geom::XTPCInnerRef + 0.1, "Only tracks which are at a smaller radius will be propagated, defaults to TPC inner wall"}; // for TrackTuner only (MC smearing) @@ -136,7 +140,7 @@ class TrackPropagationModule } } - for (auto& track : tracks) { + for (const auto& track : tracks) { if (fillTracksCov) { if (fillTracksDCA || fillTracksDCACov) { mDcaInfoCov.set(999, 999, 999, 999, 999); @@ -250,4 +254,4 @@ class TrackPropagationModule } // namespace common } // namespace o2 -#endif // COMMON_TOOLS_TRACKPROPAGATIONFUNCTIONS_H_ +#endif // COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ From 050772b9d232a68c57cc1bdc4b0925e04066e3d7 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 24 May 2025 06:09:34 +0200 Subject: [PATCH 4/7] Fix megalinter --- Common/TableProducer/trackPropagationTester.cxx | 1 - Common/Tools/StandardCCDBLoader.h | 1 + Common/Tools/TrackPropagationModule.h | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index d91a50f3057..60aaa342775 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -37,7 +37,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "DataFormatsCalibration/MeanVertexObject.h" #include "CommonConstants/GeomConstants.h" #include "Common/Tools/TrackPropagationModule.h" diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 7269e77ed26..687db6c07d1 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -16,6 +16,7 @@ #ifndef COMMON_TOOLS_STANDARDCCDBLOADER_H_ #define COMMON_TOOLS_STANDARDCCDBLOADER_H_ +#include #include #include #include diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 3065e8ebb8a..4d27f021bcf 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -16,9 +16,11 @@ #ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ +#include #include #include #include +#include #include "Framework/AnalysisDataModel.h" #include "Framework/Configurable.h" #include "Framework/HistogramSpec.h" @@ -67,7 +69,7 @@ class TrackPropagationModule public: TrackPropagationModule(){ // constructor - }; + } // controls behaviour bool fillTracksCov = false; From 34edffa074751f31b8e649d7af35f19767372e72 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sat, 24 May 2025 06:10:50 +0200 Subject: [PATCH 5/7] Please consider the following formatting changes (#417) --- Common/Tools/TrackPropagationModule.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 4d27f021bcf..2939e995117 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -67,7 +67,8 @@ struct TrackPropagationConfigurables : o2::framework::ConfigurableGroup { class TrackPropagationModule { public: - TrackPropagationModule(){ + TrackPropagationModule() + { // constructor } From eccdf2eefe58004d27fcd423ee280f068e4adeaf Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 24 May 2025 23:43:10 +0200 Subject: [PATCH 6/7] Minor adjustments for next steps --- Common/TableProducer/trackPropagationTester.cxx | 10 +++++++++- Common/Tools/StandardCCDBLoader.h | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 60aaa342775..669e89608d3 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -59,6 +59,8 @@ struct TrackPropagationTester { o2::common::TrackPropagationProducts trackPropagationProducts; o2::common::TrackPropagationConfigurables trackPropagationConfigurables; + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service ccdb; o2::common::StandardCCDBLoader ccdbLoader; @@ -68,12 +70,18 @@ struct TrackPropagationTester { void init(o2::framework::InitContext& initContext) { - ccdbLoader.init(standardCCDBLoaderConfigurables, ccdb); + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific trackPropagation.init(trackPropagationConfigurables, registry, initContext); } void processReal(soa::Join const& tracks, aod::Collisions const&, aod::BCs const& bcs) { + // task-specific ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, tracks, trackPropagationProducts, registry); } diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 687db6c07d1..6ba4c9be9a1 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -58,14 +58,6 @@ class StandardCCDBLoader o2::base::MatLayerCylSet* lut = nullptr; int runNumber = -1; - template - void init(TConfigurableGroup const& cGroup, TCCDB& ccdb) - { - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setURL(cGroup.ccdburl.value); - } - template void initCCDBfromBCs(TConfigurableGroup const& cGroup, TCCDB& ccdb, TBCs& bcs, bool getMeanVertex = true) { From 7c073bf1f68e7590ac74dba8f4365dd8c3fa6564 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sat, 24 May 2025 23:44:44 +0200 Subject: [PATCH 7/7] Please consider the following formatting changes (#418) --- Common/TableProducer/trackPropagationTester.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 669e89608d3..303e9e078b9 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -70,11 +70,11 @@ struct TrackPropagationTester { void init(o2::framework::InitContext& initContext) { - // CCDB boilerplate init + // CCDB boilerplate init ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setURL(ccdburl.value); - + // task-specific trackPropagation.init(trackPropagationConfigurables, registry, initContext); }