17#ifndef ALICEO2_TPC_TRACKINTERPOLATION_H_
18#define ALICEO2_TPC_TRACKINTERPOLATION_H_
76 UnbinnedResid(
float dyIn,
float dzIn,
float tgSlpIn,
float yIn,
float zIn,
77 unsigned char rowIn,
unsigned char secIn,
short chanIn = -1,
bool rejFlag =
false) :
dy(static_cast<short>(dyIn * 0x7fff /
param::MaxResid)),
78 dz(static_cast<short>(dzIn * 0x7fff /
param::MaxResid)),
79 tgSlp(static_cast<short>(tgSlpIn * 0x7fff /
param::MaxTgSlp)),
80 y(static_cast<short>(yIn * 0x7fff /
param::MaxY)),
81 z(static_cast<short>(zIn * 0x7fff /
param::MaxZ)),
106 static void init(
long timestamp = -1);
117 uint16_t
qTotTPC()
const {
return static_cast<uint16_t
>(
word & 0xFFFFu); }
118 uint16_t
qMaxTPC()
const {
return static_cast<uint16_t
>((
word >> 16) & 0xFFFFu); }
119 void setTPC(uint16_t qTot, uint16_t qMax) {
word = (
static_cast<uint32_t
>(qMax) << 16) |
static_cast<uint32_t
>(qTot); }
137 uint32_t slpI = std::round(rslope);
141 static_cast<uint32_t
>(q0 &
TRDQ0Msk));
152 void setPV(
float t) {
word = std::bit_cast<uint32_t>(t); }
160 TrackDataCompact(uint32_t idx, std::array<uint8_t, 4> mlt, uint8_t nRes, uint8_t
source, uint8_t nextraRes = 0, int8_t filt = -1) :
idxFirstResidual(idx),
multStack{mlt},
nResiduals(nRes),
sourceId(
source),
filterFlag(filt),
nExtDetResid(nextraRes) {}
170 uint32_t mltPacked = std::round(std::asinh(
v * 0.05) / 0.05);
193 std::vector<o2::BaseCluster<float>>
clsITS{};
195 std::vector<o2::trd::CalibratedTracklet>
clsTRD{};
227 uint32_t mltPacked = std::round(std::asinh(
v * 0.05) / 0.05);
267 std::array<float, NIndices>
y{};
268 std::array<float, NIndices>
z{};
269 std::array<float, NIndices>
sy2{};
270 std::array<float, NIndices>
szy{};
271 std::array<float, NIndices>
sz2{};
272 std::array<float, NIndices>
snp{};
374 void diffToMA(
const int np,
const std::array<float, param::NPadRows>&
y, std::array<float, param::NPadRows>& diffMA);
408 std::array<float, 3>* trkltTRDCov =
nullptr,
TrackData* trkData =
nullptr,
427 static constexpr float sFloatEps{1.e-7f};
428 static constexpr int NSTACKS = 4;
429 static constexpr std::array<int, NSTACKS + 1> STACKROWS{0, 63, 97, 127, 152};
431 const SpacePointsCalibConfParam* mParams =
nullptr;
432 std::shared_ptr<o2::gpu::GPUParam> mTPCParam =
nullptr;
436 int mNTPCOccBinLength = 16;
437 float mNTPCOccBinLengthInv = 1.f / 16;
438 float mTPCTimeBinMUS{.2f};
439 float mTPCVDriftRef = -1.;
440 float mTPCDriftTimeOffsetRef = 0.;
441 float mSqrtS{13600.f};
443 int mMaxTracksPerTF{-1};
444 int mAddTracksForMapPerTF{0};
445 bool mDumpTrackPoints{
false};
446 bool mExtDetResid{
true};
447 bool mProcessSeeds{
false};
448 bool mProcessITSTPConly{
false};
451 bool mSingleSourcesConfigured{
true};
455 std::vector<o2::dataformats::GlobalTrackID> mGIDs{};
456 std::vector<o2::globaltracking::RecoContainer::GlobalIDSet> mGIDtables{};
457 std::vector<float> mTrackTimes{};
458 std::vector<int> mTrackPVID{};
459 std::vector<o2::track::TrackParCov> mSeeds{};
460 std::vector<int> mParentID{};
461 std::map<int, int> mTrackTypes;
462 std::array<std::vector<uint32_t>, 4> mTrackIndices;
463 gsl::span<const TPCClRefElem> mTPCTracksClusIdx;
464 const ClusterNativeAccess* mTPCClusterIdxStruct =
nullptr;
466 gsl::span<const int> mITSTrackClusIdx;
467 std::vector<o2::BaseCluster<float>> mITSClustersArray;
468 std::vector<int> mITSRefitSeedID;
472 std::vector<TrackData> mTrackData{};
473 std::vector<TrackDataCompact> mTrackDataCompact{};
474 std::vector<TrackDataExtended> mTrackDataExtended{};
475 std::vector<UnbinnedResid> mClRes{};
476 std::vector<DetInfoResid> mDetInfoRes{};
477 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
480 std::array<CacheStruct, constants::MAXGLOBALPADROW> mCache{{}};
481 std::vector<o2::dataformats::GlobalTrackID> mGIDsSuccess;
483 TrackValidationData mTrackValidation;
488 std::unique_ptr<TPCFastTransform> mFastTransform{};
490 bool mInitDone{
false};
491 size_t mRejectedResiduals{};
492 size_t mNRejRefit = 0;
493 size_t mNRejProp = 0;
494 size_t mNRejLoop = 0;
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.
float checkResiduals(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
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.
std::vector< TrackData > & getReferenceTracks()
void setExtDetResid(bool v)
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()
void interpolateTrack(int iSeed)
void setAddTracksForMapPerTF(int n)
In addition to mMaxTracksPerTF up to the set number of additional tracks can be processed.
@ 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
void setLane(int lID, int nL)
std::vector< DetInfoResid > & getClusterResidualsDetInfo()
void diffToMA(const int np, const std::array< float, param::NPadRows > &y, std::array< float, param::NPadRows > &diffMA)
For a given set of points, calculate their deviation from the moving average (build from the neighbou...
bool compareToHelix(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
void diffToLocLine(TrackValidationData ¶ms, int start, int np)
For a given set of points, calculate the differences from each point to the fitted lines from all oth...
void process()
Main processing function.
void setITSClusterDictionary(const o2::itsmft::TopologyDictionary *dict)
Allow setting the ITS cluster dictionary from outside.
std::vector< UnbinnedResid > & getClusterResiduals()
TrackInterpolation & operator=(const TrackInterpolation &)=delete
void setDumpTrackPoints()
Enable full output.
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
void setProcessITSTPConly()
Enable ITS-TPC only processing.
int8_t validateTrack(const TrackData &trk, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes, bool interpol)
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, TrackValidationData ¶ms, const std::vector< TPCClusterResiduals > &clsRes)
void init(o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap)
Initialize everything, set the requested track sources.
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.
ClassDefNV(TPCClusterResiduals, 5)
unsigned char dRow
distance to previous row in units of pad rows
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
void setMultStack(float v, int stack)
TrackDataCompact(uint32_t idx, std::array< uint8_t, 4 > mlt, uint8_t nRes, uint8_t source, uint8_t nextraRes=0, int8_t filt=-1)
float getMultStack(int stack) const
ClassDefNV(TrackDataCompact, 4)
float getMultStackPacked(int stack) const
int8_t filterFlag
-1: validation was not done, 0: validated, >0 : reason not passing validation, see validateTrack meth...
uint32_t idxFirstResidual
the index of the first residual from this track
TrackDataCompact()=default
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.
std::vector< o2::trd::Tracklet64 > trkltTRD
attached TRD tracklets (if available)
ClassDefNV(TrackDataExtended, 4)
o2::dataformats::GlobalTrackID gid
GID of the most global barrel track.
o2::tpc::TrackTPC trkTPC
TPC track (including dEdx information)
int8_t filterFlag
-1: validation was not done, 0: validated, >0 : reason not passing validation, see validateTrack meth...
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
o2::track::TrackParCov par
ITS track at inner TPC radius.
unsigned short nClsTPC
number of attached TPC clusters
void setMultStack(float v, int stack)
float getMultStack(int stack) const
ClassDefNV(TrackData, 12)
o2::dataformats::GlobalTrackID gid
global track ID for seeding track
float deltaTOF
TOFsignal - T0 - texp(PID), if T0 is available.
int8_t filterFlag
-1: validation was not done, 0: validated, >0 : reason not passing validation, see validateTrack meth...
uint8_t nExtDetResid
number of external detectors (to TPC) residuals stored, on top of clIdx.getEntries
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
std::vector< ValidationPoint > points
ClassDefNV(TrackValidationData, 1)
Structure for on-the-fly re-calculated track parameters at the validation stage.
ClassDefNV(ValidationPoint, 1)
ClassDefNV(UnbinnedResid, 3)
bool rejected
residual is flagged as rejected in the validateTrack
unsigned char sec
TPC sector (0..35)
UnbinnedResid(float dyIn, float dzIn, float tgSlpIn, float yIn, float zIn, unsigned char rowIn, unsigned char secIn, short chanIn=-1, bool rejFlag=false)
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)