Project
Loading...
Searching...
No Matches
GPUWorkflowTPC.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
16#include "Headers/DataHeader.h"
17#include "Framework/WorkflowSpec.h" // o2::framework::mergeInputs
25#include "Framework/Logger.h"
39#include "TPCFastTransform.h"
46#include "TPCBase/RDHUtils.h"
48#include "GPUO2InterfaceQA.h"
49#include "GPUO2Interface.h"
50#include "GPUO2InterfaceUtils.h"
51#include "CalibdEdxContainer.h"
52#include "GPUNewCalibValues.h"
53#include "TPCPadGainCalib.h"
54#include "TPCZSLinkMapping.h"
56#include "TPCBase/Sector.h"
57#include "TPCBase/Utils.h"
66#include "Algorithm/Parser.h"
71#include <filesystem>
72#include <memory> // for make_shared
73#include <vector>
74#include <iomanip>
75#include <stdexcept>
76#include <regex>
77#include <sys/types.h>
78#include <sys/stat.h>
79#include <fcntl.h>
80#include <chrono>
83#include <TStopwatch.h>
84#include <TObjArray.h>
85#include <TH1F.h>
86#include <TH2F.h>
87#include <TH1D.h>
88#include <TGraphAsymmErrors.h>
89
90using namespace o2::framework;
91using namespace o2::header;
92using namespace o2::gpu;
93using namespace o2::base;
94using namespace o2::dataformats;
95
96namespace o2::gpu
97{
98
99void GPURecoWorkflowSpec::initFunctionTPCCalib(InitContext& ic)
100{
101 mTPCDeadChannelMapCreator.reset(new o2::tpc::DeadChannelMapCreator());
102 const auto deadMapSource = (mSpecConfig.tpcDeadMapSources > -1) ? static_cast<tpc::SourcesDeadMap>(mSpecConfig.tpcDeadMapSources) : tpc::SourcesDeadMap::All;
103 mTPCDeadChannelMapCreator->init();
104 mTPCDeadChannelMapCreator->setSource(deadMapSource);
105
106 mCalibObjects.mdEdxCalibContainer.reset(new o2::tpc::CalibdEdxContainer());
107 mTPCVDriftHelper.reset(new o2::tpc::VDriftHelper());
108 mCalibObjects.mFastTransformHelper.reset(new o2::tpc::CorrectionMapsLoader());
109 mCalibObjects.mFastTransform = std::move(o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
110 mCalibObjects.mFastTransformRef = std::move(o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
111 mCalibObjects.mFastTransformMShape = std::move(o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
112 mCalibObjects.mFastTransformHelper->setCorrMap(mCalibObjects.mFastTransform.get()); // just to reserve the space
113 mCalibObjects.mFastTransformHelper->setCorrMapRef(mCalibObjects.mFastTransformRef.get());
114 mCalibObjects.mFastTransformHelper->setLumiScaleType(mSpecConfig.lumiScaleType);
115 mCalibObjects.mFastTransformHelper->setCorrMapMShape(mCalibObjects.mFastTransformMShape.get());
116 mCalibObjects.mFastTransformHelper->setLumiScaleMode(mSpecConfig.lumiScaleMode);
117 mCalibObjects.mFastTransformHelper->enableMShapeCorrection(mSpecConfig.enableMShape);
118 if (mSpecConfig.outputTracks) {
119 mCalibObjects.mFastTransformHelper->init(ic);
120 }
121 if (mConfParam->dEdxDisableTopologyPol) {
122 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB");
123 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
124 }
125
126 if (mConfParam->dEdxDisableThresholdMap) {
127 LOGP(info, "Disabling loading of threshold map from CCDB");
128 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalThresholdMap);
129 }
130
131 if (mConfParam->dEdxDisableGainMap) {
132 LOGP(info, "Disabling loading of gain map from CCDB");
133 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap);
134 }
135
136 if (mConfParam->dEdxDisableResidualGainMap) {
137 LOGP(info, "Disabling loading of residual gain map from CCDB");
138 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalResidualGainMap);
139 }
140
141 if (mConfParam->dEdxDisableResidualGain) {
142 LOGP(info, "Disabling loading of residual gain calibration from CCDB");
143 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain);
144 }
145
146 if (mConfParam->dEdxUseFullGainMap) {
147 LOGP(info, "Using the full gain map for correcting the cluster charge during calculation of the dE/dx");
148 mCalibObjects.mdEdxCalibContainer->setUsageOfFullGainMap(true);
149 }
150
151 if (mConfParam->gainCalibDisableCCDB) {
152 LOGP(info, "Disabling loading the TPC pad gain calibration from the CCDB");
153 mUpdateGainMapCCDB = false;
154 }
155
156 // load from file
157 if (!mConfParam->dEdxPolTopologyCorrFile.empty() || !mConfParam->dEdxCorrFile.empty() || !mConfParam->dEdxSplineTopologyCorrFile.empty()) {
158 if (!mConfParam->dEdxPolTopologyCorrFile.empty()) {
159 LOGP(info, "Loading dE/dx polynomial track topology correction from file: {}", mConfParam->dEdxPolTopologyCorrFile);
160 mCalibObjects.mdEdxCalibContainer->loadPolTopologyCorrectionFromFile(mConfParam->dEdxPolTopologyCorrFile);
161
162 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB as it was already loaded from input file");
163 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
164
165 if (std::filesystem::exists(mConfParam->thresholdCalibFile)) {
166 LOG(info) << "Loading tpc zero supression map from file " << mConfParam->thresholdCalibFile;
167 const auto* thresholdMap = o2::tpc::utils::readCalPads(mConfParam->thresholdCalibFile, "ThresholdMap")[0];
168 mCalibObjects.mdEdxCalibContainer->setZeroSupresssionThreshold(*thresholdMap);
169
170 LOGP(info, "Disabling loading of threshold map from CCDB as it was already loaded from input file");
171 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalThresholdMap);
172 } else {
173 if (not mConfParam->thresholdCalibFile.empty()) {
174 LOG(warn) << "Couldn't find tpc zero supression file " << mConfParam->thresholdCalibFile << ". Not setting any zero supression.";
175 }
176 LOG(info) << "Setting default zero supression map";
177 mCalibObjects.mdEdxCalibContainer->setDefaultZeroSupresssionThreshold();
178 }
179 } else if (!mConfParam->dEdxSplineTopologyCorrFile.empty()) {
180 LOGP(info, "Loading dE/dx spline track topology correction from file: {}", mConfParam->dEdxSplineTopologyCorrFile);
181 mCalibObjects.mdEdxCalibContainer->loadSplineTopologyCorrectionFromFile(mConfParam->dEdxSplineTopologyCorrFile);
182
183 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB as splines were loaded from input file");
184 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
185 }
186 if (!mConfParam->dEdxCorrFile.empty()) {
187 LOGP(info, "Loading dEdx correction from file: {}", mConfParam->dEdxCorrFile);
188 mCalibObjects.mdEdxCalibContainer->loadResidualCorrectionFromFile(mConfParam->dEdxCorrFile);
189
190 LOGP(info, "Disabling loading of residual gain calibration from CCDB as it was already loaded from input file");
191 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain);
192 }
193 }
194
195 if (mConfParam->dEdxPolTopologyCorrFile.empty() && mConfParam->dEdxSplineTopologyCorrFile.empty()) {
196 // setting default topology correction to allocate enough memory
197 LOG(info) << "Setting default dE/dx polynomial track topology correction to allocate enough memory";
198 mCalibObjects.mdEdxCalibContainer->setDefaultPolTopologyCorrection();
199 }
200
201 GPUO2InterfaceConfiguration& config = *mConfig.get();
202 mConfig->configCalib.dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
203
204 if (std::filesystem::exists(mConfParam->gainCalibFile)) {
205 LOG(info) << "Loading tpc gain correction from file " << mConfParam->gainCalibFile;
206 const auto* gainMap = o2::tpc::utils::readCalPads(mConfParam->gainCalibFile, "GainMap")[0];
207 mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalib(*gainMap);
208
209 LOGP(info, "Disabling loading the TPC gain correction map from the CCDB as it was already loaded from input file");
210 mUpdateGainMapCCDB = false;
211 } else {
212 if (not mConfParam->gainCalibFile.empty()) {
213 LOG(warn) << "Couldn't find tpc gain correction file " << mConfParam->gainCalibFile << ". Not applying any gain correction.";
214 }
215 mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalibDefault();
216 mCalibObjects.mTPCPadGainCalib->getGainCorrection(30, 5, 5);
217 }
218 mConfig->configCalib.tpcPadGain = mCalibObjects.mTPCPadGainCalib.get();
219
220 mTPCZSLinkMapping.reset(new TPCZSLinkMapping{tpc::Mapper::instance()});
221 mConfig->configCalib.tpcZSLinkMapping = mTPCZSLinkMapping.get();
222}
223
224void GPURecoWorkflowSpec::finaliseCCDBTPC(ConcreteDataMatcher& matcher, void* obj)
225{
226 const o2::tpc::CalibdEdxContainer* dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
227
228 auto copyCalibsToBuffer = [this, dEdxCalibContainer]() {
229 if (!(mdEdxCalibContainerBufferNew)) {
230 mdEdxCalibContainerBufferNew = std::make_unique<o2::tpc::CalibdEdxContainer>();
231 mdEdxCalibContainerBufferNew->cloneFromObject(*dEdxCalibContainer, nullptr);
232 }
233 };
234
235 if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADGAINFULL", 0)) {
236 LOGP(info, "Updating gain map from CCDB");
237 const auto* gainMap = static_cast<o2::tpc::CalDet<float>*>(obj);
238
239 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap) && mSpecConfig.outputTracks) {
240 copyCalibsToBuffer();
241 const float minGain = 0;
242 const float maxGain = 2;
243 mdEdxCalibContainerBufferNew.get()->setGainMap(*gainMap, minGain, maxGain);
244 }
245
246 if (mUpdateGainMapCCDB && mSpecConfig.caClusterer) {
247 mTPCPadGainCalibBufferNew = GPUO2InterfaceUtils::getPadGainCalib(*gainMap);
248 }
249
250 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADGAINRESIDUAL", 0)) {
251 LOGP(info, "Updating residual gain map from CCDB");
252 copyCalibsToBuffer();
253 const auto* gainMapResidual = static_cast<std::unordered_map<string, o2::tpc::CalDet<float>>*>(obj);
254 const float minResidualGain = 0.7f;
255 const float maxResidualGain = 1.3f;
256 mdEdxCalibContainerBufferNew.get()->setGainMapResidual(gainMapResidual->at("GainMap"), minResidualGain, maxResidualGain);
257 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADTHRESHOLD", 0)) {
258 LOGP(info, "Updating threshold map from CCDB");
259 copyCalibsToBuffer();
260 const auto* thresholdMap = static_cast<std::unordered_map<string, o2::tpc::CalDet<float>>*>(obj);
261 mdEdxCalibContainerBufferNew.get()->setZeroSupresssionThreshold(thresholdMap->at("ThresholdMap"));
262 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TOPOLOGYGAIN", 0) && !(dEdxCalibContainer->isTopologyCorrectionSplinesSet())) {
263 LOGP(info, "Updating Q topology correction from CCDB");
264 copyCalibsToBuffer();
265 const auto* topologyCorr = static_cast<o2::tpc::CalibdEdxTrackTopologyPolContainer*>(obj);
266 o2::tpc::CalibdEdxTrackTopologyPol calibTrackTopology;
267 calibTrackTopology.setFromContainer(*topologyCorr);
268 mdEdxCalibContainerBufferNew->setPolTopologyCorrection(calibTrackTopology);
269 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TIMEGAIN", 0)) {
270 LOGP(info, "Updating residual gain correction from CCDB");
271 copyCalibsToBuffer();
272 const auto* residualCorr = static_cast<o2::tpc::CalibdEdxCorrection*>(obj);
273 mdEdxCalibContainerBufferNew->setResidualCorrection(*residualCorr);
274 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "IDCPADFLAGS", 0)) {
275 copyCalibsToBuffer();
276 const auto* padFlags = static_cast<o2::tpc::CalDet<o2::tpc::PadFlags>*>(obj);
277 mTPCDeadChannelMapCreator->setDeadChannelMapIDCPadStatus(*padFlags);
278 mTPCDeadChannelMapCreator->finalizeDeadChannelMap();
279 mdEdxCalibContainerBufferNew.get()->setDeadChannelMap(mTPCDeadChannelMapCreator->getDeadChannelMap());
280 LOGP(info, "Updating dead channel map with IDC pad flags: {} / {} dead pads from pad flags / total",
281 mTPCDeadChannelMapCreator->getDeadChannelMapIDC().getSum<int32_t>(), mTPCDeadChannelMapCreator->getDeadChannelMap().getSum<int32_t>());
282 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TPCRUNINFO", 0)) {
283 copyCalibsToBuffer();
284 const auto* fee = static_cast<o2::tpc::FEEConfig*>(obj);
285 mTPCDeadChannelMapCreator->setDeadChannelMapFEEConfig(*fee);
286 mTPCDeadChannelMapCreator->finalizeDeadChannelMap();
287 mdEdxCalibContainerBufferNew.get()->setDeadChannelMap(mTPCDeadChannelMapCreator->getDeadChannelMap());
288 LOGP(info,
289 "Updating dead channel map with the FEE info (tag {}) loaded via TPCRUNINFO"
290 " for creation time {}: {} / {} dead pads from FEE info / total, with",
291 std::underlying_type_t<o2::tpc::FEEConfig::Tags>(fee->tag), mCreationForCalib,
292 mTPCDeadChannelMapCreator->getDeadChannelMapFEE().getSum<int32_t>(), mTPCDeadChannelMapCreator->getDeadChannelMap().getSum<int32_t>());
293 } else if (mTPCVDriftHelper->accountCCDBInputs(matcher, obj)) {
294 } else if (mCalibObjects.mFastTransformHelper->accountCCDBInputs(matcher, obj)) {
295 }
296}
297
298template <>
299bool GPURecoWorkflowSpec::fetchCalibsCCDBTPC<GPUCalibObjectsConst>(ProcessingContext& pc, GPUCalibObjectsConst& newCalibObjects, calibObjectStruct& oldCalibObjects)
300{
301 // update calibrations for clustering and tracking
302 mCreationForCalib = pc.services().get<o2::framework::TimingInfo>().creation;
303 bool mustUpdate = false;
304 if ((mSpecConfig.outputTracks || mSpecConfig.caClusterer) && !mConfParam->disableCalibUpdates) {
305 const o2::tpc::CalibdEdxContainer* dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
306
307 // this calibration is defined for clustering and tracking
308 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap) || mUpdateGainMapCCDB) {
309 pc.inputs().get<o2::tpc::CalDet<float>*>("tpcgain");
310 }
311
312 if (mSpecConfig.outputTracks || mSpecConfig.caClusterer) {
313 mTPCCutAtTimeBin = mConfParam->overrideTPCTimeBinCur > 0 ? mConfParam->overrideTPCTimeBinCur : pc.inputs().get<o2::tpc::AltroSyncSignal*>("tpcaltrosync")->getTB2Cut(pc.services().get<o2::framework::TimingInfo>().tfCounter);
314 }
315
316 // these calibrations are only defined for the tracking
317 if (mSpecConfig.outputTracks) {
318 // update the calibration objects in case they changed in the CCDB
320 pc.inputs().get<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>("tpcthreshold");
321 }
322
323 if (mTPCDeadChannelMapCreator->useSource(tpc::SourcesDeadMap::IDCPadStatus)) {
324 pc.inputs().get<o2::tpc::CalDet<tpc::PadFlags>*>("tpcidcpadflags");
325 }
326
327 if (mTPCDeadChannelMapCreator->useSource(tpc::SourcesDeadMap::FEEConfig)) {
328 pc.inputs().get<o2::tpc::FEEConfig*>("tpcruninfo");
329 }
330
332 pc.inputs().get<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>("tpcgainresidual");
333 }
334
335 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol)) {
337 }
338
339 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain)) {
340 pc.inputs().get<o2::tpc::CalibdEdxCorrection*>("tpctimegain");
341 }
342
343 if (mSpecConfig.outputTracks) {
344 mTPCVDriftHelper->extractCCDBInputs(pc);
345 mCalibObjects.mFastTransformHelper->extractCCDBInputs(pc);
346 }
347 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdated()) {
348 const auto& vd = mTPCVDriftHelper->getVDriftObject();
349 LOGP(info, "Updating{}TPC fast transform map and/or VDrift factor of {} wrt reference {} and TDrift offset {} wrt reference {} from source {}",
350 mCalibObjects.mFastTransformHelper->isUpdated() ? " new " : " old ",
351 vd.corrFact, vd.refVDrift, vd.timeOffsetCorr, vd.refTimeOffset, mTPCVDriftHelper->getSourceName());
352
353 bool mustUpdateHelper = false;
354 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMap()) {
355 oldCalibObjects.mFastTransform = std::move(mCalibObjects.mFastTransform);
356 mCalibObjects.mFastTransform.reset(new TPCFastTransform);
357 mCalibObjects.mFastTransform->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMap(), nullptr);
358 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransform, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
359 newCalibObjects.fastTransform = mCalibObjects.mFastTransform.get();
360 mustUpdateHelper = true;
361 }
362 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMapRef()) {
363 oldCalibObjects.mFastTransformRef = std::move(mCalibObjects.mFastTransformRef);
364 mCalibObjects.mFastTransformRef.reset(new TPCFastTransform);
365 mCalibObjects.mFastTransformRef->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMapRef(), nullptr);
366 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransformRef, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
367 newCalibObjects.fastTransformRef = mCalibObjects.mFastTransformRef.get();
368 mustUpdateHelper = true;
369 }
370 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMapMShape()) {
371 oldCalibObjects.mFastTransformMShape = std::move(mCalibObjects.mFastTransformMShape);
372 mCalibObjects.mFastTransformMShape.reset(new TPCFastTransform);
373 mCalibObjects.mFastTransformMShape->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMapMShape(), nullptr);
374 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransformMShape, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
375 newCalibObjects.fastTransformMShape = mCalibObjects.mFastTransformMShape.get();
376 mustUpdateHelper = true;
377 }
378 if (mustUpdateHelper || mCalibObjects.mFastTransformHelper->isUpdatedLumi()) {
379 oldCalibObjects.mFastTransformHelper = std::move(mCalibObjects.mFastTransformHelper);
380 mCalibObjects.mFastTransformHelper.reset(new o2::tpc::CorrectionMapsLoader);
381 mCalibObjects.mFastTransformHelper->copySettings(*oldCalibObjects.mFastTransformHelper);
382 mCalibObjects.mFastTransformHelper->setCorrMap(mCalibObjects.mFastTransform.get());
383 mCalibObjects.mFastTransformHelper->setCorrMapRef(mCalibObjects.mFastTransformRef.get());
384 mCalibObjects.mFastTransformHelper->setCorrMapMShape(mCalibObjects.mFastTransformMShape.get());
385 mCalibObjects.mFastTransformHelper->acknowledgeUpdate();
386 newCalibObjects.fastTransformHelper = mCalibObjects.mFastTransformHelper.get();
387 }
388 mustUpdate = true;
389 mTPCVDriftHelper->acknowledgeUpdate();
390 mCalibObjects.mFastTransformHelper->acknowledgeUpdate();
391 }
392 }
393
394 if (mdEdxCalibContainerBufferNew) {
395 oldCalibObjects.mdEdxCalibContainer = std::move(mCalibObjects.mdEdxCalibContainer);
396 mCalibObjects.mdEdxCalibContainer = std::move(mdEdxCalibContainerBufferNew);
397 newCalibObjects.dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
398 mustUpdate = true;
399 }
400
401 if (mTPCPadGainCalibBufferNew) {
402 oldCalibObjects.mTPCPadGainCalib = std::move(mCalibObjects.mTPCPadGainCalib);
403 mCalibObjects.mTPCPadGainCalib = std::move(mTPCPadGainCalibBufferNew);
404 newCalibObjects.tpcPadGain = mCalibObjects.mTPCPadGainCalib.get();
405 mustUpdate = true;
406 }
407 }
408 return mustUpdate;
409}
410
411void GPURecoWorkflowSpec::doTrackTuneTPC(GPUTrackingInOutPointers& ptrs, char* buffout)
412{
414 const auto& trackTune = TrackTunePar::Instance();
415 if (ptrs.nOutputTracksTPCO2 && trackTune.sourceLevelTPC &&
416 (trackTune.useTPCInnerCorr || trackTune.useTPCOuterCorr ||
417 trackTune.tpcCovInnerType != TrackTunePar::AddCovType::Disable || trackTune.tpcCovOuterType != TrackTunePar::AddCovType::Disable)) {
418 if (((const void*)ptrs.outputTracksTPCO2) != ((const void*)buffout)) {
419 throw std::runtime_error("Buffer does not match span");
420 }
421 o2::tpc::TrackTPC* tpcTracks = reinterpret_cast<o2::tpc::TrackTPC*>(buffout);
422 float scale = mCalibObjects.mFastTransformHelper->getInstLumiCTP();
423 if (scale < 0.f) {
424 scale = 0.f;
425 }
426 auto diagInner = trackTune.getCovInnerTotal(scale);
427 auto diagOuter = trackTune.getCovOuterTotal(scale);
428
429 for (uint32_t itr = 0; itr < ptrs.nOutputTracksTPCO2; itr++) {
430 auto& trc = tpcTracks[itr];
431 if (trackTune.useTPCInnerCorr) {
432 trc.updateParams(trackTune.tpcParInner);
433 }
434 if (trackTune.tpcCovInnerType != TrackTunePar::AddCovType::Disable) {
435 trc.updateCov(diagInner, trackTune.tpcCovInnerType == TrackTunePar::AddCovType::WithCorrelations);
436 }
437 if (trackTune.useTPCOuterCorr) {
438 trc.getParamOut().updateParams(trackTune.tpcParOuter);
439 }
440 if (trackTune.tpcCovOuterType != TrackTunePar::AddCovType::Disable) {
441 trc.getParamOut().updateCov(diagOuter, trackTune.tpcCovOuterType == TrackTunePar::AddCovType::WithCorrelations);
442 }
443 }
444 }
445}
446
447} // namespace o2::gpu
Definition of the timebin from which syncronization starts.
Simple interface to the CDB manager.
Definition of container class for dE/dx corrections.
Class of a TPC cluster in TPC-native coordinates (row, time)
Container to store compressed TPC cluster data.
A const (ready only) version of MCTruthContainer.
Helper class to access correction maps.
Helper class to access load maps from CCDB.
Wrapper container for different reconstructed object types.
Definition of the TPC Digit.
Helper class for memory management of TPC Data Formats, external from the actual data type classes to...
Definition of class for writing debug informations.
Definition of the GeometryManager class.
Helper for geometry and GRP related CCDB requests.
This file provides the structs for storing the factorized IDC values and fourier coefficients to be s...
A helper class to iteratate over all parts of all input routes.
Declarations for the wrapper for the set of cylindrical material layers.
Definition of the Names Generator class.
Utilities for parsing of data sequences.
Type wrappers for enfording a specific serialization method.
class to create TPC fast transformation
Definition of TPCFastTransform class.
Wrapper class for TPC CA Tracker algorithm.
Configurable params for tracks ad hoc tuning.
Helper class to extract VDrift from different sources.
Helper class to obtain TPC clusters / digits / labels from DPL.
Definitions of TPC Zero Suppression Data Headers.
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
static std::unique_ptr< TPCPadGainCalib > getPadGainCalibDefault()
static std::unique_ptr< TPCPadGainCalib > getPadGainCalib(const o2::tpc::CalDet< float > &in)
bool isCorrectionCCDB(const CalibsdEdx calib) const
bool isTopologyCorrectionSplinesSet() const
returns status if the spline correction is set
calibration class for the track topology correction of the dE/dx using multvariate polynomials
void setFromContainer(const CalibdEdxTrackTopologyPolContainer &container)
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
int updateCalibration(TPCFastTransform &transform, Long_t TimeStamp, float vDriftFactor=1.f, float vDriftRef=0.f, float driftTimeOffset=0.f)
Updates the transformation with the new time stamp.
static TPCFastTransformHelperO2 * instance()
Singleton.
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
ConcreteParserVariants< PageSize, BOUNDS_CHECKS > create(T const *buffer, size_t size)
create a raw parser depending on version of RAWDataHeader found at beginning of data
Definition RawParser.h:378
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
std::vector< CalPad * > readCalPads(const std::string_view fileName, const std::vector< std::string > &calPadNames)
Definition Utils.cxx:190
@ CalTimeGain
flag for residual dE/dx time dependent gain correction
@ CalTopologyPol
flag for a topology correction using polynomials
@ CalResidualGainMap
flag for applying residual gain map
@ CalThresholdMap
flag for using threshold map
@ CalGainMap
flag for using the gain map to get the correct cluster charge
@ FEEConfig
use fee config
@ IDCPadStatus
use idc pad status map
S< o2::tpc::CalibdEdxContainer >::type * dEdxCalibContainer
S< TPCFastTransform >::type * fastTransform
S< TPCPadGainCalib >::type * tpcPadGain
S< CorrectionMapsHelper >::type * fastTransformHelper
S< TPCFastTransform >::type * fastTransformRef
S< TPCFastTransform >::type * fastTransformMShape
const o2::tpc::TrackTPC * outputTracksTPCO2
simple struct to enable writing the MultivariatePolynomialCT to file
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"