Skip to content

Commit b5e6904

Browse files
committed
Use global track indices for cross-detector matches
All int indices referring to entries of various tracks in their respective sources are substituted by o2::dataformats::GlobalTrackID, providing both the index and its source container
1 parent 1da040c commit b5e6904

File tree

16 files changed

+77
-69
lines changed

16 files changed

+77
-69
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/GlobalTrackID.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class GlobalTrackID : public AbstractRef<25, 4, 3>
5555
void print() const;
5656
std::string asString() const;
5757

58-
operator auto() const { return AbstractRef<25, 4, 3>(); }
58+
operator int() const { return int(getIndex()); }
5959

6060
ClassDefNV(GlobalTrackID, 1);
6161
};

DataFormats/Reconstruction/include/ReconstructionDataFormats/MatchInfoTOF.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define ALICEO2_MATCHINFOTOF_H
1616

1717
#include "ReconstructionDataFormats/TrackLTIntegral.h"
18+
#include "ReconstructionDataFormats/GlobalTrackID.h"
1819
#include "CommonDataFormat/EvIndex.h"
1920

2021
namespace o2
@@ -23,15 +24,16 @@ namespace dataformats
2324
{
2425
class MatchInfoTOF
2526
{
27+
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
2628
using evIdx = o2::dataformats::EvIndex<int, int>;
2729

2830
public:
29-
MatchInfoTOF(evIdx evIdxTOFCl, float chi2, o2::track::TrackLTIntegral trkIntLT, evIdx evIdxTrack = evIdx(0, 0)) : mEvIdxTOFCl(evIdxTOFCl), mChi2(chi2), mIntLT(trkIntLT), mEvIdxTrack(evIdxTrack){};
31+
MatchInfoTOF(evIdx evIdxTOFCl, float chi2, o2::track::TrackLTIntegral trkIntLT, evGIdx evIdxTrack) : mEvIdxTOFCl(evIdxTOFCl), mChi2(chi2), mIntLT(trkIntLT), mEvIdxTrack(evIdxTrack){};
3032
MatchInfoTOF() = default;
3133
void setEvIdxTOFCl(evIdx index) { mEvIdxTOFCl = index; }
32-
void setEvIdxTrack(evIdx index) { mEvIdxTrack = index; }
34+
void setEvIdxTrack(evGIdx index) { mEvIdxTrack = index; }
3335
evIdx getEvIdxTOFCl() const { return mEvIdxTOFCl; }
34-
evIdx getEvIdxTrack() const { return mEvIdxTrack; }
36+
evGIdx getEvIdxTrack() const { return mEvIdxTrack; }
3537
int getEventTOFClIndex() const { return mEvIdxTOFCl.getEvent(); }
3638
int getTOFClIndex() const { return mEvIdxTOFCl.getIndex(); }
3739
int getEventTrackIndex() const { return mEvIdxTrack.getEvent(); }
@@ -47,7 +49,7 @@ class MatchInfoTOF
4749
float mChi2; // chi2 of the pair track-TOFcluster
4850
o2::track::TrackLTIntegral mIntLT; ///< L,TOF integral calculated during the propagation
4951
evIdx mEvIdxTOFCl; ///< EvIdx for TOF cluster (first: ev index; second: cluster index)
50-
evIdx mEvIdxTrack; ///< EvIdx for track (first: ev index; second: cluster index)
52+
evGIdx mEvIdxTrack; ///< EvIdx for track (first: ev index; second: track global index)
5153

5254
ClassDefNV(MatchInfoTOF, 1);
5355
};

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackTPCITS.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "ReconstructionDataFormats/Track.h"
1919
#include "ReconstructionDataFormats/TrackLTIntegral.h"
20+
#include "ReconstructionDataFormats/GlobalTrackID.h"
2021
#include "CommonDataFormat/TimeStamp.h"
2122

2223
namespace o2
@@ -35,10 +36,10 @@ class TrackTPCITS : public o2::track::TrackParCov
3536
TrackTPCITS(const o2::track::TrackParCov& src) : o2::track::TrackParCov(src) {}
3637
TrackTPCITS(const o2::track::TrackParCov& srcIn, const o2::track::TrackParCov& srcOut) : o2::track::TrackParCov(srcIn), mParamOut(srcOut) {}
3738

38-
int getRefTPC() const { return mRefTPC; }
39-
int getRefITS() const { return mRefITS; }
40-
void setRefTPC(int id) { mRefTPC = id; }
41-
void setRefITS(int id) { mRefITS = id; }
39+
GlobalTrackID getRefTPC() const { return mRefTPC; }
40+
GlobalTrackID getRefITS() const { return mRefITS; }
41+
void setRefTPC(GlobalTrackID id) { mRefTPC = id; }
42+
void setRefITS(GlobalTrackID id) { mRefITS = id; }
4243

4344
const timeEst& getTimeMUS() const { return mTimeMUS; }
4445
timeEst& getTimeMUS() { return mTimeMUS; }
@@ -64,14 +65,14 @@ class TrackTPCITS : public o2::track::TrackParCov
6465
void print() const;
6566

6667
private:
67-
int mRefTPC = -1; ///< reference on ITS track entry in its original container
68-
int mRefITS = -1; ///< reference on TPC track entry in its original container
68+
GlobalTrackID mRefTPC; ///< reference on ITS track entry in its original container
69+
GlobalTrackID mRefITS; ///< reference on TPC track entry in its original container
6970
float mChi2Refit = 0.f; ///< chi2 of the refit
7071
float mChi2Match = 0.f; ///< chi2 of the match
7172
timeEst mTimeMUS; ///< time estimate in ns
7273
o2::track::TrackParCov mParamOut; ///< refitted outer parameter
7374
o2::track::TrackLTIntegral mLTOut; ///< L,TOF integral calculated during the outward refit
74-
ClassDefNV(TrackTPCITS, 2);
75+
ClassDefNV(TrackTPCITS, 3);
7576
};
7677
} // namespace dataformats
7778
} // namespace o2

