@@ -99,35 +99,26 @@ size_t GPUO2InterfaceRefit::fillOccupancyMapGetSize(unsigned int nHbfPerTf, cons
9999GPUO2InterfaceRefit::GPUO2InterfaceRefit (const ClusterNativeAccess* cl, const CorrectionMapsHelper* trans, float bzNominalGPU, const TPCClRefElem* trackRef, unsigned int nHbfPerTf, const unsigned char * sharedmap, const unsigned int * occupancymap, int occupancyMapSize, const std::vector<TrackTPC>* trks, o2::base::Propagator* p)
100100{
101101 mParam = GPUO2InterfaceUtils::getFullParam (bzNominalGPU, nHbfPerTf);
102- size_t expectedSharedMapSize = nHbfPerTf ? fillOccupancyMapGetSize (nHbfPerTf, mParam .get ()) : 0 ;
102+ size_t expectedOccMapSize = nHbfPerTf ? fillOccupancyMapGetSize (nHbfPerTf, mParam .get ()) : 0 ;
103103 if (cl->nClustersTotal ) {
104104 if (sharedmap == nullptr && trks == nullptr ) {
105105 throw std::runtime_error (" Must provide either shared cluster map or vector of tpc tracks to build the map" );
106106 }
107- if ((sharedmap == nullptr ) ^ (expectedSharedMapSize && occupancymap == nullptr )) {
107+ if ((sharedmap == nullptr ) ^ (expectedOccMapSize && occupancymap == nullptr )) {
108108 throw std::runtime_error (" Must provide either both shared cluster map and occupancy map or none of them" );
109109 }
110110 if (sharedmap == nullptr ) {
111111 mSharedMap .resize (cl->nClustersTotal );
112112 sharedmap = mSharedMap .data ();
113- mOccupancyMap .resize (expectedSharedMapSize / sizeof (*mOccupancyMap .data ()));
113+ mOccupancyMap .resize (expectedOccMapSize / sizeof (*mOccupancyMap .data ()));
114114 occupancymap = mOccupancyMap .data ();
115+ occupancyMapSize = expectedOccMapSize;
115116 fillSharedClustersAndOccupancyMap (cl, *trks, trackRef, mSharedMap .data (), mOccupancyMap .data (), nHbfPerTf, mParam .get ());
116117 }
117118 }
118- if (occupancymap && occupancyMapSize > sizeof (*occupancymap) && occupancymap[1 ] != (mParam ->rec .tpc .occupancyMapTimeBins * 0x10000 + mParam ->rec .tpc .occupancyMapTimeBinsAverage )) {
119- throw std::runtime_error (" Occupancy map has invalid paramters occupancyMapTimeBins and occupancyMapTimeBinsAverage" );
120- }
121- if (occupancyMapSize != -1 && nHbfPerTf && (size_t )occupancyMapSize != expectedSharedMapSize) {
122- throw std::runtime_error (" Received occupancy map of wrong size, most likely --configKeyValues or HBperTF of map creator and map consumer are different" );
123- }
119+ GPUO2InterfaceUtils::paramUseExternalOccupancyMap (mParam .get (), nHbfPerTf, occupancymap, occupancyMapSize);
120+
124121 mRefit = std::make_unique<GPUTrackingRefit>();
125- if (occupancymap) {
126- mParam ->occupancyTotal = *occupancymap;
127- if (mParam ->rec .tpc .occupancyMapTimeBins ) {
128- mParam ->occupancyMap = occupancymap + 2 ;
129- }
130- }
131122 mRefit ->SetGPUParam (mParam .get ());
132123 mRefit ->SetClusterStateArray (sharedmap);
133124 mRefit ->SetPropagator (p);
0 commit comments