3333#include " DataFormatsTPC/VDriftCorrFact.h"
3434#include " Framework/Logger.h"
3535#include " CCDB/BasicCCDBManager.h"
36+ #include " GPUO2InterfaceUtils.h"
37+ #include " GPUO2InterfaceConfiguration.h"
38+ #include " GPUO2InterfaceRefit.h"
39+ #include " GPUParam.h"
40+ #include " GPUParam.inc"
3641#include < set>
3742#include < algorithm>
3843#include < random>
@@ -135,7 +140,7 @@ void TrackInterpolation::init(o2::dataformats::GlobalTrackID::mask_t src, o2::da
135140
136141 auto geom = o2::its::GeometryTGeo::Instance ();
137142 geom->fillMatrixCache (o2::math_utils::bit2Mask (o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
138-
143+ mTPCParam = o2::gpu::GPUO2InterfaceUtils::getFullParamShared ( 0 . f , mNHBPerTF );
139144 mInitDone = true ;
140145 LOGP (info, " Done initializing TrackInterpolation. Configured track input: {}. Track input specifically for map: {}" ,
141146 GTrackID::getSourcesNames (mSourcesConfigured ), mSingleSourcesConfigured ? " identical" : GTrackID::getSourcesNames (mSourcesConfiguredMap ));
@@ -316,6 +321,10 @@ void TrackInterpolation::process()
316321 // set the input containers
317322 mTPCTracksClusIdx = mRecoCont ->getTPCTracksClusterRefs ();
318323 mTPCClusterIdxStruct = &mRecoCont ->getTPCClusters ();
324+ int nbOccTOT = o2::gpu::GPUO2InterfaceRefit::fillOccupancyMapGetSize (mNHBPerTF , mTPCParam .get ());
325+ o2::gpu::GPUO2InterfaceUtils::paramUseExternalOccupancyMap (mTPCParam .get (), mNHBPerTF , mRecoCont ->occupancyMapTPC .data (), nbOccTOT);
326+ mNTPCOccBinLength = mTPCParam ->rec .tpc .occupancyMapTimeBins ;
327+ mNTPCOccBinLengthInv = 1 .f / mNTPCOccBinLength ;
319328 {
320329 if (!mITSDict ) {
321330 LOG (error) << " No ITS dictionary available" ;
@@ -473,6 +482,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
473482
474483 // store the TPC cluster positions in the cache, as well as dedx info
475484 std::array<std::pair<uint16_t , uint16_t >, constants::MAXGLOBALPADROW> mCacheDEDX {};
485+ std::array<short , constants::MAXGLOBALPADROW> multBins{};
476486 for (int iCl = trkTPC.getNClusterReferences (); iCl--;) {
477487 uint8_t sector, row;
478488 uint32_t clusterIndexInRow;
@@ -487,6 +497,10 @@ void TrackInterpolation::interpolateTrack(int iSeed)
487497 mCache [row].clAngle = o2::math_utils::sector2Angle (sector);
488498 mCacheDEDX [row].first = clTPC.getQtot ();
489499 mCacheDEDX [row].second = clTPC.getQmax ();
500+ int imb = int (clTPC.getTime () * mNTPCOccBinLengthInv );
501+ if (imb < mTPCParam ->occupancyMapSize ) {
502+ multBins[row] = 1 + std::max (0 , imb);
503+ }
490504 }
491505
492506 // extrapolate seed through TPC and store track position at each pad row
@@ -678,6 +692,30 @@ void TrackInterpolation::interpolateTrack(int iSeed)
678692 }
679693 trackData.clIdx .setEntries (nClValidated);
680694
695+ // store multiplicity info
696+ for (int ist = 0 ; ist < NSTACKS; ist++) {
697+ int mltBinMin = 0x7ffff , mltBinMax = -1 , prevBin = -1 ;
698+ for (int ir = STACKROWS[ist]; ir < STACKROWS[ist + 1 ]; ir++) {
699+ if (multBins[ir] != prevBin && multBins[ir] > 0 ) { // there is a cluster different from previous one
700+ prevBin = multBins[ir];
701+ if (multBins[ir] > mltBinMax) {
702+ mltBinMax = multBins[ir];
703+ }
704+ if (multBins[ir] < mltBinMin) {
705+ mltBinMin = multBins[ir];
706+ }
707+ }
708+ }
709+ if (--mltBinMin >= 0 ) { // we were offsetting bin IDs by 1!
710+ float avMlt = 0 ;
711+ for (int ib = mltBinMin; ib < mltBinMax; ib++) {
712+ avMlt += mTPCParam ->occupancyMap [ib];
713+ }
714+ avMlt /= (mltBinMax - mltBinMin);
715+ trackData.setMultStack (avMlt, ist);
716+ }
717+ }
718+
681719 bool stopPropagation = !mExtDetResid ;
682720 if (!stopPropagation) {
683721 // do we have TRD residuals to add?
@@ -798,7 +836,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
798836 }
799837
800838 mGIDsSuccess .push_back (mGIDs [iSeed]);
801- mTrackDataCompact .emplace_back (trackData.clIdx .getFirstEntry (), nClValidated, mGIDs [iSeed].getSource (), trackData.nExtDetResid );
839+ mTrackDataCompact .emplace_back (trackData.clIdx .getFirstEntry (), trackData. multStack , nClValidated, mGIDs [iSeed].getSource (), trackData.nExtDetResid );
802840 mTrackData .push_back (std::move (trackData));
803841 if (mDumpTrackPoints ) {
804842 (*trackDataExtended).clIdx .setEntries (nClValidated);
@@ -907,6 +945,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
907945 unsigned short nMeasurements = 0 ;
908946 uint8_t clRowPrev = constants::MAXGLOBALPADROW; // used to identify and skip split clusters on the same pad row
909947 std::array<std::pair<uint16_t , uint16_t >, constants::MAXGLOBALPADROW> mCacheDEDX {};
948+ std::array<short , constants::MAXGLOBALPADROW> multBins{};
910949 for (int iCl = trkTPC.getNClusterReferences (); iCl--;) {
911950 uint8_t sector, row;
912951 uint32_t clusterIndexInRow;
@@ -942,6 +981,10 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
942981 mCacheDEDX [row].first = cl.getQtot ();
943982 mCacheDEDX [row].second = cl.getQmax ();
944983 rowPrev = row;
984+ int imb = int (cl.getTime () * mNTPCOccBinLengthInv );
985+ if (imb < mTPCParam ->occupancyMapSize ) {
986+ multBins[row] = 1 + std::max (0 , imb);
987+ }
945988 ++nMeasurements;
946989 }
947990
@@ -986,6 +1029,30 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
9861029 }
9871030 trackData.clIdx .setEntries (nClValidated);
9881031
1032+ // store multiplicity info
1033+ for (int ist = 0 ; ist < NSTACKS; ist++) {
1034+ int mltBinMin = 0x7ffff , mltBinMax = -1 , prevBin = -1 ;
1035+ for (int ir = STACKROWS[ist]; ir < STACKROWS[ist + 1 ]; ir++) {
1036+ if (multBins[ir] != prevBin && multBins[ir] > 0 ) { // there is a cluster
1037+ prevBin = multBins[ir];
1038+ if (multBins[ir] > mltBinMax) {
1039+ mltBinMax = multBins[ir];
1040+ }
1041+ if (multBins[ir] < mltBinMin) {
1042+ mltBinMin = multBins[ir];
1043+ }
1044+ }
1045+ }
1046+ if (--mltBinMin >= 0 ) { // we were offsetting bin IDs by 1!
1047+ float avMlt = 0 ;
1048+ for (int ib = mltBinMin; ib < mltBinMax; ib++) {
1049+ avMlt += mTPCParam ->occupancyMap [ib];
1050+ }
1051+ avMlt /= (mltBinMax - mltBinMin);
1052+ trackData.setMultStack (avMlt, ist);
1053+ }
1054+ }
1055+
9891056 bool stopPropagation = !mExtDetResid ;
9901057 if (!stopPropagation) {
9911058 // do we have TRD residuals to add?
@@ -1117,7 +1184,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
11171184 }
11181185 mTrackData .push_back (std::move (trackData));
11191186 mGIDsSuccess .push_back (mGIDs [iSeed]);
1120- mTrackDataCompact .emplace_back (trackData.clIdx .getFirstEntry (), nClValidated, mGIDs [iSeed].getSource (), trackData.nExtDetResid );
1187+ mTrackDataCompact .emplace_back (trackData.clIdx .getFirstEntry (), trackData. multStack , nClValidated, mGIDs [iSeed].getSource (), trackData.nExtDetResid );
11211188 if (mDumpTrackPoints ) {
11221189 (*trackDataExtended).clIdx .setEntries (nClValidated);
11231190 (*trackDataExtended).nExtDetResid = trackData.nExtDetResid ;
0 commit comments