DataFormats/Reconstruction/src/ReconstructionDataFormatsLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
#pragma link C++ class o2::dataformats::GlobalTrackID + ;
4949
#pragma link C++ class std::vector < o2::dataformats::GlobalTrackID> + ;
50+
#pragma link C++ class o2::dataformats::EvIndex < int, o2::dataformats::GlobalTrackID> + ;
5051

5152
#pragma link C++ class o2::dataformats::VtxTrackIndex + ;
5253
#pragma link C++ class std::vector < o2::dataformats::VtxTrackIndex> + ;

DataFormats/Reconstruction/src/TrackTPCITS.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace o2::dataformats;
1616
void TrackTPCITS::print() const
1717
{
1818
printf("TPCref: %6d ITSref: %6d\nChi2Refit: %6.2f Chi2Matc: %6.2f Time: %10.4f+-%10.4f mus\n",
19-
mRefTPC, mRefITS, getChi2Refit(), getChi2Match(),
19+
mRefTPC.getIndex(), mRefITS.getIndex(), getChi2Refit(), getChi2Match(),
2020
mTimeMUS.getTimeStamp(), mTimeMUS.getTimeStampError());
2121
printf("Inner param: ");
2222
o2::track::TrackParCov::print();

DataFormats/common/include/CommonDataFormat/AbstractRef.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class AbstractRef
7070

7171
Base_t getRaw() const { return mRef; }
7272

73-
operator Base_t() const { return mRef; }
74-
7573
protected:
7674
Base_t mRef = 0; // packed reference
7775

DataFormats/common/test/testAbstractRefAccessor.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(AbstractRefAccess)
8686
auto gid = vid[i];
8787
const auto& obj = acc.get(gid);
8888
int expect = gid.getSource() * 100 + i / GloIdx::NSources;
89-
LOG(INFO) << i << " ? " << obj.b << " == " << expect << " for " << gid;
89+
LOG(INFO) << i << " ? " << obj.b << " == " << expect << " for " << gid.getRaw();
9090
BOOST_CHECK(obj.b == expect);
9191
}
9292

