Skip to content

Commit 9e2718c

Browse files
committed
only 8 bits of Track::userfield are for user
Oher 8 bits of the mUserField are for the internal status bits
1 parent 198457e commit 9e2718c

3 files changed

Lines changed: 53 additions & 12 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrization.h

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,11 @@ class TrackParametrization
249249
GPUd() bool isValid() const;
250250
GPUd() void invalidate();
251251

252-
GPUhd() uint16_t getUserField() const;
253-
GPUhd() void setUserField(uint16_t v);
252+
GPUhd() uint8_t getUserField() const;
253+
GPUhd() void setUserField(uint8_t v);
254+
255+
GPUhd() void setPerProjection(bool v) { setBit(0); } // request perform operations per projection
256+
GPUhd() bool isPerProjection() const { return testBit(0); } // perform operations per projection?
254257

255258
GPUd() void printParam() const;
256259
GPUd() void printParamHexadecimal();
@@ -268,6 +271,11 @@ class TrackParametrization
268271

269272
GPUd() yzerr_t getVertexInTrackFrame(const o2::dataformats::VertexBase& vtx) const;
270273

274+
protected:
275+
GPUhd() void setBit(uint8_t b, bool v = true);
276+
GPUhd() bool testBit(uint8_t b) const;
277+
GPUhd() uint8_t getBits() const;
278+
271279
private:
272280
//
273281
static constexpr value_t InvalidX = -99999.f;
@@ -740,16 +748,43 @@ GPUdi() void TrackParametrization<value_T>::invalidate()
740748
mX = InvalidX;
741749
}
742750

751+
//____________________________________________________________
743752
template <typename value_T>
744-
GPUhdi() uint16_t TrackParametrization<value_T>::getUserField() const
753+
GPUhdi() void TrackParametrization<value_T>::setBit(uint8_t b, bool v)
745754
{
746-
return mUserField;
755+
if (v) {
756+
mUserField |= ((0x1 << b) & 0xff);
757+
} else {
758+
mUserField &= ~((0x1 << b) & 0xff);
759+
}
747760
}
748761

762+
//____________________________________________________________
763+
template <typename value_T>
764+
GPUhdi() bool TrackParametrization<value_T>::testBit(uint8_t b) const
765+
{
766+
return mUserField & ((0x1 << b) & 0xff);
767+
}
768+
769+
//____________________________________________________________
770+
template <typename value_T>
771+
GPUhdi() uint8_t TrackParametrization<value_T>::getBits() const
772+
{
773+
return (mUserField & 0xff);
774+
}
775+
776+
//____________________________________________________________
777+
template <typename value_T>
778+
GPUhdi() uint8_t TrackParametrization<value_T>::getUserField() const
779+
{
780+
return ((mUserField >> 8) & 0xff);
781+
}
782+
783+
//____________________________________________________________
749784
template <typename value_T>
750-
GPUhdi() void TrackParametrization<value_T>::setUserField(uint16_t v)
785+
GPUhdi() void TrackParametrization<value_T>::setUserField(uint8_t v)
751786
{
752-
mUserField = v;
787+
mUserField |= uint16_t(v & 0xff) << 8;
753788
}
754789

755790
//____________________________________________________________

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ void TrackMCStudy::processTPCTrackRefs()
802802
float tgL = trf.Pz() / pT;
803803
std::array<float, 5> pars = {secY, trf.Z(), std::sin(dphiPt), tgL, q / pT};
804804
auto& refTrack = mSelTRefs.emplace_back(secX, alpsec[sector], pars);
805-
refTrack.setUserField(uint16_t(sector));
805+
refTrack.setUserField(uint8_t(sector));
806806
nrefsSel++;
807807
}
808808
if (nrefsSel < params.minTPCRefsToExtractClRes) {

GPU/GPUTracking/DataTypes/GPUTRDInterfaceO2Track.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ class trackInterface<o2::track::TrackParCov> : public o2::track::TrackParCov
7070

7171
GPUdi() bool CheckNumericalQuality() const { return true; }
7272

73-
GPUdi() void setPileUpDistance(uint8_t bwd, uint8_t fwd) { setUserField((((uint16_t)bwd) << 8) | fwd); }
74-
GPUdi() bool hasPileUpInfo() const { return getUserField() != 0; }
73+
GPUdi() void setPileUpDistance(uint8_t bwd, uint8_t fwd)
74+
{
75+
mPileUpDistanceFwd = fwd;
76+
mPileUpDistanceBwd = bwd;
77+
}
78+
GPUdi() bool hasPileUpInfo() const { return (mPileUpDistanceFwd != 0) || (mPileUpDistanceBwd != 0); }
7579
GPUdi() bool hasPileUpInfoBothSides() const { return getPileUpDistanceBwd() > 0 && getPileUpDistanceFwd() > 0; }
76-
GPUdi() uint8_t getPileUpDistanceBwd() const { return getUserField() >> 8; }
77-
GPUdi() uint8_t getPileUpDistanceFwd() const { return getUserField() & 255; }
80+
GPUdi() uint8_t getPileUpDistanceBwd() const { return mPileUpDistanceBwd; }
81+
GPUdi() uint8_t getPileUpDistanceFwd() const { return mPileUpDistanceFwd; }
7882
GPUdi() uint16_t getPileUpSpan() const { return ((uint16_t)getPileUpDistanceBwd()) + getPileUpDistanceFwd(); }
7983
GPUdi() float getPileUpMean() const { return hasPileUpInfoBothSides() ? 0.5f * (getPileUpDistanceFwd() + getPileUpDistanceBwd()) : getPileUpDistanceFwd() + getPileUpDistanceBwd(); }
8084
GPUdi() float getPileUpTimeShiftMUS() const { return getPileUpMean() * o2::constants::lhc::LHCBunchSpacingMUS; }
@@ -85,8 +89,10 @@ class trackInterface<o2::track::TrackParCov> : public o2::track::TrackParCov
8589
private:
8690
o2::track::TrackLTIntegral mLTOut;
8791
o2::track::TrackParCov mParamOut;
92+
uint8_t mPileUpDistanceFwd = 0;
93+
uint8_t mPileUpDistanceBwd = 0;
8894

89-
ClassDefNV(trackInterface, 1);
95+
ClassDefNV(trackInterface, 2);
9096
};
9197

9298
} // namespace o2::gpu

0 commit comments

Comments
 (0)