Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GlobalTrackID : public AbstractRef<25, 4, 3>
void print() const;
std::string asString() const;

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

ClassDefNV(GlobalTrackID, 1);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define ALICEO2_MATCHINFOTOF_H

#include "ReconstructionDataFormats/TrackLTIntegral.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "CommonDataFormat/EvIndex.h"

namespace o2
Expand All @@ -23,15 +24,16 @@ namespace dataformats
{
class MatchInfoTOF
{
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
using evIdx = o2::dataformats::EvIndex<int, int>;

public:
MatchInfoTOF(evIdx evIdxTOFCl, float chi2, o2::track::TrackLTIntegral trkIntLT, evIdx evIdxTrack = evIdx(0, 0)) : mEvIdxTOFCl(evIdxTOFCl), mChi2(chi2), mIntLT(trkIntLT), mEvIdxTrack(evIdxTrack){};
MatchInfoTOF(evIdx evIdxTOFCl, float chi2, o2::track::TrackLTIntegral trkIntLT, evGIdx evIdxTrack) : mEvIdxTOFCl(evIdxTOFCl), mChi2(chi2), mIntLT(trkIntLT), mEvIdxTrack(evIdxTrack){};
MatchInfoTOF() = default;
void setEvIdxTOFCl(evIdx index) { mEvIdxTOFCl = index; }
void setEvIdxTrack(evIdx index) { mEvIdxTrack = index; }
void setEvIdxTrack(evGIdx index) { mEvIdxTrack = index; }
evIdx getEvIdxTOFCl() const { return mEvIdxTOFCl; }
evIdx getEvIdxTrack() const { return mEvIdxTrack; }
evGIdx getEvIdxTrack() const { return mEvIdxTrack; }
int getEventTOFClIndex() const { return mEvIdxTOFCl.getEvent(); }
int getTOFClIndex() const { return mEvIdxTOFCl.getIndex(); }
int getEventTrackIndex() const { return mEvIdxTrack.getEvent(); }
Expand All @@ -47,7 +49,7 @@ class MatchInfoTOF
float mChi2; // chi2 of the pair track-TOFcluster
o2::track::TrackLTIntegral mIntLT; ///< L,TOF integral calculated during the propagation
evIdx mEvIdxTOFCl; ///< EvIdx for TOF cluster (first: ev index; second: cluster index)
evIdx mEvIdxTrack; ///< EvIdx for track (first: ev index; second: cluster index)
evGIdx mEvIdxTrack; ///< EvIdx for track (first: ev index; second: track global index)

ClassDefNV(MatchInfoTOF, 1);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/TrackLTIntegral.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "CommonDataFormat/TimeStamp.h"

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

int getRefTPC() const { return mRefTPC; }
int getRefITS() const { return mRefITS; }
void setRefTPC(int id) { mRefTPC = id; }
void setRefITS(int id) { mRefITS = id; }
GlobalTrackID getRefTPC() const { return mRefTPC; }
GlobalTrackID getRefITS() const { return mRefITS; }
void setRefTPC(GlobalTrackID id) { mRefTPC = id; }
void setRefITS(GlobalTrackID id) { mRefITS = id; }

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

private:
int mRefTPC = -1; ///< reference on ITS track entry in its original container
int mRefITS = -1; ///< reference on TPC track entry in its original container
GlobalTrackID mRefTPC; ///< reference on ITS track entry in its original container
GlobalTrackID mRefITS; ///< reference on TPC track entry in its original container
Comment on lines +68 to +69
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not fully sure if it is better to have the GlobalTrackID here directly, or keep the mRefTPC and mRefITS as integer as before, since it is clear where they belong. The conversion to the globalTrackId could also happen in the GlobalTrackID getRefTPC() accessor (which would be just one or operation), there could even be 2 accessors, returning the int for users that know the container, and returning the global ID for general purposes. But OK, not sure if this is overdoing it and whether it would make a difference anywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidrohr not really: in the final version the mRefTPC may refer also to TPC track constrained by TOF, TRD or both (GlobalTrackID::TPCTOF, GlobalTrackID::TPCTRD...). Similarly, for the TPCtrack-ITSclusters afterburner I'll need to introduce separate container with matched ITS cluster IDs, this will be yet another GlobalTrackID::Source entry which will be registered in the mRefITS.
For the clear-cut cases I indeed use integers, like the reference on the TOF cluster matched to global track:

evIdx mEvIdxTOFCl; ///< EvIdx for TOF cluster (first: ev index; second: cluster index)
evGIdx mEvIdxTrack; ///< EvIdx for track (first: ev index; second: track global index)

Though, in this particular case there is another problem: TOF still uses for indexing a EvIndex<int, int> to store {tree_entry_ID, index in entry}, so, I've just substituted the reference on the track by EvIndex<int, GlobalTrackID>.
This is a legacy from the times when we did not have just 1 entry per TF (we still have multiple entries for TPC and ITS "triggered" modes, but these trigger implementations are anyway wrong, I would simply introduce extra vector delimiting the ranges of every trigger in a single tree entry). @noferini, I would suppress this tree entry references.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it. Initially I was thinking that these constrained tracks of course also have a TPC track ID, but obviously you need the updated constrained track parameters... Makes totally sense as is.

float mChi2Refit = 0.f; ///< chi2 of the refit
float mChi2Match = 0.f; ///< chi2 of the match
timeEst mTimeMUS; ///< time estimate in ns
o2::track::TrackParCov mParamOut; ///< refitted outer parameter
o2::track::TrackLTIntegral mLTOut; ///< L,TOF integral calculated during the outward refit
ClassDefNV(TrackTPCITS, 2);
ClassDefNV(TrackTPCITS, 3);
};
} // namespace dataformats
} // namespace o2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

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

