25namespace strangeness_tracking
39 LOGP(fatal,
"Mismatch between input SVertices indices and kinematics (not requested?): V0: {}/{} Cascades: {}/{} Decay3Bodys: {}/{}",
48 for (
int lr = 0; lr < nLr; lr++) {
52 auto pattIt = clusPatt.begin();
53 auto pattIt2 = clusPatt.begin();
82 int nv = vtxRefs.size();
83 for (
int iv = 0; iv < nv; iv++) {
84 const auto& vtref = vtxRefs[iv];
85 int it = vtref.getFirstEntry(), itLim = it + vtref.getEntries();
86 for (; it < itLim; it++) {
87 auto tvid = trackIndex[it];
112 LOG(
debug) <<
"VtxRefs size: " << vtxRefs.size();
130 std::sort(
mSortedITSindexes.begin(),
mSortedITSindexes.end(), [&](
int i,
int j) { return mUtils.getBinIndex(mInputITStracks[i].getEta(), mInputITStracks[i].getPhi()) < mUtils.getBinIndex(mInputITStracks[j].getEta(), mInputITStracks[j].getPhi()); });
146 daughterTracks.resize(2);
151 if (posTrack.getPID() != PID::Alpha) {
152 posTrack.setPID(PID::Helium3,
true);
155 if (negTrack.getPID() != PID::Alpha) {
156 negTrack.setPID(PID::Helium3,
true);
160 if (!
recreateV0(posTrack, negTrack, correctedV0, iThread)) {
165 auto v0R = std::sqrt(
v0.calcR2());
167 for (
int& iBinV0 : iBinsV0) {
181 LOG(
debug) <<
"Mother propagation to decay vertex failed";
184 decayVtxTrackClone.getPxPyPzGlo(strangeTrack.
mDecayMom);
185 std::array<float, 3> momPos, momNeg;
196 LOG(
debug) <<
"ITS Track matched with a V0 decay topology ....";
197 LOG(
debug) <<
"Number of ITS track clusters attached: " << itsTrack.getNumberOfClusters();
215 daughterTracks.resize(3);
220 auto cascR = std::sqrt(casc.
calcR2());
222 for (
int& iBinCasc : iBinsCasc) {
230 LOG(
debug) <<
"----------------------";
240 LOG(
debug) <<
"Mother propagation to decay vertex failed";
243 decayVtxTrackClone.getPxPyPzGlo(strangeTrack.
mDecayMom);
244 std::array<float, 3> momV0, momBach;
246 mFitter3Body[iThread].getTrack(1).getPxPyPzGlo(momBach);
250 LOG(
debug) <<
"ITS Track matched with a Cascade decay topology ....";
251 LOG(
debug) <<
"Number of ITS track clusters attached: " << itsTrack.getNumberOfClusters();
271 daughterTracks.resize(3);
275 auto dec3bodyR = std::sqrt(dec3body.
calcR2());
277 for (
int& iBin3Body : iBins3Body) {
289 if (
matchDecayToITStrack(dec3bodyR, strangeTrack, structClus, itsTrack, daughterTracks, iThread)) {
293 LOG(
debug) <<
"Mother propagation to decay vertex failed";
296 decayVtxTrackClone.getPxPyPzGlo(strangeTrack.
mDecayMom);
297 std::array<float, 3> momPos, momNeg, momBach;
303 if (daughterTracks[
kBach].getCharge() > 0) {
309 LOG(
debug) <<
"ITS Track matched with a dec3body decay topology ....";
310 LOG(
debug) <<
"Number of ITS track clusters attached: " << itsTrack.getNumberOfClusters();
355 auto& lastClus = trackClusters[0];
360 std::vector<ITSCluster> motherClusters;
361 std::array<int, 7> nAttachments;
362 nAttachments.fill(-1);
365 bool isMotherUpdated =
false;
367 for (
int iClus{0}; iClus < trackClusters.size(); iClus++) {
368 auto& clus = trackClusters[iClus];
369 auto& compClus = trackClusSizes[iClus];
370 int nUpdOld = nUpdates;
371 double clusRad = sqrt(clus.getX() * clus.getX() - clus.getY() * clus.getY());
372 auto diffR = decayR - clusRad;
373 auto relDiffR = diffR / decayR;
374 auto lay = geom->getLayer(clus.getSensorID());
376 LOG(
debug) <<
"decayR: " << decayR <<
", diffR: " << diffR <<
", clus rad: " << clusRad <<
", radTol: " << radTol;
377 if (relDiffR > -radTol) {
378 LOG(
debug) <<
"Try to attach cluster to Mother, layer: " << lay;
380 motherClusters.push_back(clus);
382 nAttachments[lay] = 0;
383 isMotherUpdated =
true;
385 LOG(
debug) <<
"Cluster attached to Mother";
391 if (relDiffR < radTol && !isMotherUpdated) {
392 bool isDauUpdated =
false;
393 LOG(
debug) <<
"Try to attach cluster to Daughters, layer: " << lay;
394 for (
int iDau{0}; iDau < daughterTracks.size(); iDau++) {
395 auto& dauTrack = daughterTracks[iDau];
397 nAttachments[lay] = iDau + 1;
407 if (nUpdates == nUpdOld) {
412 if (nUpdates < trackClusters.size() || motherClusters.size() < nMinClusMother) {
417 motherTrackClone.resetCovariance();
419 LOG(
debug) <<
"Clusters attached, starting inward-outward refit";
421 std::reverse(motherClusters.begin(), motherClusters.end());
424 for (
auto& clus : motherClusters) {
431 LOG(
debug) <<
"Inward-outward refit finished, starting final topology refit";
441 LOG(
debug) <<
"Cascade V0 refit failed";
445 nCand =
mFitter3Body[iThread].process(cascV0Upd, daughterTracks[
kBach], motherTrackClone);
446 }
catch (std::runtime_error& e) {
447 LOG(
debug) <<
"Fitter3Body failed: " << e.what();
450 if (!nCand || !
mFitter3Body[iThread].propagateTracksToVertex()) {
451 LOG(
debug) <<
"Fitter3Body failed: propagation to vertex failed";
460 }
catch (std::runtime_error& e) {
461 LOG(
debug) <<
"Fitter3Body failed: " << e.what();
464 if (!nCand || !
mFitter3Body[iThread].propagateTracksToVertex()) {
465 LOG(
debug) <<
"Fitter3Body failed: propagation to vertex failed";
474 }
catch (std::runtime_error& e) {
475 LOG(
debug) <<
"Fitter4Body failed: " << e.what();
478 if (!nCand || !
mFitter4Body[iThread].propagateTracksToVertex()) {
479 LOG(
debug) <<
"Fitter4Body failed: propagation to vertex failed";
491 structClus.
arr = nAttachments;
502 if (!track.rotate(
alpha)) {
510 if (
mCorrType == o2::base::PropagatorF::MatCorrType::USEMatCorrNONE) {
511 float thick =
layer < 3 ? 0.005 : 0.01;
512 constexpr float radl = 9.36f;
513 constexpr float rho = 2.33f;
514 if (!track.correctForMaterial(thick, thick * rho * radl)) {
518 auto chi2 = track.getPredictedChi2Quiet(clus);
523 if (!track.update(clus)) {
std::int16_t getSensorID() const
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
static const GlobalParams & Instance()
TO BE DONE: extend to generic N body vertex.
const Track & getProng(int i) const
GIndex getProngID(int i) const
static GeometryTGeo * Instance()
void beginLayer(int lr)
to be called once all the layers were filled
void init(int nLr)
< prepare for filling nLr layer slots, discarding the previous content
const MCLabContCl * mITSClsLabels
std::vector< std::vector< o2::track::TrackParCovF > > mDaughterTracks
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
std::vector< std::vector< StrangeTrack > > mStrangeTrackVec
std::vector< int > mTracksIdxTable
void processV0(int iv0, const V0 &v0, const V0Index &v0Idx, 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)
std::vector< DCAFitter4 > mFitter4Body
o2::base::PropagatorImpl< float >::MatCorrType mCorrType
std::vector< int > getTrackClusterSizes(const TrackITS &itsTrack)
std::vector< std::vector< o2::MCCompLabel > > mStrangeTrackLabels
bool matchDecayToITStrack(float decayR, StrangeTrack &strangeTrack, ClusAttachments &structClus, const TrackITS &itsTrack, std::vector< o2::track::TrackParCovF > &daughterTracks, int iThread=0)
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< 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
gsl::span< const int > mInputITSidxs
gsl::span< const V0 > mInputV0tracks
ITSClusters mInputITSclusters
const o2::itsmft::TopologyDictionary * mITSDict
gsl::span< const CascadeIndex > mInputCascadeIndices
bool loadData(const o2::globaltracking::RecoContainer &recoData)
gsl::span< const Cascade > mInputCascadeTracks
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
std::vector< int > mInputClusterSizes
GLfloat GLfloat GLfloat alpha
GLboolean GLboolean GLboolean b
GLenum GLuint GLint GLint layer
GLboolean GLboolean GLboolean GLboolean a
constexpr int MaxITSLayers
void convertCompactClusters(gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, std::vector< o2::BaseCluster< float > > &output, const o2::its3::TopologyDictionary *dict)
convert compact clusters to 3D spacepoints
void convertCompactClusters(gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, std::vector< o2::BaseCluster< float > > &output, const itsmft::TopologyDictionary *dict)
convert compact clusters to 3D spacepoints
TrackParametrizationWithError< float > TrackParCovF
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
auto getITSPerLayer() const
auto getITSTracks() const
bool isTrackSourceLoaded(int src) const
auto getDecays3BodyIdx() const
auto getITSTracksClusterRefs() const
auto getPrimaryVertexMatchedTracks() const
auto getCascadesIdx() const
auto getPrimaryVertexMatchedTrackRefs() const
auto getITSClustersPatterns(int layer=0) const
auto getITSClusters(int layer=0) const
auto getITSTracksMCLabels() const
auto getDecays3Body() const
auto getITSClustersMCLabels(int layer=0) const
int getBinIndex(float eta, float phi)
std::vector< int > getBinRect(float eta, float phi, float deltaEta, float deltaPhi)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"