31 throw std::runtime_error(
"Must provide clusters access and preallocated buffer for shared map");
33 std::unique_ptr<GPUParam> tmpParam;
34 if (
param ==
nullptr) {
36 param = tmpParam.get();
38 if ((
param->rec.tpc.occupancyMapTimeBins ||
param->rec.tpc.sysClusErrorC12Norm) && ocmap && !nHbfPerTf) {
39 throw std::runtime_error(
"Must provide nHbfPerTf for occupancy map");
42 for (uint32_t
i = 0;
i < trks.size();
i++) {
43 for (int32_t
j = 0;
j < trks[
i].getNClusterReferences();
j++) {
45 shmap[idx] = shmap[idx] ? 2 : 1;
48 std::vector<uint32_t> tmp;
49 uint32_t* binmap =
nullptr;
50 if (ocmap && nHbfPerTf) {
51 tmp.resize(
param->rec.tpc.occupancyMapTimeBinsAverage ? GPUTPCClusterOccupancyMapBin::getNBins(*
param) : 0, 0);
52 binmap =
param->rec.tpc.occupancyMapTimeBinsAverage ? tmp.data() : (ocmap + 2);
54 if (
param->rec.tpc.occupancyMapTimeBins) {
55 ocmap[1] =
param->rec.tpc.occupancyMapTimeBins * 0x10000 +
param->rec.tpc.occupancyMapTimeBinsAverage;
66 if (ocmap && nHbfPerTf &&
param->rec.tpc.occupancyMapTimeBinsAverage) {
67 for (uint32_t bin = 0; bin < GPUTPCClusterOccupancyMapBin::getNBins(*
param); bin++) {
68 int32_t binmin = CAMath::Max<int32_t>(0, bin -
param->rec.tpc.occupancyMapTimeBinsAverage);
69 int32_t binmax = CAMath::Min<int32_t>(GPUTPCClusterOccupancyMapBin::getNBins(*
param), bin +
param->rec.tpc.occupancyMapTimeBinsAverage + 1);
71 for (int32_t
i = binmin;
i < binmax;
i++) {
74 sum /= binmax - binmin;
82 std::unique_ptr<GPUParam> tmpParam;
83 if (
param ==
nullptr) {
85 param = tmpParam.get();
87 if ((
param->rec.tpc.occupancyMapTimeBins ||
param->rec.tpc.sysClusErrorC12Norm) && !nHbfPerTf) {
88 throw std::runtime_error(
"nHbfPerTf must not be zero for creation of the occupancy map");
90 if (
param->rec.tpc.occupancyMapTimeBins) {
91 return (GPUTPCClusterOccupancyMapBin::getNBins(*
param) + 2) *
sizeof(uint32_t);
92 }
else if (
param->rec.tpc.sysClusErrorC12Norm) {
93 return sizeof(uint32_t);
104 if (sharedmap ==
nullptr && trks ==
nullptr) {
105 throw std::runtime_error(
"Must provide either shared cluster map or vector of tpc tracks to build the map");
107 if ((sharedmap ==
nullptr) ^ (expectedOccMapSize && occupancymap ==
nullptr)) {
108 throw std::runtime_error(
"Must provide either both shared cluster map and occupancy map or none of them");
110 if (sharedmap ==
nullptr) {
112 sharedmap = mSharedMap.data();
113 mOccupancyMap.resize(expectedOccMapSize /
sizeof(*mOccupancyMap.data()));
114 occupancymap = mOccupancyMap.data();
115 occupancyMapSize = expectedOccMapSize;
121 mRefit = std::make_unique<GPUTrackingRefit>();
122 mRefit->SetGPUParam(mParam.get());
123 mRefit->SetClusterStateArray(sharedmap);
124 mRefit->SetPropagator(p);
125 mRefit->SetClusterNative(cl);
126 mRefit->SetTrackHitReferences(trackRef);
127 mRefit->SetFastTransformHelper(trans);
132 mParam->UpdateBzOnly(bzNominalGPU);
133 mRefit->SetFastTransformHelper(trans);
138int32_t
GPUO2InterfaceRefit::RefitTrackAsGPU(
o2::track::TrackParCov& trk,
const o2::tpc::TrackTPCClusRef& clusRef,
float time0,
float* chi2,
bool outward,
bool resetCov) {
return mRefit->RefitTrackAsGPU(trk, clusRef, time0, chi2, outward, resetCov); }
139int32_t
GPUO2InterfaceRefit::RefitTrackAsTrackParCov(
o2::track::TrackParCov& trk,
const o2::tpc::TrackTPCClusRef& clusRef,
float time0,
float* chi2,
bool outward,
bool resetCov) {
return mRefit->RefitTrackAsTrackParCov(trk, clusRef, time0, chi2, outward, resetCov); }
Class of a TPC cluster in TPC-native coordinates (row, time)
Helper class to access correction maps.
int32_t RefitTrackAsTrackParCov(o2::tpc::TrackTPC &trk, bool outward=false, bool resetCov=false)
static size_t fillOccupancyMapGetSize(uint32_t nHbfPerTf, const GPUParam *param=nullptr)
void setIgnoreErrorsAtTrackEnds(bool v)
GPUO2InterfaceRefit(const o2::tpc::ClusterNativeAccess *cl, const o2::gpu::CorrectionMapsHelper *trans, float bzNominalGPU, const o2::tpc::TPCClRefElem *trackRef, uint32_t nHbfPerTf=0, const uint8_t *sharedmap=nullptr, const uint32_t *occupancymap=nullptr, int32_t occupancyMapSize=-1, const std::vector< o2::tpc::TrackTPC > *trks=nullptr, o2::base::Propagator *p=nullptr)
static void fillSharedClustersAndOccupancyMap(const o2::tpc::ClusterNativeAccess *cl, const gsl::span< const o2::tpc::TrackTPC > trks, const o2::tpc::TPCClRefElem *trackRef, uint8_t *shmap, uint32_t *ocmap=nullptr, uint32_t nHbfPerTf=0, const GPUParam *param=nullptr)
void setTrackReferenceX(float v)
void updateCalib(const o2::gpu::CorrectionMapsHelper *trans, float bzNominalGPU)
int32_t RefitTrackAsGPU(o2::tpc::TrackTPC &trk, bool outward=false, bool resetCov=false)
static void paramUseExternalOccupancyMap(GPUParam *param, uint32_t nHbfPerTf, const uint32_t *occupancymap, int32_t occupancyMapSize)
static std::unique_ptr< GPUParam > getFullParam(float solenoidBz, uint32_t nHbfPerTf=0, std::unique_ptr< GPUO2InterfaceConfiguration > *pConfiguration=nullptr, std::unique_ptr< GPUSettingsO2 > *pO2Settings=nullptr, bool *autoMaxTimeBin=nullptr)
float sum(float s, o2::dcs::DataPointValue v)
Global TPC definitions and constants.
unsigned int nClustersTotal
const ClusterNative * clustersLinear