#pragma link C++ class o2::dataformats::VtxTrackIndex + ;
#pragma link C++ class std::vector < o2::dataformats::VtxTrackIndex> + ;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/Reconstruction/src/TrackTPCITS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace o2::dataformats;
void TrackTPCITS::print() const
{
printf("TPCref: %6d ITSref: %6d\nChi2Refit: %6.2f Chi2Matc: %6.2f Time: %10.4f+-%10.4f mus\n",
mRefTPC, mRefITS, getChi2Refit(), getChi2Match(),
mRefTPC.getIndex(), mRefITS.getIndex(), getChi2Refit(), getChi2Match(),
mTimeMUS.getTimeStamp(), mTimeMUS.getTimeStampError());
printf("Inner param: ");
o2::track::TrackParCov::print();
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/common/include/CommonDataFormat/AbstractRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class AbstractRef

Base_t getRaw() const { return mRef; }

operator Base_t() const { return mRef; }

protected:
Base_t mRef = 0; // packed reference

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/common/test/testAbstractRefAccessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(AbstractRefAccess)
auto gid = vid[i];
const auto& obj = acc.get(gid);
int expect = gid.getSource() * 100 + i / GloIdx::NSources;
LOG(INFO) << i << " ? " << obj.b << " == " << expect << " for " << gid;
LOG(INFO) << i << " ? " << obj.b << " == " << expect << " for " << gid.getRaw();
BOOST_CHECK(obj.b == expect);
}

Expand Down
2 changes: 2 additions & 0 deletions Detectors/GlobalTracking/include/GlobalTracking/MatchTOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/TrackTPCITS.h"
#include "ReconstructionDataFormats/MatchInfoTOF.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DataFormatsTOF/CalibInfoTOF.h"
#include "CommonDataFormat/EvIndex.h"
#include "SimulationDataFormat/MCCompLabel.h"
Expand Down Expand Up @@ -72,6 +73,7 @@ class MatchTOF
{
using Geo = o2::tof::Geo;
using Cluster = o2::tof::Cluster;
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
using evIdx = o2::dataformats::EvIndex<int, int>;
using timeEst = o2::dataformats::TimeStampWithError<float, float>;
using matchTrack = std::pair<o2::track::TrackParCov, timeEst>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "DetectorsBase/Propagator.h"
#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/TrackTPCITS.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "MathUtils/Primitive2D.h"
#include "CommonDataFormat/EvIndex.h"
#include "CommonDataFormat/InteractionRecord.h"
Expand Down Expand Up @@ -551,7 +552,7 @@ class MatchTPCITS
}
int rof = tbin > 0 ? tbin * mTPCBin2ITSROFrame : 0;
// the rof is estimated continuous counter but the actual bins might have gaps (e.g. HB rejects etc)-> use mapping
return rof < mITSTrackROFContMapping.size() ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
return rof < int(mITSTrackROFContMapping.size()) ? mITSTrackROFContMapping[rof] : mITSTrackROFContMapping.back();
}

///< convert ITS ROFrame to TPC time bin units // TOREMOVE
Expand Down
9 changes: 5 additions & 4 deletions Detectors/GlobalTracking/src/MatchTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "TPCBase/ParameterElectronics.h"

