17#ifndef ALICEO2_TPC_TRACKINTERPOLATION_H_
18#define ALICEO2_TPC_TRACKINTERPOLATION_H_
75 UnbinnedResid(
float dyIn,
float dzIn,
float tgSlpIn,
float yIn,
float zIn,
unsigned char rowIn,
unsigned char secIn,
short chanIn = -1) :
dy(static_cast<short>(dyIn * 0x7fff /
param::MaxResid)),
76 dz(static_cast<short>(dzIn * 0x7fff /
param::MaxResid)),
77 tgSlp(static_cast<short>(tgSlpIn * 0x7fff /
param::MaxTgSlp)),
78 y(static_cast<short>(yIn * 0x7fff /
param::MaxY)),
79 z(static_cast<short>(zIn * 0x7fff /
param::MaxZ)),
102 static void init(
long timestamp = -1);
113 uint16_t
qTotTPC()
const {
return static_cast<uint16_t
>(
word & 0xFFFFu); }
114 uint16_t
qMaxTPC()
const {
return static_cast<uint16_t
>((
word >> 16) & 0xFFFFu); }
115 void setTPC(uint16_t qTot, uint16_t qMax) {
word = (
static_cast<uint32_t
>(qMax) << 16) |
static_cast<uint32_t
>(qTot); }
133 uint32_t slpI = std::round(rslope);
137 static_cast<uint32_t
>(q0 &
TRDQ0Msk));
148 void setPV(
float t) {
word = std::bit_cast<uint32_t>(t); }
165 uint32_t mltPacked = std::round(std::asinh(
v * 0.05) / 0.05);
188 std::vector<o2::BaseCluster<float>>
clsITS{};
190 std::vector<o2::trd::CalibratedTracklet>
clsTRD{};
220 uint32_t mltPacked = std::round(std::asinh(
v * 0.05) / 0.05);
258 std::array<float, NIndices>
y{};
259 std::array<float, NIndices>
z{};
260 std::array<float, NIndices>
sy2{};
261 std::array<float, NIndices>
szy{};
262 std::array<float, NIndices>
sz2{};
263 std::array<float, NIndices>
snp{};
276 std::array<float, param::NPadRows>
zTrk{};
277 std::array<float, param::NPadRows>
xTrk{};
278 std::array<float, param::NPadRows>
dy{};
279 std::array<float, param::NPadRows>
dz{};
280 std::array<float, param::NPadRows>
tglArr{};
338 void diffToLocLine(
const int np,
int idxOffset,
const std::array<float, param::NPadRows>&
x,
const std::array<float, param::NPadRows>&
y, std::array<float, param::NPadRows>& diffY)
const;
341 void diffToMA(
const int np,
const std::array<float, param::NPadRows>&
y, std::array<float, param::NPadRows>& diffMA)
const;
375 std::array<float, 3>* trkltTRDCov =
nullptr,
TrackData* trkData =
nullptr,
388 static constexpr float sFloatEps{1.e-7f};
389 static constexpr int NSTACKS = 4;
390 static constexpr std::array<int, NSTACKS + 1> STACKROWS{0, 63, 97, 127, 152};
392 const SpacePointsCalibConfParam* mParams =
nullptr;
393 std::shared_ptr<o2::gpu::GPUParam> mTPCParam =
nullptr;
395 int mNTPCOccBinLength = 16;
396 float mNTPCOccBinLengthInv = 1.f / 16;
397 float mTPCTimeBinMUS{.2f};
398 float mTPCVDriftRef = -1.;
399 float mTPCDriftTimeOffsetRef = 0.;
400 float mSqrtS{13600.f};
402 int mMaxTracksPerTF{-1};
403 int mAddTracksForMapPerTF{0};
404 bool mDumpTrackPoints{
false};
405 bool mExtDetResid{
true};
406 bool mProcessSeeds{
false};
407 bool mProcessITSTPConly{
false};
410 bool mSingleSourcesConfigured{
true};
414 std::vector<o2::dataformats::GlobalTrackID> mGIDs{};
415 std::vector<o2::globaltracking::RecoContainer::GlobalIDSet> mGIDtables{};
416 std::vector<float> mTrackTimes{};
417 std::vector<int> mTrackPVID{};
418 std::vector<o2::track::TrackParCov> mSeeds{};
419 std::vector<int> mParentID{};
420 std::map<int, int> mTrackTypes;
421 std::array<std::vector<uint32_t>, 4> mTrackIndices;
422 gsl::span<const TPCClRefElem> mTPCTracksClusIdx;
423 const ClusterNativeAccess* mTPCClusterIdxStruct =
nullptr;
425 gsl::span<const int> mITSTrackClusIdx;
426 std::vector<o2::BaseCluster<float>> mITSClustersArray;
427 std::vector<int> mITSRefitSeedID;
431 std::vector<TrackData> mTrackData{};
432 std::vector<TrackDataCompact> mTrackDataCompact{};
433 std::vector<TrackDataExtended> mTrackDataExtended{};
434 std::vector<UnbinnedResid> mClRes{};
435 std::vector<DetInfoResid> mDetInfoRes{};
436 std::vector<TrackData> mTrackDataUnfiltered{};
437 std::vector<TPCClusterResiduals> mClResUnfiltered{};
440 std::array<CacheStruct, constants::MAXGLOBALPADROW> mCache{{}};
441 std::vector<o2::dataformats::GlobalTrackID> mGIDsSuccess;
446 std::unique_ptr<TPCFastTransform> mFastTransform{};
448 bool mInitDone{
false};
449 size_t mRejectedResiduals{};
Class to store event ID and index in the event for objects like track, cluster...
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Class to store the output of the matching to TOF.
Class to refer to the 1st entry and N elements of some group in the continuous container.
Parameters used for TPC space point calibration.
Definition of the ITS track.
Result of refitting TPC-ITS matched track.
Reference on ITS/MFT clusters set.
TrackInterpolation(const TrackInterpolation &)=delete
void prepareInputTrackSample(const o2::globaltracking::RecoContainer &inp)
Prepare input track sample (not relying on CreateTracksVariadic functionality)
int processTRDLayer(const o2::trd::TrackTRD &trkTRD, int iLayer, o2::track::TrackParCov &trkWork, std::array< float, 2 > *trkltTRDYZ=nullptr, std::array< float, 3 > *trkltTRDCov=nullptr, TrackData *trkData=nullptr, o2::trd::Tracklet64 *trk64=nullptr, o2::trd::CalibratedTracklet *trkCalib=nullptr)
bool isInputTrackAccepted(const o2::dataformats::GlobalTrackID &gid, const o2::globaltracking::RecoContainer::GlobalIDSet &gidTable, const o2::dataformats::PrimaryVertex &pv) const
Check if input track passes configured cuts.
void diffToMA(const int np, const std::array< float, param::NPadRows > &y, std::array< float, param::NPadRows > &diffMA) const
For a given set of points, calculate their deviation from the moving average (build from the neighbou...
std::vector< TrackData > & getReferenceTracks()
void setExtDetResid(bool v)
void diffToLocLine(const int np, int idxOffset, const std::array< float, param::NPadRows > &x, const std::array< float, param::NPadRows > &y, std::array< float, param::NPadRows > &diffY) const
For a given set of points, calculate the differences from each point to the fitted lines from all oth...
std::vector< TrackData > & getReferenceTracksUnfiltered()
void extrapolateTrack(int iSeed)
TrackInterpolation()=default
Default constructor.
std::vector< TrackDataExtended > & getTrackDataExtended()
o2::dataformats::GlobalTrackID::Source findValidSource(const o2::dataformats::GlobalTrackID::mask_t mask, const o2::dataformats::GlobalTrackID::Source src) const
For given vertex track source which is not in mSourcesConfigured find the seeding source which is ena...
void setMatCorr(MatCorrType matCorr)
Sets the flag if material correction should be applied when extrapolating the tracks.
void setProcessSeeds()
Enable processing of seeds.
void setMaxTracksPerTF(int n)
Sets the maximum number of tracks to be processed (successfully) per TF.
bool refITSTrack(o2::dataformats::GlobalTrackID, int iSeed)
std::vector< TrackDataCompact > & getTrackDataCompact()
float checkResiduals(const TrackData &trk, TrackParams ¶ms, const std::vector< TPCClusterResiduals > &clsRes) const
void interpolateTrack(int iSeed)
void setAddTracksForMapPerTF(int n)
In addition to mMaxTracksPerTF up to the set number of additional tracks can be processed.
std::vector< DetInfoResid > & getClusterResidualsDetInfo()
bool compareToHelix(const TrackData &trk, TrackParams ¶ms, const std::vector< TPCClusterResiduals > &clsRes) const
std::vector< TPCClusterResiduals > & getClusterResidualsUnfiltered()
void process()
Main processing function.
void setITSClusterDictionary(const o2::itsmft::TopologyDictionary *dict)
Allow setting the ITS cluster dictionary from outside.
std::vector< UnbinnedResid > & getClusterResiduals()
@ ExtIn
extrapolation inwards of TRD/TOF track
@ NIndices
total number of indices (3)
@ Int
interpolation (mean positions of both extrapolations)
@ ExtOut
extrapolation outwards of ITS track
TrackInterpolation & operator=(const TrackInterpolation &)=delete
void setDumpTrackPoints()
Enable full output.
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
void setProcessITSTPConly()
Enable ITS-TPC only processing.
void setSqrtS(float s)
Set the centre of mass energy required for pT downsampling Tsalis function.
bool isTrackSelected(const o2::track::TrackParCov &trk) const
Given the defined downsampling factor tsalisThreshold check if track is selected.
void reset()
Reset cache and output vectors.
bool outlierFiltering(const TrackData &trk, TrackParams ¶ms, const std::vector< TPCClusterResiduals > &clsRes) const
void init(o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap)
Initialize everything, set the requested track sources.
bool validateTrack(const TrackData &trk, TrackParams ¶ms, const std::vector< TPCClusterResiduals > &clsRes) const
GLsizei GLsizei GLchar * source
GLenum const GLfloat * params
GLdouble GLdouble GLdouble z
constexpr int MAXGLOBALPADROW
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< GTrackID, GTrackID::NSources > GlobalIDSet
static constexpr uint32_t TRDQ2Msk
ClassDefNV(DetInfoResid, 1)
static constexpr float TRDSlope2Int
static constexpr uint32_t TRDQ1Msk
static constexpr uint32_t TRDSlpMsk
static constexpr uint32_t TRDQ0NB
static constexpr uint32_t TRDQ2NB
void setTRD(uint8_t q0, uint8_t q1, uint8_t q2, float slope)
static constexpr float TRDInt2Slope
static constexpr float TRDMaxSlope
void setTPC(uint16_t qTot, uint16_t qMax)
static constexpr uint32_t TRDQ1NB
static constexpr uint32_t TRDQ0Msk
static constexpr uint32_t TRDSlpNB
Internal struct used to store the unbinned TPC cluster residuals with float values.
unsigned char dRow
distance to previous row in units of pad rows
ClassDefNV(TPCClusterResiduals, 4)
unsigned char sec
sector number 0..35
float snp
sin of the phi angle between padrow and track
Structure for the information required to associate each residual with a given track type (ITS-TPC-TR...
uint8_t nResiduals
total number of TPC residuals associated to this track
uint8_t sourceId
source ID obtained from the global track ID
uint8_t nExtDetResid
number of external detectors (wrt TPC) residuals stored, on top of clIdx.getEntries
std::array< uint8_t, 4 > multStack
ClassDefNV(TrackDataCompact, 3)
void setMultStack(float v, int stack)
float getMultStack(int stack) const
float getMultStackPacked(int stack) const
uint32_t idxFirstResidual
the index of the first residual from this track
TrackDataCompact()=default
TrackDataCompact(uint32_t idx, std::array< uint8_t, 4 > mlt, uint8_t nRes, uint8_t source, uint8_t nextraRes=0)
Heavy structure with track parameterizations + track points for debugging.
o2::dataformats::RangeReference clIdx
index of first cluster residual and total number of cluster residuals of this track
std::vector< o2::trd::CalibratedTracklet > clsTRD
the TRD space points (if available)
o2::dataformats::MatchInfoTOF matchTOF
TOF matching information.
o2::track::TrackPar trkOuter
refit of TRD and/or TOF points
o2::its::TrackITS trkITS
ITS seeding track.
uint8_t nExtDetResid
number of external detectors (to TPC) residuals stored, on top of clIdx.getEntries
o2::trd::TrackTRD trkTRD
TRD seeding track.
ClassDefNV(TrackDataExtended, 3)
std::vector< o2::trd::Tracklet64 > trkltTRD
attached TRD tracklets (if available)
o2::dataformats::GlobalTrackID gid
GID of the most global barrel track.
o2::tpc::TrackTPC trkTPC
TPC track (including dEdx information)
std::vector< o2::BaseCluster< float > > clsITS
attached ITS clusters
o2::tof::Cluster clsTOF
the TOF cluster (if available)
Structure filled for each track with track quality information and a vector with TPCClusterResiduals.
float chi2TRD
chi2 of TRD track
float dEdxTPC
TPC dEdx information.
unsigned short nTrkltsTRD
number of attached TRD tracklets
float getMultStackPacked(int stack) const
unsigned short clAvailTOF
whether or not track seed has a matched TOF cluster, if so, gives the resolution of the T0 in ps
std::array< uint8_t, 4 > multStack
short TRDTrkltSlope[6]
TRD tracklet slope 0x7fff / param::MaxTRDSlope.
unsigned short nClsITS
number of attached ITS clusters
o2::dataformats::RangeReference clIdx
index of first cluster residual and total number of TPC cluster residuals of this track
float chi2TPC
chi2 of TPC track
unsigned short nClsTPC
number of attached TPC clusters
void setMultStack(float v, int stack)
float getMultStack(int stack) const
o2::dataformats::GlobalTrackID gid
global track ID for seeding track
ClassDefNV(TrackData, 10)
float deltaTOF
TOFsignal - T0 - texp(PID), if T0 is available.
uint8_t nExtDetResid
number of external detectors (to TPC) residuals stored, on top of clIdx.getEntries
o2::track::TrackPar par
ITS track at inner TPC radius.
float chi2ITS
chi2 of ITS track
Structure for caching positions, covariances and angles for extrapolations from ITS and TRD/TOF and f...
unsigned short clAvailable
std::array< float, NIndices > sz2
std::array< float, NIndices > szy
std::array< float, NIndices > snp
std::array< float, NIndices > sy2
Structure for on-the-fly re-calculated track parameters at the validation stage.
std::array< float, param::NPadRows > dz
std::array< float, param::NPadRows > tglArr
std::bitset< param::NPadRows > flagRej
std::array< float, param::NPadRows > dy
std::array< float, param::NPadRows > xTrk
std::array< float, param::NPadRows > zTrk
UnbinnedResid(float dyIn, float dzIn, float tgSlpIn, float yIn, float zIn, unsigned char rowIn, unsigned char secIn, short chanIn=-1)
unsigned char sec
TPC sector (0..35)
ClassDefNV(UnbinnedResid, 2)
unsigned char row
TPC pad row.
short tgSlp
tan of the phi angle between padrow and track
static void init(long timestamp=-1)
static void checkInitDone()
short channel
extra channel info (ITS chip ID, TRD chamber, TOF main pad within the sector)