Skip to content

Commit b873c97

Browse files
matthias-kleinerdavidrohr
authored andcommitted
TPC: remove CorrectionMaps helper/loader classes
Replace CorrectionMapsLoader/Helper with their Full variants, renaming CorrectionMapsLoaderFull -> CorrectionMapsLoader and CorrectionMapsHelperFull -> CorrectionMapsHelper. Use TPCFastTransformPOD directly without the intermediate helper class.
1 parent 1450d88 commit b873c97

File tree

101 files changed

+910
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+910
-1196
lines changed

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "TRDBase/TrackletTransformer.h"
3737
#include "CommonUtils/TreeStreamRedirector.h"
3838
#include "TPCCalibration/VDriftHelper.h"
39-
#include "TPCCalibration/CorrectionMapsLoader.h"
39+
#include "TPCFastTransformPOD.h"
4040
#include "GPUO2ExternalUser.h"
4141
#include "GPUO2InterfaceUtils.h"
4242
#include "GPUParam.h"
@@ -117,7 +117,9 @@ class BarrelAlignmentSpec : public Task
117117
std::unique_ptr<o2::gpu::GPUParam> mTPCParam;
118118

119119
o2::tpc::VDriftHelper mTPCVDriftHelper{};
120-
o2::tpc::CorrectionMapsLoader mTPCCorrMapsLoader{};
120+
121+
std::vector<char> mCorrMapBuffer; // buffer to hold the raw map data from CCDB, needed to keep the pointer valid in the CorrectionMapsHelper
122+
const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps{};
121123

122124
//
123125
TStopwatch mTimer;
@@ -264,21 +266,17 @@ void BarrelAlignmentSpec::updateTimeDependentParams(ProcessingContext& pc)
264266
}
265267

266268
mTPCVDriftHelper.extractCCDBInputs(pc);
267-
mTPCCorrMapsLoader.extractCCDBInputs(pc);
268-
bool updateMaps = false;
269-
if (mTPCCorrMapsLoader.isUpdated()) {
270-
mTPCCorrMapsLoader.acknowledgeUpdate();
271-
updateMaps = true;
272-
}
273-
// mController->setTPCCorrMaps(&mTPCCorrMapsLoader);
269+
270+
auto const& raw = pc.inputs().get<const char*>("corrMap");
271+
mTPCCorrMaps = &o2::gpu::TPCFastTransformPOD::get(raw);
272+
mController->setTPCCorrMaps(mTPCCorrMaps);
274273
if (mTPCVDriftHelper.isUpdated()) {
275274
LOGP(info, "Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
276275
mTPCVDriftHelper.getVDriftObject().corrFact, mTPCVDriftHelper.getVDriftObject().refVDrift,
277276
mTPCVDriftHelper.getVDriftObject().timeOffsetCorr, mTPCVDriftHelper.getVDriftObject().refTimeOffset,
278277
mTPCVDriftHelper.getSourceName());
279278
mController->setTPCVDrift(mTPCVDriftHelper.getVDriftObject());
280279
mTPCVDriftHelper.acknowledgeUpdate();
281-
updateMaps = true;
282280
}
283281
}
284282
}
@@ -385,7 +383,7 @@ DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_
385383
}
386384
if (src[DetID::TPC] && !skipDetClusters[DetID::TPC]) {
387385
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
388-
o2::tpc::CorrectionMapsLoader::requestInputs(dataRequest->inputs, opts);
386+
dataRequest->inputs.emplace_back("corrMap", o2::header::gDataOriginTPC, "TPCCORRMAP", 0, Lifetime::Timeframe);
389387
loadTPCCalib = true;
390388
}
391389
}

Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "ReconstructionDataFormats/GlobalTrackID.h"
2727
#include "DetectorsCommonDataFormats/DetID.h"
2828
#include "GlobalTrackingWorkflowReaders/TrackTPCITSReaderSpec.h"
29+
#include "TPCCalibration/CorrectionMapsOptions.h"
2930

