16#ifndef _ALICEO2_STRANGENESS_TRACKER_
17#define _ALICEO2_STRANGENESS_TRACKER_
48namespace strangeness_tracking
59 std::array<unsigned int, 7>
arr;
108#ifdef ENABLE_UPGRADES
149 fitter.setUseAbsDCA(
true);
153 fitter.setUseAbsDCA(
true);
157 fitter.setUseAbsDCA(
true);
163 std::array<float, 3> momT, momP, momN;
164 v0.getProng(0).getPxPyPzGlo(momP);
165 v0.getProng(1).getPxPyPzGlo(momN);
166 v0.getPxPyPzGlo(momT);
167 float qNeg = momN[0] * momT[0] + momN[1] * momT[1] + momN[2] * momT[2];
168 float qPos = momP[0] * momT[0] + momP[1] * momT[1] + momP[2] * momT[2];
169 return (qPos - qNeg) / (qPos + qNeg);
172 double calcMotherMass(
const std::array<float, 3>& pDauFirst,
const std::array<float, 3>& pDauSecond,
PID pidDauFirst,
PID pidDauSecond)
174 double m2DauFirst = PID::getMass2(pidDauFirst);
175 double m2DauSecond = PID::getMass2(pidDauSecond);
176 double p2DauFirst = (pDauFirst[0] * pDauFirst[0]) + (pDauFirst[1] * pDauFirst[1]) + (pDauFirst[2] * pDauFirst[2]);
177 double p2DauSecond = (pDauSecond[0] * pDauSecond[0]) + (pDauSecond[1] * pDauSecond[1]) + (pDauSecond[2] * pDauSecond[2]);
178 float ePos = std::sqrt(p2DauFirst + m2DauFirst), eNeg = std::sqrt(p2DauSecond + m2DauSecond);
180 double e2Mother = (ePos + eNeg) * (ePos + eNeg);
181 double pxMother = (pDauFirst[0] + pDauSecond[0]);
182 double pyMother = (pDauFirst[1] + pDauSecond[1]);
183 double pzMother = (pDauFirst[2] + pDauSecond[2]);
184 double p2Mother = (pxMother * pxMother) + (pyMother * pyMother) + (pzMother * pzMother);
185 return std::sqrt(e2Mother - p2Mother);
188 double calcMotherMass3body(
const std::array<float, 3>& pDauFirst,
const std::array<float, 3>& pDauSecond,
const std::array<float, 3>& pDauThird,
PID pidDauFirst,
PID pidDauSecond,
PID pidDauThird)
190 double m2DauFirst = PID::getMass2(pidDauFirst);
191 double m2DauSecond = PID::getMass2(pidDauSecond);
192 double m2DauThird = PID::getMass2(pidDauThird);
193 double p2DauFirst = (pDauFirst[0] * pDauFirst[0]) + (pDauFirst[1] * pDauFirst[1]) + (pDauFirst[2] * pDauFirst[2]);
194 double p2DauSecond = (pDauSecond[0] * pDauSecond[0]) + (pDauSecond[1] * pDauSecond[1]) + (pDauSecond[2] * pDauSecond[2]);
195 double p2DauThird = (pDauThird[0] * pDauThird[0]) + (pDauThird[1] * pDauThird[1]) + (pDauThird[2] * pDauThird[2]);
196 float eFirst = std::sqrt(p2DauFirst + m2DauFirst), eSecond = std::sqrt(p2DauSecond + m2DauSecond), eThird = std::sqrt(p2DauThird + m2DauThird);
198 double e2Mother = (eFirst + eSecond + eThird) * (eFirst + eSecond + eThird);
199 double pxMother = (pDauFirst[0] + pDauSecond[0] + pDauThird[0]);
200 double pyMother = (pDauFirst[1] + pDauSecond[1] + pDauThird[1]);
201 double pzMother = (pDauFirst[2] + pDauSecond[2] + pDauThird[2]);
202 double p2Mother = (pxMother * pxMother) + (pyMother * pyMother) + (pzMother * pzMother);
203 return std::sqrt(e2Mother - p2Mother);
210 nCand =
mFitterV0[iThread].process(posTrack, negTrack);
211 }
catch (std::runtime_error& e) {
214 if (!nCand || !
mFitterV0[iThread].propagateTracksToVertex()) {
218 const auto& v0XYZ =
mFitterV0[iThread].getPCACandidatePos();
220 auto& propPos =
mFitterV0[iThread].getTrack(0, 0);
221 auto& propNeg =
mFitterV0[iThread].getTrack(1, 0);
223 std::array<float, 3> pP, pN;
224 propPos.getPxPyPzGlo(pP);
225 propNeg.getPxPyPzGlo(pN);
226 std::array<float, 3> pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]};
233 std::vector<ITSCluster> outVec;
236 auto ncl = itsTrack.getNumberOfClusters();
237 for (
int icl = 0; icl < ncl; icl++) {
245 std::vector<int> outVec;
248 auto ncl = itsTrack.getNumberOfClusters();
249 for (
int icl = 0; icl < ncl; icl++) {
257 for (
unsigned int iClus{0}; iClus < ITSclus.size(); ++iClus) {
258 auto& clus = ITSclus[iClus];
259 auto pattID = clus.getPatternID();
271 clusSizeVec[iClus] = npix;
276#ifdef ENABLE_UPGRADES
277 void getClusterSizesIT3(std::vector<int>& clusSizeVec,
const gsl::span<const o2::itsmft::CompClusterExt> ITSclus, gsl::span<const unsigned char>::iterator& pattIt,
const o2::its3::TopologyDictionary* mdict)
279 for (
unsigned int iClus{0}; iClus < ITSclus.size(); ++iClus) {
280 auto& clus = ITSclus[iClus];
281 auto pattID = clus.getPatternID();
293 clusSizeVec[iClus] = npix;
301 if (
v0.rotate(itsTrack.getParamOut().getAlpha()) &&
v0.propagateTo(itsTrack.getParamOut().getX(),
mBz)) {
302 return v0.getPredictedChi2(itsTrack.getParamOut());
311 for (
unsigned int iLay = 0; iLay < 7; iLay++) {
350#ifdef ENABLE_UPGRADES
Definition of the ITSMFT compact cluster.
Defintions for N-prongs secondary vertex fit.
Definition of the BuildTopologyDictionary class for ITS3.
Definition of the GeometryTGeo class.
Definition of the ITS track.
Extention of GlobalTrackID by flags relevant for verter-track association.
Referenc on track indices contributing to the vertex, with possibility chose tracks from specific sou...
void setFakeFlag(bool v=true)
TO BE DONE: extend to generic N body vertex.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
int getNpixels(int n) const
Returns the number of fired pixels of the n_th element.
const itsmft::ClusterPattern & getPattern(int n) const
Returns the pattern of the topology.
bool hasHitOnLayer(uint32_t i) const
bool isFakeOnLayer(uint32_t i) const
int getFirstClusterEntry() const
void acquirePattern(iterator &pattIt)
int getNPixels() const
Returns the number of fired pixels.
static constexpr unsigned short InvalidPatternID
const ClusterPattern & getPattern(int n) const
Returns the pattern of the topology.
int getNpixels(int n) const
Returns the number of fired pixels of the n_th element.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
void setConfigParams(const StrangenessTrackingParamConfig *params)
const MCLabContCl * mITSClsLabels
std::vector< std::vector< o2::track::TrackParCovF > > mDaughterTracks
std::vector< DCAFitter2 > mFitterV0
o2::MCCompLabel getStrangeTrackLabel(const TrackITS &itsTrack, const StrangeTrack &strangeTrack, const ClusAttachments &structClus)
double calcV0alpha(const V0 &v0)
const StrangenessTrackingParamConfig * mStrParams
double calcMotherMass(const std::array< float, 3 > &pDauFirst, const std::array< float, 3 > &pDauSecond, PID pidDauFirst, PID pidDauSecond)
gsl::span< const TrackITS > mInputITStracks
number of threads (externally driven)
int mNThreads
flag availability of MC truth
std::vector< std::vector< StrangeTrack > > mStrangeTrackVec
std::vector< int > mTracksIdxTable
void processV0(int iv0, const V0 &v0, const V0Index &v0Idx, int iThread=0)
std::vector< StrangeTrack > & getStrangeTrackVec(int iThread=0)
void processCascade(int icasc, const Cascade &casc, const CascadeIndex &cascIdx, const V0 &cascV0, int iThread=0)
std::vector< ITSCluster > getTrackClusters(const TrackITS &itsTrack)
void setupThreads(int nThreads=1)
std::vector< DCAFitter4 > mFitter4Body
o2::base::PropagatorImpl< float >::MatCorrType mCorrType
std::vector< int > getTrackClusterSizes(const TrackITS &itsTrack)
void getClusterSizesITS(std::vector< int > &clusSizeVec, const gsl::span< const o2::itsmft::CompClusterExt > ITSclus, gsl::span< const unsigned char >::iterator &pattIt, const o2::itsmft::TopologyDictionary *mdict)
std::vector< std::vector< o2::MCCompLabel > > mStrangeTrackLabels
StrangenessTracker()=default
std::vector< ITSCluster > mInputITSclusters
bool matchDecayToITStrack(float decayR, StrangeTrack &strangeTrack, ClusAttachments &structClus, const TrackITS &itsTrack, std::vector< o2::track::TrackParCovF > &daughterTracks, int iThread=0)
void setCorrType(const o2::base::PropagatorImpl< float >::MatCorrType &type)
std::vector< o2::its::TrackITS > mSortedITStracks
input ITS Track MC labels
gsl::span< const Decay3Body > mInput3BodyTracks
bool recreateV0(const o2::track::TrackParCov &posTrack, const o2::track::TrackParCov &negTrack, V0 &newV0, int iThread=0)
std::vector< std::vector< ClusAttachments > > mClusAttachments
std::vector< DCAFitter3 > mFitter3Body
std::vector< ClusAttachments > & getClusAttachments(int iThread=0)
std::vector< VBracket > mITSvtxBrackets
std::vector< int > mSortedITSindexes
double calcMotherMass3body(const std::array< float, 3 > &pDauFirst, const std::array< float, 3 > &pDauSecond, const std::array< float, 3 > &pDauThird, PID pidDauFirst, PID pidDauSecond, PID pidDauThird)
gsl::span< const V0Index > mInputV0Indices
bool updateTrack(const ITSCluster &clus, o2::track::TrackParCov &track)
void process3Body(int i3body, const Decay3Body &dec3body, const Decay3BodyIndex &dec3bodyIdx, int iThread=0)
gsl::span< const Decay3BodyIndex > mInput3BodyIndices
float getMatchingChi2(o2::track::TrackParCovF v0, const TrackITS &itsTrack)
void setClusterDictionaryITS(const o2::itsmft::TopologyDictionary *d)
gsl::span< const int > mInputITSidxs
void setMCTruthOn(bool v)
gsl::span< const V0 > mInputV0tracks
size_t getNTracks(int ithread=0) const
~StrangenessTracker()=default
ClassDefNV(StrangenessTracker, 1)
const o2::itsmft::TopologyDictionary * mITSDict
gsl::span< const CascadeIndex > mInputCascadeIndices
ClusAttachments mStructClus
bool loadData(const o2::globaltracking::RecoContainer &recoData)
gsl::span< const Cascade > mInputCascadeTracks
std::vector< o2::MCCompLabel > & getStrangeTrackLabels(int iThread=0)
MCLabSpan mITSTrkLabels
input ITS Cluster MC labels
bool getMCTruthOn() const
gsl::span< const o2::MCCompLabel > MCLabSpan
std::vector< int > mInputClusterSizes
static constexpr ID HyperTriton
GLint GLint GLsizei GLint GLenum GLenum type
GLenum const GLfloat * params
TrackParametrizationWithError< float > TrackParCovF
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< unsigned int, 7 > arr