Detectors/GlobalTracking/include/GlobalTracking/MatchTOF.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "ReconstructionDataFormats/Track.h"
2525
#include "ReconstructionDataFormats/TrackTPCITS.h"
2626
#include "ReconstructionDataFormats/MatchInfoTOF.h"
27+
#include "ReconstructionDataFormats/GlobalTrackID.h"
2728
#include "DataFormatsTOF/CalibInfoTOF.h"
2829
#include "CommonDataFormat/EvIndex.h"
2930
#include "SimulationDataFormat/MCCompLabel.h"
@@ -72,6 +73,7 @@ class MatchTOF
7273
{
7374
using Geo = o2::tof::Geo;
7475
using Cluster = o2::tof::Cluster;
76+
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
7577
using evIdx = o2::dataformats::EvIndex<int, int>;
7678
using timeEst = o2::dataformats::TimeStampWithError<float, float>;
7779
using matchTrack = std::pair<o2::track::TrackParCov, timeEst>;

Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "DetectorsBase/Propagator.h"
3131
#include "ReconstructionDataFormats/Track.h"
3232
#include "ReconstructionDataFormats/TrackTPCITS.h"
33+
#include "ReconstructionDataFormats/GlobalTrackID.h"
3334
#include "MathUtils/Primitive2D.h"
3435
#include "CommonDataFormat/EvIndex.h"
3536
#include "CommonDataFormat/InteractionRecord.h"
@@ -551,7 +552,7 @@ class MatchTPCITS
551552
}
552553
int rof = tbin > 0 ? tbin * mTPCBin2ITSROFrame : 0;
553554
// the rof is estimated continuous counter but the actual bins might have gaps (e.g. HB rejects etc)-> use mapping
554-
return rof < mITSTrackROFContMapping.size() ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
555+
return rof < int(mITSTrackROFContMapping.size()) ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
555556
}
556557

557558
///< convert ITS ROFrame to TPC time bin units // TOREMOVE

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "TPCBase/ParameterElectronics.h"
4141

4242
using namespace o2::globaltracking;
43+
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
4344
using evIdx = o2::dataformats::EvIndex<int, int>;
4445

4546
ClassImp(MatchTOF);
@@ -1107,8 +1108,8 @@ void MatchTOF::doMatching(int sec)
11071108
foundCluster = true;
11081109
// set event indexes (to be checked)
11091110
evIdx eventIndexTOFCluster(trefTOF.getEntryInTree(), mTOFClusSectIndexCache[indices[0]][itof]);
1110-
evIdx eventIndexTracks(mCurrTracksTreeEntry, mTracksSectIndexCache[indices[0]][itrk]);
1111-
mMatchedTracksPairs.emplace_back(o2::dataformats::MatchInfoTOF(eventIndexTOFCluster, chi2, trkLTInt[iPropagation], eventIndexTracks)); // TODO: check if this is correct!
1111+
evGIdx eventIndexTracks(mCurrTracksTreeEntry, {uint32_t(mTracksSectIndexCache[indices[0]][itrk]), o2::dataformats::GlobalTrackID::ITSTPC});
1112+
mMatchedTracksPairs.emplace_back(eventIndexTOFCluster, chi2, trkLTInt[iPropagation], eventIndexTracks); // TODO: check if this is correct!
11121113

11131114
#ifdef _ALLOW_TOF_DEBUG_
11141115
if (mMCTruthON) {
@@ -1426,8 +1427,8 @@ void MatchTOF::doMatchingForTPC(int sec)
14261427
foundCluster = true;
14271428
// set event indexes (to be checked)
14281429
evIdx eventIndexTOFCluster(trefTOF.getEntryInTree(), mTOFClusSectIndexCache[indices[0]][itof]);
1429-
evIdx eventIndexTracks(mCurrTracksTreeEntry, mTracksSectIndexCache[indices[0]][itrk]);
1430-
mMatchedTracksPairs.emplace_back(o2::dataformats::MatchInfoTOF(eventIndexTOFCluster, chi2, trkLTInt[ibc][iPropagation], eventIndexTracks)); // TODO: check if this is correct!
1430+
evGIdx eventIndexTracks(mCurrTracksTreeEntry, {uint32_t(mTracksSectIndexCache[indices[0]][itrk]), o2::dataformats::GlobalTrackID::TPC});
1431+
mMatchedTracksPairs.emplace_back(eventIndexTOFCluster, chi2, trkLTInt[ibc][iPropagation], eventIndexTracks); // TODO: check if this is correct!
14311432
}
14321433
}
14331434
}

0 commit comments

Comments
 (0)