3031
#include "Algorithm/RangeTokenizer.h"
3132
#include "DetectorsRaw/HBFUtilsInitializer.h"
@@ -58,7 +59,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5859
{"enable-cosmic", VariantType::Bool, false, {"enable cosmic tracks)"}},
5960
{"postprocessing", VariantType::Int, 0, {"postprocessing bits: 1 - extract alignment objects, 2 - check constraints, 4 - print mpParams/Constraints, 8 - relabel pede results"}},
6061
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
61-
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
62+
o2::tpc::CorrectionMapsOptions::addGlobalOptions(options);
6263
o2::raw::HBFUtilsInitializer::addConfigOption(options);
6364
std::swap(workflowOptions, options);
6465
}
@@ -101,7 +102,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
101102
if (dets[DetID::TPC]) {
102103
loadTPCClusters = loadTPCTracks = true;
103104
}
104-
auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
105+
auto sclOpt = o2::tpc::CorrectionMapsOptions::parseGlobalOptions(configcontext.options());
105106
if (!postprocess) { // this part is needed only if the data should be read
106107
if (GID::includesDet(DetID::ITS, src)) {
107108
src |= GID::getSourceMask(GID::ITS);

Detectors/Align/include/Align/Controller.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "ReconstructionDataFormats/PrimaryVertex.h"
3131
#include "ReconstructionDataFormats/TrackCosmics.h"
3232
#include "DataFormatsTPC/VDriftCorrFact.h"
33-
#include "CorrectionMapsHelper.h"
33+
#include "TPCFastTransformPOD.h"
3434

3535
#include "Align/Millepede2Record.h"
3636
#include "Align/ResidualsController.h"
@@ -272,8 +272,8 @@ class Controller final : public TObject
272272
bool getAllowAfterburnerTracks() const { return mAllowAfterburnerTracks; }
273273

274274
void setTPCVDrift(const o2::tpc::VDriftCorrFact& v);
275-
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph);
276-
o2::gpu::CorrectionMapsHelper* getTPCCorrMaps() { return mTPCCorrMapsHelper; }
275+
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph);
276+
const o2::gpu::TPCFastTransformPOD* getTPCCorrMaps() { return mTPCCorrMaps; }
277277
const o2::tpc::VDriftCorrFact& getTPCVDrift() const { return mTPCDrift; }
278278

279279
int getInstanceID() const { return mInstanceID; }
@@ -359,7 +359,7 @@ class Controller final : public TObject
359359
bool mUseRecoOCDB = true; // flag to preload reco-time calib objects
360360

361361
o2::tpc::VDriftCorrFact mTPCDrift{};
362-
o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
362+
const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
363363

364364
//
365365
static const int sSkipLayers[kNLrSkip]; // detector layers for which we don't need module matrices

Detectors/Align/src/Controller.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,9 +1882,9 @@ void Controller::setTPCVDrift(const o2::tpc::VDriftCorrFact& v)
18821882
}
18831883

18841884
//______________________________________________
1885-
void Controller::setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph)
1885+
void Controller::setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph)
18861886
{
1887-
mTPCCorrMapsHelper = maph;
1887+
mTPCCorrMaps = maph;
18881888
}
18891889

18901890
} // namespace align

Detectors/GlobalTracking/include/GlobalTracking/MatchCosmics.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class VDriftCorrFact;
3838
}
3939
namespace gpu
4040
{
41-
class CorrectionMapsHelper;
41+
class TPCFastTransformPOD;
4242
}
4343
namespace globaltracking
4444
{
@@ -85,7 +85,7 @@ class MatchCosmics
8585
GTrackID origID; ///< track origin id
8686
int matchID = MinusOne; ///< entry (none if MinusOne) of its match in the vector of matches
8787
};
88-
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph);
88+
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph);
8989
void setTPCVDrift(const o2::tpc::VDriftCorrFact& v);
9090
void setITSROFrameLengthMUS(float fums) { mITSROFrameLengthMUS = fums; }
9191
void setITSDict(const o2::itsmft::TopologyDictionary* dict) { mITSDict = dict; }
@@ -138,14 +138,14 @@ class MatchCosmics
138138
std::vector<MatchRecord> mRecords;
139139
std::vector<int> mWinners;
140140
const o2::itsmft::TopologyDictionary* mITSDict = nullptr; // cluster patterns dictionary
141-
o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
141+
const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
142142
int mTFCount = 0;
143-
float mTPCVDriftRef = -1.; ///< TPC nominal drift speed in cm/microseconds
144-
float mTPCVDriftCorrFact = 1.; ///< TPC nominal correction factort (wrt ref)
145-
float mTPCVDrift = -1.; ///< TPC drift speed in cm/microseconds
143+
float mTPCVDriftRef = -1.; ///< TPC nominal drift speed in cm/microseconds
144+
float mTPCVDriftCorrFact = 1.; ///< TPC nominal correction factort (wrt ref)
145+
float mTPCVDrift = -1.; ///< TPC drift speed in cm/microseconds
146146
float mTPCDriftTimeOffset = 0.; ///< drift time offset in mus
147-
float mTPCTBinMUS = 0.; ///< TPC time bin duration in microseconds
148-
float mBz = 0; ///< nominal Bz
147+
float mTPCTBinMUS = 0.; ///< TPC time bin duration in microseconds
148+
float mBz = 0; ///< nominal Bz
149149
bool mFieldON = true;
150150
bool mUseMC = true;
151151
float mITSROFrameLengthMUS = 0.;

