|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// \file GPUO2InterfaceRefit.cxx |
| 12 | +/// \author David Rohr |
| 13 | + |
| 14 | +#include "GPUO2InterfaceRefit.h" |
| 15 | +#include "DataFormatsTPC/ClusterNative.h" |
| 16 | +#include "DataFormatsTPC/TrackTPC.h" |
| 17 | +#include "GPUParam.h" |
| 18 | +#include "GPUTPCGMMergedTrackHit.h" |
| 19 | + |
| 20 | +using namespace o2::gpu; |
| 21 | +using namespace o2::tpc; |
| 22 | + |
| 23 | +GPUTPCO2InterfaceRefit::GPUTPCO2InterfaceRefit(const o2::tpc::ClusterNativeAccess* cl, const TPCFastTransform* trans, float bz, const TPCClRefElem* trackRef, const unsigned char* sharedmap, std::vector<o2::tpc::TrackTPC>* trks, o2::base::Propagator* p) : mRefit(), mParam(new GPUParam) |
| 24 | +{ |
| 25 | + if (sharedmap == nullptr && trks == nullptr) { |
| 26 | + throw std::runtime_error("Must provide either shared cluster map or vector of tpc tracks to build the map"); |
| 27 | + } |
| 28 | + if (sharedmap == nullptr) { |
| 29 | + mSharedMap.resize(cl->nClustersTotal); |
| 30 | + sharedmap = mSharedMap.data(); |
| 31 | + std::fill(mSharedMap.begin(), mSharedMap.end(), 0); |
| 32 | + for (unsigned int i = 0; i < (*trks).size(); i++) { |
| 33 | + for (unsigned int j = 0; j < (*trks)[i].getNClusterReferences(); j++) { |
| 34 | + size_t idx = &(*trks)[i].getCluster(trackRef, j, *cl) - cl->clustersLinear; |
| 35 | + mSharedMap[idx] = mSharedMap[idx] ? 2 : 1; |
| 36 | + } |
| 37 | + } |
| 38 | + for (unsigned int i = 0; i < cl->nClustersTotal; i++) { |
| 39 | + mSharedMap[i] = (mSharedMap[i] > 1 ? GPUTPCGMMergedTrackHit::flagShared : 0) | cl->clustersLinear[i].getFlags(); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + mParam->SetDefaults(bz); |
| 44 | + mRefit.SetGPUParam(mParam.get()); |
| 45 | + mRefit.SetClusterStateArray(sharedmap); |
| 46 | + mRefit.SetPropagator(p); |
| 47 | + mRefit.SetClusterNative(cl); |
| 48 | + mRefit.SetTrackHitReferences(trackRef); |
| 49 | + mRefit.SetFastTransform(trans); |
| 50 | +} |
| 51 | + |
| 52 | +GPUTPCO2InterfaceRefit::~GPUTPCO2InterfaceRefit() = default; |
0 commit comments