using namespace o2::globaltracking;
using evGIdx = o2::dataformats::EvIndex<int, o2::dataformats::GlobalTrackID>;
using evIdx = o2::dataformats::EvIndex<int, int>;

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

#ifdef _ALLOW_TOF_DEBUG_
if (mMCTruthON) {
Expand Down Expand Up @@ -1426,8 +1427,8 @@ void MatchTOF::doMatchingForTPC(int sec)
foundCluster = true;
// set event indexes (to be checked)
evIdx eventIndexTOFCluster(trefTOF.getEntryInTree(), mTOFClusSectIndexCache[indices[0]][itof]);
evIdx eventIndexTracks(mCurrTracksTreeEntry, mTracksSectIndexCache[indices[0]][itrk]);
mMatchedTracksPairs.emplace_back(o2::dataformats::MatchInfoTOF(eventIndexTOFCluster, chi2, trkLTInt[ibc][iPropagation], eventIndexTracks)); // TODO: check if this is correct!
evGIdx eventIndexTracks(mCurrTracksTreeEntry, {uint32_t(mTracksSectIndexCache[indices[0]][itrk]), o2::dataformats::GlobalTrackID::TPC});
mMatchedTracksPairs.emplace_back(eventIndexTOFCluster, chi2, trkLTInt[ibc][iPropagation], eventIndexTracks); // TODO: check if this is correct!
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Detectors/GlobalTracking/src/MatchTPCITS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1472,8 +1472,8 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS)
trfit.setChi2Match(tpcMatchRec.chi2);
trfit.setChi2Refit(chi2);
trfit.setTimeMUS(time, timeErr);
trfit.setRefTPC(tTPC.sourceID);
trfit.setRefITS(tITS.sourceID);
trfit.setRefTPC({unsigned(tTPC.sourceID), o2::dataformats::GlobalTrackID::TPC});
trfit.setRefITS({unsigned(tITS.sourceID), o2::dataformats::GlobalTrackID::ITS});