Detectors/GlobalTracking/include/GlobalTracking/MatchTOF.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "ReconstructionDataFormats/PID.h"
4040
#include "TPCFastTransform.h"
4141
#include "CommonDataFormat/InteractionRecord.h"
42-
#include "CorrectionMapsHelper.h"
4342
#include "GlobalTracking/MatchTOFParams.h"
4443

4544
// from FIT
@@ -152,7 +151,7 @@ class MatchTOF
152151
std::vector<o2::MCCompLabel>& getMatchedTOFLabelsVector(trkType index) { return mOutTOFLabels[index]; } ///< get vector of TOF labels of matched tracks
153152

154153
void setTPCVDrift(const o2::tpc::VDriftCorrFact& v);
155-
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph);
154+
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph, float lumi);
156155

157156
void setFIT(bool value = true) { mIsFIT = value; }
158157
static int findFITIndex(int bc, const gsl::span<const o2::ft0::RecPoints>& FITRecPoints, unsigned long firstOrbit);
@@ -292,7 +291,8 @@ class MatchTOF
292291
gsl::span<const unsigned int> mTPCRefitterOccMap; ///< externally set TPC clusters occupancy map
293292
const o2::tpc::ClusterNativeAccess* mTPCClusterIdxStruct = nullptr; ///< struct holding the TPC cluster indices
294293

295-
o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr; ///< TPC cluster transformation
294+
const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr; ///< TPC cluster transformation
295+
float mCTPLumi = {-1};
296296
std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mTPCRefitter; ///< TPC refitter used for TPC tracks refit during the reconstruction
297297

298298
const o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mTOFClusLabels; ///< input TOF clusters MC labels (pointer to read from tree)

Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#include "DataFormatsITSMFT/TopologyDictionary.h"
5656
#include "DataFormatsITSMFT/TrkClusRef.h"
5757
#include "ITSMFTReconstruction/ChipMappingITS.h"
58-
#include "CorrectionMapsHelper.h"
58+
#include "TPCFastTransformPOD.h"
5959
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
6060
#include "MemoryResources/MemoryResources.h"
6161
#endif
@@ -434,7 +434,7 @@ class MatchTPCITS
434434
mVDriftCalibOn = v;
435435
}
436436
void setTPCVDrift(const o2::tpc::VDriftCorrFact& v);
437-
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph);
437+
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph, float lumi);
438438

439439
///< print settings
440440
void print() const;
@@ -641,7 +641,8 @@ class MatchTPCITS
641641
float mMinITSTrackPtInv = 999.; ///< cutoff on ITS track inverse pT
642642
bool mVDriftCalibOn = false; ///< flag to produce VDrift calibration data
643643
o2::tpc::VDriftCorrFact mTPCDrift{};
644-
o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
644+
const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
645+
float mLumiCTP{-1};
645646

646647
std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mTPCRefitter; ///< TPC refitter used for TPC tracks refit during the reconstruction
647648

Detectors/GlobalTracking/src/MatchCosmics.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "CommonConstants/GeomConstants.h"
3333
#include "DataFormatsTPC/WorkflowHelper.h"
3434
#include "DataFormatsTPC/VDriftCorrFact.h"
35-
#include "CorrectionMapsHelper.h"
35+
#include "TPCFastTransformPOD.h"
3636
#include <algorithm>
3737
#include <numeric>
3838

@@ -93,7 +93,7 @@ void MatchCosmics::refitWinners(const o2::globaltracking::RecoContainer& data)
9393
std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> tpcRefitter;
9494
if (data.inputsTPCclusters) {
9595
tpcRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(&data.inputsTPCclusters->clusterIndex,
96-
mTPCCorrMapsHelper, mBz,
96+
mTPCCorrMaps, mBz,
9797
tpcClusRefs.data(), 0, tpcClusShMap.data(),
9898
tpcClusOccMap.data(), tpcClusOccMap.size(), nullptr, o2::base::Propagator::Instance());
9999
}
@@ -597,9 +597,9 @@ void MatchCosmics::setTPCVDrift(const o2::tpc::VDriftCorrFact& v)
597597
}
598598

