Project
Loading...
Searching...
No Matches
TPCTrackingDigitsPreCheck.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
21
22#include "GPUO2ExternalUser.h"
24#include "TPCBase/Sector.h"
25#include "Framework/Logger.h"
26
27#include <atomic>
28#include <optional>
29#ifdef WITH_OPENMP
30#include <omp.h>
31#endif
32
33using namespace o2::gpu;
34using namespace o2::tpc;
35using namespace o2;
36using namespace o2::dataformats;
37
40TPCTrackingDigitsPreCheck::precheckModifiedData::precheckModifiedData(std::unique_ptr<precheckModifiedDataInternal>&& v) : data(std::move(v)) {}
41
49
51{
52 if (ptrs->tpcPackedDigits) {
53 std::unique_ptr<precheckModifiedDataInternal> retVal = std::make_unique<precheckModifiedDataInternal>();
54 retVal->tpcDigitsMap = *ptrs->tpcPackedDigits;
55 const float zsThreshold = config->configReconstruction.tpc.zsThreshold;
56 const int maxContTimeBin = config->configGRP.grpContinuousMaxTimeBin;
57 static bool filterOutOfTF = getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF") && atoi(getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF"));
58 bool updateDigits = (zsThreshold > 0 || filterOutOfTF) && ptrs->tpcZS == nullptr;
59 const auto& d = ptrs->tpcPackedDigits;
60 for (int i = 0; i < Sector::MAXSECTOR; i++) {
61 if (updateDigits) {
62 retVal->gpuDigits[i].reserve(d->nTPCDigits[i]);
63 }
64 int lastTime = 0;
65 for (int j = 0; j < d->nTPCDigits[i]; j++) {
66 int timeBin = d->tpcDigits[i][j].getTimeStamp();
67 if (maxContTimeBin && timeBin >= maxContTimeBin) {
68 if (filterOutOfTF) {
69 continue;
70 }
71 throw std::runtime_error("Digit time bin exceeds time frame length");
72 }
73 if (timeBin < lastTime) {
74 LOG(fatal) << "Incorrect digit ordering: time[" << i << "][" << j << "] = " << timeBin << " < lastTime = " << lastTime;
75 }
76 lastTime = timeBin;
77 if (updateDigits) {
78 if (d->tpcDigits[i][j].getChargeFloat() >= zsThreshold) {
79 if (d->tpcDigitsMC) {
80 for (const auto& element : d->tpcDigitsMC->v[i]->getLabels(j)) {
81 retVal->gpuDigitsMC[i].addElement(retVal->gpuDigits[i].size(), element);
82 }
83 }
84 retVal->gpuDigits[i].emplace_back(d->tpcDigits[i][j]);
85 }
86 }
87 }
88 if (updateDigits) {
89 retVal->tpcDigitsMap.tpcDigits[i] = retVal->gpuDigits[i].data();
90 retVal->tpcDigitsMap.nTPCDigits[i] = retVal->gpuDigits[i].size();
91 if (ptrs->tpcPackedDigits->tpcDigitsMC) {
92 retVal->gpuDigitsMC[i].flatten_to(retVal->gpuDigitsMCConst[i].first);
93 retVal->gpuDigitsMCConst[i].second = retVal->gpuDigitsMCConst[i].first;
94 retVal->tpcDigitsMapMC.v[i] = &retVal->gpuDigitsMCConst[i].second;
95 }
96 }
97 }
98 if (updateDigits) {
99 if (ptrs->tpcPackedDigits->tpcDigitsMC) {
100 retVal->tpcDigitsMap.tpcDigitsMC = &retVal->tpcDigitsMapMC;
101 }
102 ptrs->tpcPackedDigits = &retVal->tpcDigitsMap;
103 }
104 return precheckModifiedData(std::move(retVal));
105 }
106 return precheckModifiedData();
107}
Class of a TPC cluster in TPC-native coordinates (row, time)
A const (ready only) version of MCTruthContainer.
Definition of the TPC Digit.
atype::type element
int32_t i
int32_t lastTime
int32_t retVal
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
uint32_t j
Definition RawData.h:0
Wrapper class for TPC CA Tracker algorithm.
A container to hold and manage MC truth information/labels.
static constexpr int MAXSECTOR
Definition Sector.h:44
static precheckModifiedData runPrecheck(o2::gpu::GPUTrackingInOutPointers *ptrs, o2::gpu::GPUO2InterfaceConfiguration *config)
const GLdouble * v
Definition glcorearb.h:832
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
Global TPC definitions and constants.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
const GPUTPCDigitsMCInput * tpcDigitsMC
const GPUTrackingInOutZS * tpcZS
const GPUTrackingInOutDigits * tpcPackedDigits
std::pair< ConstMCLabelContainer, ConstMCLabelContainerView > ConstMCLabelContainerViewWithBuffer
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"