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->setCheckCTPIDCConsistency(mSpecConfig.checkCTPIDCconsistency);
118 mCalibObjects.mFastTransformHelper->enableMShapeCorrection(mSpecConfig.enableMShape);
119 if (mSpecConfig.outputTracks) {
120 mCalibObjects.mFastTransformHelper->init(ic);
121 }
122 if (mConfParam->dEdxDisableTopologyPol) {
123 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB");
124 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
125 }
126
127 if (mConfParam->dEdxDisableThresholdMap) {
128 LOGP(info, "Disabling loading of threshold map from CCDB");
129 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalThresholdMap);
130 }
131
132 if (mConfParam->dEdxDisableGainMap) {
133 LOGP(info, "Disabling loading of gain map from CCDB");
134 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap);
135 }
136
137 if (mConfParam->dEdxDisableResidualGainMap) {
138 LOGP(info, "Disabling loading of residual gain map from CCDB");
139 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalResidualGainMap);
140 }
141
142 if (mConfParam->dEdxDisableResidualGain) {
143 LOGP(info, "Disabling loading of residual gain calibration from CCDB");
144 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain);
145 }
146
147 if (mConfParam->dEdxUseFullGainMap) {
148 LOGP(info, "Using the full gain map for correcting the cluster charge during calculation of the dE/dx");
149 mCalibObjects.mdEdxCalibContainer->setUsageOfFullGainMap(true);
150 }
151
152 if (mConfParam->gainCalibDisableCCDB) {
153 LOGP(info, "Disabling loading the TPC pad gain calibration from the CCDB");
154 mUpdateGainMapCCDB = false;
155 }
156
157 // load from file
158 if (!mConfParam->dEdxPolTopologyCorrFile.empty() || !mConfParam->dEdxCorrFile.empty() || !mConfParam->dEdxSplineTopologyCorrFile.empty()) {
159 if (!mConfParam->dEdxPolTopologyCorrFile.empty()) {
160 LOGP(info, "Loading dE/dx polynomial track topology correction from file: {}", mConfParam->dEdxPolTopologyCorrFile);
161 mCalibObjects.mdEdxCalibContainer->loadPolTopologyCorrectionFromFile(mConfParam->dEdxPolTopologyCorrFile);
162
163 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB as it was already loaded from input file");
164 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
165
166 if (std::filesystem::exists(mConfParam->thresholdCalibFile)) {
167 LOG(info) << "Loading tpc zero supression map from file " << mConfParam->thresholdCalibFile;
168 const auto* thresholdMap = o2::tpc::utils::readCalPads(mConfParam->thresholdCalibFile, "ThresholdMap")[0];
169 mCalibObjects.mdEdxCalibContainer->setZeroSupresssionThreshold(*thresholdMap);
170
171 LOGP(info, "Disabling loading of threshold map from CCDB as it was already loaded from input file");
172 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalThresholdMap);
173 } else {
174 if (not mConfParam->thresholdCalibFile.empty()) {
175 LOG(warn) << "Couldn't find tpc zero supression file " << mConfParam->thresholdCalibFile << ". Not setting any zero supression.";
176 }
177 LOG(info) << "Setting default zero supression map";
178 mCalibObjects.mdEdxCalibContainer->setDefaultZeroSupresssionThreshold();
179 }
180 } else if (!mConfParam->dEdxSplineTopologyCorrFile.empty()) {
181 LOGP(info, "Loading dE/dx spline track topology correction from file: {}", mConfParam->dEdxSplineTopologyCorrFile);
182 mCalibObjects.mdEdxCalibContainer->loadSplineTopologyCorrectionFromFile(mConfParam->dEdxSplineTopologyCorrFile);
183
184 LOGP(info, "Disabling loading of track topology correction using polynomials from CCDB as splines were loaded from input file");
185 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol);
186 }
187 if (!mConfParam->dEdxCorrFile.empty()) {
188 LOGP(info, "Loading dEdx correction from file: {}", mConfParam->dEdxCorrFile);
189 mCalibObjects.mdEdxCalibContainer->loadResidualCorrectionFromFile(mConfParam->dEdxCorrFile);
190
191 LOGP(info, "Disabling loading of residual gain calibration from CCDB as it was already loaded from input file");
192 mCalibObjects.mdEdxCalibContainer->disableCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain);
193 }
194 }
195
196 if (mConfParam->dEdxPolTopologyCorrFile.empty() && mConfParam->dEdxSplineTopologyCorrFile.empty()) {
197 // setting default topology correction to allocate enough memory
198 LOG(info) << "Setting default dE/dx polynomial track topology correction to allocate enough memory";
199 mCalibObjects.mdEdxCalibContainer->setDefaultPolTopologyCorrection();
200 }
201
202 GPUO2InterfaceConfiguration& config = *mConfig.get();
203 mConfig->configCalib.dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
204
205 if (std::filesystem::exists(mConfParam->gainCalibFile)) {
206 LOG(info) << "Loading tpc gain correction from file " << mConfParam->gainCalibFile;
207 const auto* gainMap = o2::tpc::utils::readCalPads(mConfParam->gainCalibFile, "GainMap")[0];
208 mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalib(*gainMap);
209
210 LOGP(info, "Disabling loading the TPC gain correction map from the CCDB as it was already loaded from input file");
211 mUpdateGainMapCCDB = false;
212 } else {
213 if (not mConfParam->gainCalibFile.empty()) {
214 LOG(warn) << "Couldn't find tpc gain correction file " << mConfParam->gainCalibFile << ". Not applying any gain correction.";
215 }
216 mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalibDefault();
217 mCalibObjects.mTPCPadGainCalib->getGainCorrection(30, 5, 5);
218 }
219 mConfig->configCalib.tpcPadGain = mCalibObjects.mTPCPadGainCalib.get();
220
221 mTPCZSLinkMapping.reset(new TPCZSLinkMapping{tpc::Mapper::instance()});
222 mConfig->configCalib.tpcZSLinkMapping = mTPCZSLinkMapping.get();
223}
224
225void GPURecoWorkflowSpec::finaliseCCDBTPC(ConcreteDataMatcher& matcher, void* obj)
226{
227 const o2::tpc::CalibdEdxContainer* dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
228
229 auto copyCalibsToBuffer = [this, dEdxCalibContainer]() {
230 if (!(mdEdxCalibContainerBufferNew)) {
231 mdEdxCalibContainerBufferNew = std::make_unique<o2::tpc::CalibdEdxContainer>();
232 mdEdxCalibContainerBufferNew->cloneFromObject(*dEdxCalibContainer, nullptr);
233 }
234 };
235
236 if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADGAINFULL", 0)) {
237 LOGP(info, "Updating gain map from CCDB");
238 const auto* gainMap = static_cast<o2::tpc::CalDet<float>*>(obj);
239
240 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap) && mSpecConfig.outputTracks) {
241 copyCalibsToBuffer();
242 const float minGain = 0;
243 const float maxGain = 2;
244 mdEdxCalibContainerBufferNew.get()->setGainMap(*gainMap, minGain, maxGain);
245 }
246
247 if (mUpdateGainMapCCDB && mSpecConfig.caClusterer) {
248 mTPCPadGainCalibBufferNew = GPUO2InterfaceUtils::getPadGainCalib(*gainMap);
249 }
250
251 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADGAINRESIDUAL", 0)) {
252 LOGP(info, "Updating residual gain map from CCDB");
253 copyCalibsToBuffer();
254 const auto* gainMapResidual = static_cast<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>(obj);
255 const float minResidualGain = 0.7f;
256 const float maxResidualGain = 1.3f;
257 mdEdxCalibContainerBufferNew.get()->setGainMapResidual(gainMapResidual->at("GainMap"), minResidualGain, maxResidualGain);
258 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADTHRESHOLD", 0)) {
259 LOGP(info, "Updating threshold map from CCDB");
260 copyCalibsToBuffer();
261 const auto* thresholdMap = static_cast<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>(obj);
262 mdEdxCalibContainerBufferNew.get()->setZeroSupresssionThreshold(thresholdMap->at("ThresholdMap"));
263 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TOPOLOGYGAIN", 0) && !(dEdxCalibContainer->isTopologyCorrectionSplinesSet())) {
264 LOGP(info, "Updating Q topology correction from CCDB");
265 copyCalibsToBuffer();
266 const auto* topologyCorr = static_cast<o2::tpc::CalibdEdxTrackTopologyPolContainer*>(obj);
267 o2::tpc::CalibdEdxTrackTopologyPol calibTrackTopology;
268 calibTrackTopology.setFromContainer(*topologyCorr);
269 mdEdxCalibContainerBufferNew->setPolTopologyCorrection(calibTrackTopology);
270 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TIMEGAIN", 0)) {
271 LOGP(info, "Updating residual gain correction from CCDB");
272 copyCalibsToBuffer();
273 const auto* residualCorr = static_cast<o2::tpc::CalibdEdxCorrection*>(obj);
274 mdEdxCalibContainerBufferNew->setResidualCorrection(*residualCorr);
275 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "IDCPADFLAGS", 0)) {
276 copyCalibsToBuffer();
277 const auto* padFlags = static_cast<o2::tpc::CalDet<o2::tpc::PadFlags>*>(obj);
278 mTPCDeadChannelMapCreator->setDeadChannelMapIDCPadStatus(*padFlags);
279 mTPCDeadChannelMapCreator->finalizeDeadChannelMap();
280 mdEdxCalibContainerBufferNew.get()->setDeadChannelMap(mTPCDeadChannelMapCreator->getDeadChannelMap());
281 LOGP(info, "Updating dead channel map with IDC pad flags: {} / {} dead pads from pad flags / total",
282 mTPCDeadChannelMapCreator->getDeadChannelMapIDC().getSum<int32_t>(), mTPCDeadChannelMapCreator->getDeadChannelMap().getSum<int32_t>());
283 } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "TPCRUNINFO", 0)) {
284 copyCalibsToBuffer();
285 const auto* fee = static_cast<o2::tpc::FEEConfig*>(obj);
286 mTPCDeadChannelMapCreator->setDeadChannelMapFEEConfig(*fee);
287 mTPCDeadChannelMapCreator->finalizeDeadChannelMap();
288 mdEdxCalibContainerBufferNew.get()->setDeadChannelMap(mTPCDeadChannelMapCreator->getDeadChannelMap());
289 LOGP(info,
290 "Updating dead channel map with the FEE info (tag {}) loaded via TPCRUNINFO"
291 " for creation time {}: {} / {} dead pads from FEE info / total, with",
292 std::underlying_type_t<o2::tpc::FEEConfig::Tags>(fee->tag), mCreationForCalib,
293 mTPCDeadChannelMapCreator->getDeadChannelMapFEE().getSum<int32_t>(), mTPCDeadChannelMapCreator->getDeadChannelMap().getSum<int32_t>());
294 } else if (mTPCVDriftHelper->accountCCDBInputs(matcher, obj)) {
295 } else if (mCalibObjects.mFastTransformHelper->accountCCDBInputs(matcher, obj)) {
296 }
297}
298
299template <>
300bool GPURecoWorkflowSpec::fetchCalibsCCDBTPC<GPUCalibObjectsConst>(ProcessingContext& pc, GPUCalibObjectsConst& newCalibObjects, calibObjectStruct& oldCalibObjects)
301{
302 // update calibrations for clustering and tracking
303 mCreationForCalib = pc.services().get<o2::framework::TimingInfo>().creation;
304 bool mustUpdate = false;
305 if ((mSpecConfig.outputTracks || mSpecConfig.caClusterer) && !mConfParam->disableCalibUpdates) {
306 const o2::tpc::CalibdEdxContainer* dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
307
308 // this calibration is defined for clustering and tracking
309 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalGainMap) || mUpdateGainMapCCDB) {
310 pc.inputs().get<o2::tpc::CalDet<float>*>("tpcgain");
311 }
312
313 if (mSpecConfig.outputTracks || mSpecConfig.caClusterer) {
314 mTPCCutAtTimeBin = mConfParam->overrideTPCTimeBinCur > 0 ? mConfParam->overrideTPCTimeBinCur : pc.inputs().get<o2::tpc::AltroSyncSignal*>("tpcaltrosync")->getTB2Cut(pc.services().get<o2::framework::TimingInfo>().tfCounter);
315 }
316
317 // these calibrations are only defined for the tracking
318 if (mSpecConfig.outputTracks) {
319 // update the calibration objects in case they changed in the CCDB
321 pc.inputs().get<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>("tpcthreshold");
322 }
323
324 if (mTPCDeadChannelMapCreator->useSource(tpc::SourcesDeadMap::IDCPadStatus)) {
325 pc.inputs().get<o2::tpc::CalDet<tpc::PadFlags>*>("tpcidcpadflags");
326 }
327
328 if (mTPCDeadChannelMapCreator->useSource(tpc::SourcesDeadMap::FEEConfig)) {
329 pc.inputs().get<o2::tpc::FEEConfig*>("tpcruninfo");
330 }
331
333 pc.inputs().get<std::unordered_map<std::string, o2::tpc::CalDet<float>>*>("tpcgainresidual");
334 }
335
336 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalTopologyPol)) {
338 }
339
340 if (dEdxCalibContainer->isCorrectionCCDB(o2::tpc::CalibsdEdx::CalTimeGain)) {
341 pc.inputs().get<o2::tpc::CalibdEdxCorrection*>("tpctimegain");
342 }
343
344 if (mSpecConfig.outputTracks) {
345 mTPCVDriftHelper->extractCCDBInputs(pc);
346 mCalibObjects.mFastTransformHelper->extractCCDBInputs(pc);
347 }
348 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdated()) {
349 const auto& vd = mTPCVDriftHelper->getVDriftObject();
350 LOGP(info, "Updating{}TPC fast transform map and/or VDrift factor of {} wrt reference {} and TDrift offset {} wrt reference {} from source {}",
351 mCalibObjects.mFastTransformHelper->isUpdated() ? " new " : " old ",
352 vd.corrFact, vd.refVDrift, vd.timeOffsetCorr, vd.refTimeOffset, mTPCVDriftHelper->getSourceName());
353
354 bool mustUpdateHelper = false;
355 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMap()) {
356 oldCalibObjects.mFastTransform = std::move(mCalibObjects.mFastTransform);
357 mCalibObjects.mFastTransform.reset(new TPCFastTransform);
358 mCalibObjects.mFastTransform->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMap(), nullptr);
359 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransform, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
360 newCalibObjects.fastTransform = mCalibObjects.mFastTransform.get();
361 mustUpdateHelper = true;
362 }
363 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMapRef()) {
364 oldCalibObjects.mFastTransformRef = std::move(mCalibObjects.mFastTransformRef);
365 mCalibObjects.mFastTransformRef.reset(new TPCFastTransform);
366 mCalibObjects.mFastTransformRef->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMapRef(), nullptr);
367 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransformRef, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
368 newCalibObjects.fastTransformRef = mCalibObjects.mFastTransformRef.get();
369 mustUpdateHelper = true;
370 }
371 if (mTPCVDriftHelper->isUpdated() || mCalibObjects.mFastTransformHelper->isUpdatedMapMShape()) {
372 oldCalibObjects.mFastTransformMShape = std::move(mCalibObjects.mFastTransformMShape);
373 mCalibObjects.mFastTransformMShape.reset(new TPCFastTransform);
374 mCalibObjects.mFastTransformMShape->cloneFromObject(*mCalibObjects.mFastTransformHelper->getCorrMapMShape(), nullptr);
375 o2::tpc::TPCFastTransformHelperO2::instance()->updateCalibration(*mCalibObjects.mFastTransformMShape, 0, vd.corrFact, vd.refVDrift, vd.getTimeOffset());
376 newCalibObjects.fastTransformMShape = mCalibObjects.mFastTransformMShape.get();
377 mustUpdateHelper = true;
378 }
379 if (mustUpdateHelper || mCalibObjects.mFastTransformHelper->isUpdatedLumi()) {
380 oldCalibObjects.mFastTransformHelper = std::move(mCalibObjects.mFastTransformHelper);
381 mCalibObjects.mFastTransformHelper.reset(new o2::tpc::CorrectionMapsLoader);
382 mCalibObjects.mFastTransformHelper->copySettings(*oldCalibObjects.mFastTransformHelper);
383 mCalibObjects.mFastTransformHelper->setCorrMap(mCalibObjects.mFastTransform.get());
384 mCalibObjects.mFastTransformHelper->setCorrMapRef(mCalibObjects.mFastTransformRef.get());
385 mCalibObjects.mFastTransformHelper->setCorrMapMShape(mCalibObjects.mFastTransformMShape.get());
386 mCalibObjects.mFastTransformHelper->acknowledgeUpdate();
387 newCalibObjects.fastTransformHelper = mCalibObjects.mFastTransformHelper.get();
388 }
389 mustUpdate = true;
390 mTPCVDriftHelper->acknowledgeUpdate();
391 mCalibObjects.mFastTransformHelper->acknowledgeUpdate();
392 }
393 }
394
395 if (mdEdxCalibContainerBufferNew) {
396 oldCalibObjects.mdEdxCalibContainer = std::move(mCalibObjects.mdEdxCalibContainer);
397 mCalibObjects.mdEdxCalibContainer = std::move(mdEdxCalibContainerBufferNew);
398 newCalibObjects.dEdxCalibContainer = mCalibObjects.mdEdxCalibContainer.get();
399 mustUpdate = true;
400 }
401
402 if (mTPCPadGainCalibBufferNew) {
403 oldCalibObjects.mTPCPadGainCalib = std::move(mCalibObjects.mTPCPadGainCalib);
404 mCalibObjects.mTPCPadGainCalib = std::move(mTPCPadGainCalibBufferNew);
405 newCalibObjects.tpcPadGain = mCalibObjects.mTPCPadGainCalib.get();
406 mustUpdate = true;
407 }
408 }
409 return mustUpdate;
410}
411
412void GPURecoWorkflowSpec::doTrackTuneTPC(GPUTrackingInOutPointers& ptrs, char* buffout)
413{
415 const auto& trackTune = TrackTunePar::Instance();
416 if (ptrs.nOutputTracksTPCO2 && trackTune.sourceLevelTPC &&
417 (trackTune.useTPCInnerCorr || trackTune.useTPCOuterCorr ||
418 trackTune.tpcCovInnerType != TrackTunePar::AddCovType::Disable || trackTune.tpcCovOuterType != TrackTunePar::AddCovType::Disable)) {
419 if (((const void*)ptrs.outputTracksTPCO2) != ((const void*)buffout)) {
420 throw std::runtime_error("Buffer does not match span");
421 }
422 o2::tpc::TrackTPC* tpcTracks = reinterpret_cast<o2::tpc::TrackTPC*>(buffout);
423 float scale = mCalibObjects.mFastTransformHelper->getInstLumiCTP();
424 if (scale < 0.f) {
425 scale = 0.f;
426 }
427 auto diagInner = trackTune.getCovInnerTotal(scale);
428 auto diagOuter = trackTune.getCovOuterTotal(scale);
429
430 for (uint32_t itr = 0; itr < ptrs.nOutputTracksTPCO2; itr++) {
431 auto& trc = tpcTracks[itr];
432 if (trackTune.useTPCInnerCorr) {
433 trc.updateParams(trackTune.tpcParInner);
434 }
435 if (trackTune.tpcCovInnerType != TrackTunePar::AddCovType::Disable) {
436 trc.updateCov(diagInner, trackTune.tpcCovInnerType == TrackTunePar::AddCovType::WithCorrelations);
437 }
438 if (trackTune.useTPCOuterCorr) {
439 trc.getParamOut().updateParams(trackTune.tpcParOuter);
440 }
441 if (trackTune.tpcCovOuterType != TrackTunePar::AddCovType::Disable) {
442 trc.getParamOut().updateCov(diagOuter, trackTune.tpcCovOuterType == TrackTunePar::AddCovType::WithCorrelations);
443 }
444 }
445 }
446}
447
448} // 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"