16#ifndef _ALICEO2_STRANGENESS_TRACKER_
17#define _ALICEO2_STRANGENESS_TRACKER_
49namespace strangeness_tracking
60 std::array<int, 7>
arr;
110#ifdef ENABLE_UPGRADES
151 fitter.setUseAbsDCA(
true);
155 fitter.setUseAbsDCA(
true);
159 fitter.setUseAbsDCA(
true);
165 std::array<float, 3> momT, momP, momN;
166 v0.getProng(0).getPxPyPzGlo(momP);
167 v0.getProng(1).getPxPyPzGlo(momN);
168 v0.getPxPyPzGlo(momT);
169 float qNeg = momN[0] * momT[0] + momN[1] * momT[1] + momN[2] * momT[2];
170 float qPos = momP[0] * momT[0] + momP[1] * momT[1] + momP[2] * momT[2];
171 return (qPos - qNeg) / (qPos + qNeg);
174 double calcMotherMass(
const std::array<float, 3>& pDauFirst,
const std::array<float, 3>& pDauSecond,
PID pidDauFirst,
PID pidDauSecond)
176 double m2DauFirst = PID::getMass2(pidDauFirst);
177 double m2DauSecond = PID::getMass2(pidDauSecond);
178 double p2DauFirst = (pDauFirst[0] * pDauFirst[0]) + (pDauFirst[1] * pDauFirst[1]) + (pDauFirst[2] * pDauFirst[2]);
179 double p2DauSecond = (pDauSecond[0] * pDauSecond[0]) + (pDauSecond[1] * pDauSecond[1]) + (pDauSecond[2] * pDauSecond[2]);
180 float ePos = std::sqrt(p2DauFirst + m2DauFirst), eNeg = std::sqrt(p2DauSecond + m2DauSecond);
182 double e2Mother = (ePos + eNeg) * (ePos + eNeg);
183 double pxMother = (pDauFirst[0] + pDauSecond[0]);
184 double pyMother = (pDauFirst[1] + pDauSecond[1]);
185 double pzMother = (pDauFirst[2] + pDauSecond[2]);
186 double p2Mother = (pxMother * pxMother) + (pyMother * pyMother) + (pzMother * pzMother);
187 return std::sqrt(e2Mother - p2Mother);
190 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)
192 double m2DauFirst = PID::getMass2(pidDauFirst);
193 double m2DauSecond = PID::getMass2(pidDauSecond);
194 double m2DauThird = PID::getMass2(pidDauThird);
195 double p2DauFirst = (pDauFirst[0] * pDauFirst[0]) + (pDauFirst[1] * pDauFirst[1]) + (pDauFirst[2] * pDauFirst[2]);
196 double p2DauSecond = (pDauSecond[0] * pDauSecond[0]) + (pDauSecond[1] * pDauSecond[1]) + (pDauSecond[2] * pDauSecond[2]);
197 double p2DauThird = (pDauThird[0] * pDauThird[0]) + (pDauThird[1] * pDauThird[1]) + (pDauThird[2] * pDauThird[2]);
198 float eFirst = std::sqrt(p2DauFirst + m2DauFirst), eSecond = std::sqrt(p2DauSecond + m2DauSecond), eThird = std::sqrt(p2DauThird + m2DauThird);
200 double e2Mother = (eFirst + eSecond + eThird) * (eFirst + eSecond + eThird);
201 double pxMother = (pDauFirst[0] + pDauSecond[0] + pDauThird[0]);
202 double pyMother = (pDauFirst[1] + pDauSecond[1] + pDauThird[1]);
203 double pzMother = (pDauFirst[2] + pDauSecond[2] + pDauThird[2]);
204 double p2Mother = (pxMother * pxMother) + (pyMother * pyMother) + (pzMother * pzMother);
205 return std::sqrt(e2Mother - p2Mother);
212 nCand =
mFitterV0[iThread].process(posTrack, negTrack);
213 }
catch (std::runtime_error& e) {
216 if (!nCand || !
mFitterV0[iThread].propagateTracksToVertex()) {
220 const auto& v0XYZ =
mFitterV0[iThread].getPCACandidatePos();
222 auto& propPos =
mFitterV0[iThread].getTrack(0, 0);
223 auto& propNeg =
mFitterV0[iThread].getTrack(1, 0);
225 std::array<float, 3> pP, pN;
226 propPos.getPxPyPzGlo(pP);
227 propNeg.getPxPyPzGlo(pN);
228 std::array<float, 3> pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]};
229 newV0 =
V0(v0XYZ, pV0,
mFitterV0[iThread].calcPCACovMatrixFlat(0), propPos, propNeg, PID::HyperTriton);
235 std::vector<ITSCluster> outVec;
238 auto ncl = itsTrack.getNumberOfClusters();
239 for (
int icl = 0; icl < ncl; icl++) {
247 std::vector<int> outVec;
250 auto ncl = itsTrack.getNumberOfClusters();
251 for (
int icl = 0; icl < ncl; icl++) {
259 for (
unsigned int iClus{0}; iClus < ITSclus.size(); ++iClus) {
260 auto& clus = ITSclus[iClus];
261 auto pattID = clus.getPatternID();
273 clusSizeVec[offs + iClus] = npix;
278#ifdef ENABLE_UPGRADES
279 void getClusterSizesIT3(std::vector<int>& clusSizeVec,
int offs,
const gsl::span<const o2::itsmft::CompClusterExt> ITSclus, gsl::span<const unsigned char>::iterator& pattIt,
const o2::its3::TopologyDictionary* mdict)
281 for (
unsigned int iClus{0}; iClus < ITSclus.size(); ++iClus) {
282 auto& clus = ITSclus[iClus];
283 auto pattID = clus.getPatternID();
296 clusSizeVec[offs + iClus] = npix;
303 if (
v0.rotate(itsTrack.getParamOut().getAlpha()) &&
v0.propagateTo(itsTrack.getParamOut().getX(),
mBz)) {
304 return v0.getPredictedChi2(itsTrack.getParamOut());
313 for (
unsigned int iLay = 0; iLay < 7; iLay++) {
353#ifdef ENABLE_UPGRADES
Container of the ITS/MFT clusters addressed by the composed (layer,index) ID.
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.
const itsmft::ClusterPattern & getPattern(int n, bool IB=true) const
Returns the pattern of the topology.
int getNpixels(int n, bool IB=true) const
Returns the number of fired pixels of the n_th element.
bool isGroup(int n, bool IB=true) const
Returns true if the element corresponds to a group of rare topologies.
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.
void clear()
the clusters of all layers, to be appended to by the caller between beginLayer and finalize
int flatIndex(int composedID) const
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
global topology matching chi2
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)
std::vector< std::vector< o2::MCCompLabel > > mStrangeTrackLabels
StrangenessTracker()=default
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)
float mGlobalChi2
number of threads (externally driven)
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
ITSClusters mInputITSclusters
~StrangenessTracker()=default
ClassDefNV(StrangenessTracker, 1)
const o2::itsmft::TopologyDictionary * mITSDict
gsl::span< const CascadeIndex > mInputCascadeIndices
bool loadData(const o2::globaltracking::RecoContainer &recoData)
gsl::span< const Cascade > mInputCascadeTracks
std::vector< o2::MCCompLabel > & getStrangeTrackLabels(int iThread=0)
void getClusterSizesITS(std::vector< int > &clusSizeVec, int offs, const gsl::span< const o2::itsmft::CompClusterExt > ITSclus, gsl::span< const unsigned char >::iterator &pattIt, const o2::itsmft::TopologyDictionary *mdict)
MCLabSpan mITSTrkLabels
input ITS Cluster MC labels
bool getMCTruthOn() const
gsl::span< const o2::MCCompLabel > MCLabSpan
std::vector< int > mInputClusterSizes
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 ...