if (mMCTruthON) { // store MC info
mOutITSLabels.emplace_back(mITSLblWork[iITS]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "TPCBase/ParameterElectronics.h"
#include "DataFormatsTPC/TrackTPC.h"
#include "DataFormatsTPC/Defs.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"

#include <fairlogger/Logger.h>
#include <set>
Expand Down
4 changes: 2 additions & 2 deletions Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PVertexer
}
float getTukey() const;

void finalizeVertex(const VertexingInput& input, const PVertex& vtx, std::vector<PVertex>& vertices, std::vector<V2TRef>& v2tRefs, std::vector<int>& vertexTrackIDs, SeedHisto& histo);
void finalizeVertex(const VertexingInput& input, const PVertex& vtx, std::vector<PVertex>& vertices, std::vector<V2TRef>& v2tRefs, std::vector<GTrackID>& vertexTrackIDs, SeedHisto& histo);
bool setCompatibleIR(PVertex& vtx);

void setBunchFilling(const o2::BunchFilling& bf);
Expand Down Expand Up @@ -107,7 +107,7 @@ class PVertexer
void applyConstraint(VertexSeed& vtxSeed) const;
bool upscaleSigma(VertexSeed& vtxSeed) const;
void createTracksPool(gsl::span<const o2d::TrackTPCITS> tracksITSTPC);
int findVertices(const VertexingInput& input, std::vector<PVertex>& vertices, std::vector<int>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs);
int findVertices(const VertexingInput& input, std::vector<PVertex>& vertices, std::vector<GTrackID>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs);
std::pair<int, int> getBestFT0Trigger(const PVertex& vtx, gsl::span<const o2::ft0::RecPoints> ft0Data, int& currEntry) const;

int dbscan_RangeQuery(int idxs, std::vector<int>& cand, const std::vector<int>& status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ using PVertex = o2::dataformats::PrimaryVertex;
using TimeEst = o2::dataformats::TimeStampWithError<float, float>;
using V2TRef = o2::dataformats::VtxTrackRef;
using GIndex = o2::dataformats::VtxTrackIndex;
using GTrackID = o2::dataformats::GlobalTrackID;

///< weights and scaling params for current vertex
struct VertexSeed : public PVertex {
Expand Down Expand Up @@ -96,9 +97,8 @@ struct TrackVF {

TimeEst timeEst;
float wgh = 0.; ///< track weight wrt current vertex seed
uint32_t entry = 0;
GTrackID entry;
int16_t bin = -1; // seeds histo bin
uint8_t srcID = 0;
uint8_t flags = 0;
int vtxID = kNoVtx; ///< assigned vertex

Expand Down Expand Up @@ -143,8 +143,8 @@ struct TrackVF {
}

TrackVF() = default;
TrackVF(const o2::track::TrackParCov& src, const TimeEst& t_est, uint32_t _entry, uint8_t _srcID)
: x(src.getX()), y(src.getY()), z(src.getZ()), tgL(src.getTgl()), tgP(src.getSnp() / std::sqrt(1. - src.getSnp()) * (1. + src.getSnp())), timeEst(t_est), entry(_entry), srcID(_srcID)
TrackVF(const o2::track::TrackParCov& src, const TimeEst& t_est, GTrackID _entry)
: x(src.getX()), y(src.getY()), z(src.getZ()), tgL(src.getTgl()), tgP(src.getSnp() / std::sqrt(1. - src.getSnp()) * (1. + src.getSnp())), timeEst(t_est), entry(_entry)
{
o2::math_utils::sincos(src.getAlpha(), sinAlp, cosAlp);
auto det = src.getSigmaY2() * src.getSigmaZ2() - src.getSigmaZY() * src.getSigmaZY();
Expand Down
10 changes: 5 additions & 5 deletions Detectors/Vertexing/src/PVertexer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int PVertexer::process(gsl::span<const o2d::TrackTPCITS> tracksITSTPC, gsl::span
dbscan_clusterize();

std::vector<PVertex> verticesLoc;
std::vector<int> vertexTrackIDsLoc;
std::vector<GTrackID> vertexTrackIDsLoc;
std::vector<V2TRef> v2tRefsLoc;
std::vector<float> validationTimes;

Expand Down Expand Up @@ -87,7 +87,7 @@ int PVertexer::process(gsl::span<const o2d::TrackTPCITS> tracksITSTPC, gsl::span
vertices.push_back(vtx);
int it = v2tRefsLoc[i].getFirstEntry(), itEnd = it + v2tRefsLoc[i].getEntries(), dest0 = vertexTrackIDs.size();
for (; it < itEnd; it++) {
auto& gid = vertexTrackIDs.emplace_back(vertexTrackIDsLoc[it], GIndex::ITSTPC);
auto& gid = vertexTrackIDs.emplace_back(vertexTrackIDsLoc[it]);
gid.setPVContributor();
}
v2tRefs.emplace_back(dest0, v2tRefsLoc[i].getEntries());
Expand All @@ -110,7 +110,7 @@ int PVertexer::process(gsl::span<const o2d::TrackTPCITS> tracksITSTPC, gsl::span
}

//______________________________________________
int PVertexer::findVertices(const VertexingInput& input, std::vector<PVertex>& vertices, std::vector<int>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs)
int PVertexer::findVertices(const VertexingInput& input, std::vector<PVertex>& vertices, std::vector<GTrackID>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs)
{
// find vertices using tracks with indices (sorted in time) from idRange from "tracks" pool. The pool may containt arbitrary number of tracks,
// only those which are in the idRange and have canUse()==true, will be used.
Expand Down Expand Up @@ -439,7 +439,7 @@ void PVertexer::init()

//___________________________________________________________________
void PVertexer::finalizeVertex(const VertexingInput& input, const PVertex& vtx,
std::vector<PVertex>& vertices, std::vector<V2TRef>& v2tRefs, std::vector<int>& vertexTrackIDs,
std::vector<PVertex>& vertices, std::vector<V2TRef>& v2tRefs, std::vector<GTrackID>& vertexTrackIDs,
SeedHisto& histo)
{
int lastID = vertices.size();
Expand Down Expand Up @@ -477,7 +477,7 @@ void PVertexer::createTracksPool(gsl::span<const o2d::TrackTPCITS> tracksITSTPC)
dca.getY() * dca.getY() / (dca.getSigmaY2() + vtxErr2) > mPVParams->pullIniCut) {
continue;
}
auto& tvf = mTracksPool.emplace_back(trc, tracksITSTPC[i].getTimeMUS(), i, 0);
auto& tvf = mTracksPool.emplace_back(trc, tracksITSTPC[i].getTimeMUS(), GTrackID{i, o2::dataformats::GlobalTrackID::ITSTPC});
mStatZErr.add(std::sqrt(trc.getSigmaZ2()));
mStatTErr.add(tvf.timeEst.getTimeStampError());
}
Expand Down
Loading