599599
//______________________________________________
600-
void MatchCosmics::setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph)
600+
void MatchCosmics::setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph)
601601
{
602-
mTPCCorrMapsHelper = maph;
602+
mTPCCorrMaps = maph;
603603
}
604604

605605
#endif

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ void MatchTOF::setTPCVDrift(const o2::tpc::VDriftCorrFact& v)
255255
}
256256

257257
//______________________________________________
258-
void MatchTOF::setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph)
258+
void MatchTOF::setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph, float lumi)
259259
{
260-
mTPCCorrMapsHelper = maph;
260+
mTPCCorrMaps = maph;
261+
mCTPLumi = lumi;
261262
}
262263

263264
//______________________________________________
@@ -2085,7 +2086,7 @@ void MatchTOF::updateTimeDependentParams()
20852086
mMaxInvPt = std::abs(mBz) > 0.1 ? 1. / (std::abs(mBz) * 0.05) : 999.;
20862087

20872088
const auto& trackTune = TrackTuneParams::Instance();
2088-
float scale = mTPCCorrMapsHelper->getInstLumiCTP();
2089+
float scale = mCTPLumi;
20892090
if (scale < 0.f) {
20902091
LOGP(warning, "Negative scale factor for TPC covariance correction, setting it to zero");
20912092
scale = 0.f;
@@ -2167,7 +2168,7 @@ bool MatchTOF::makeConstrainedTPCTrack(int matchedID, o2::dataformats::TrackTPCT
21672168
void MatchTOF::checkRefitter()
21682169
{
21692170
if (mTPCClusterIdxStruct) {
2170-
mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct, mTPCCorrMapsHelper, mBz,
2171+
mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct, mTPCCorrMaps, mBz,
21712172
mTPCTrackClusIdx.data(), 0, mTPCRefitterShMap.data(),
21722173
mTPCRefitterOccMap.data(), mTPCRefitterOccMap.size(), nullptr, o2::base::Propagator::Instance());
21732174
}

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ void MatchTPCITS::setTPCVDrift(const o2::tpc::VDriftCorrFact& v)
205205
}
206206

207207
//______________________________________________
208-
void MatchTPCITS::setTPCCorrMaps(o2::gpu::CorrectionMapsHelper* maph)
208+
void MatchTPCITS::setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD* maph, float lumi)
209209
{
210-
mTPCCorrMapsHelper = maph;
210+
mTPCCorrMaps = maph;
211+
mLumiCTP = lumi;
211212
}
212213

213214
//______________________________________________
@@ -286,7 +287,7 @@ void MatchTPCITS::updateTimeDependentParams()
286287
mTPCmeanX0Inv = matbd.meanX2X0 / matbd.length;
287288

288289
const auto& trackTune = TrackTuneParams::Instance();
289-
float scale = mTPCCorrMapsHelper->getInstLumiCTP();
290+
float scale = mLumiCTP;
290291
if (scale < 0.f) {
291292
LOGP(warning, "Negative scale factor for TPC covariance correction, setting it to zero");
292293
scale = 0.f;
@@ -505,7 +506,7 @@ bool MatchTPCITS::prepareTPCData()
505506
mTPCSectIndexCache[sec].reserve(100 + 1.2 * ntrW / o2::constants::math::NSectors);
506507
}
507508

508-
mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct, mTPCCorrMapsHelper, mBz, mTPCTrackClusIdx.data(), 0, mTPCRefitterShMap.data(), mTPCRefitterOccMap.data(), mTPCRefitterOccMap.size(), nullptr, o2::base::Propagator::Instance());
509+
mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct, mTPCCorrMaps, mBz, mTPCTrackClusIdx.data(), 0, mTPCRefitterShMap.data(), mTPCRefitterOccMap.data(), mTPCRefitterOccMap.size(), nullptr, o2::base::Propagator::Instance());
509510
mNTPCOccBinLength = mTPCRefitter->getParam()->rec.tpc.occupancyMapTimeBins;
510511
mTBinClOcc.clear();
511512
if (mNTPCOccBinLength > 1 && mTPCRefitterOccMap.size()) {

0 commit comments

Comments
 (0)