Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First prototype of strangeness tracking workflow #10437

Merged
merged 37 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
623abe8
Add hypertracking workflow skeleton
mconcas Nov 30, 2021
34e6b41
First skeleton of hypertracker (#9)
fmazzasc Nov 30, 2021
8781cc6
Improve hypertracking workflow
mconcas Nov 30, 2021
2359be7
Make the skeleton compile in O2
mpuccio Nov 30, 2021
61a2804
Aestetics
mpuccio Nov 30, 2021
cea3d98
Update tracking algorithm (#10)
fmazzasc Dec 3, 2021
7e15edc
Improve hypertracking wf
mconcas Dec 3, 2021
afe06f8
Hypertracking wf does things
mconcas Dec 5, 2021
bbc22a2
Add TPCITS matching with @fmazzasc
mconcas Dec 5, 2021
b635513
Add all available readers
mconcas Dec 6, 2021
99e4b98
First version of hypertracking workflow
fmazzasc Jan 13, 2022
0f86b70
Fix v0-track association
fmazzasc Jan 14, 2022
83966e1
Update hypertracker + post processing macro
fmazzasc Jan 19, 2022
6896b6a
Add propagator
fmazzasc Jan 20, 2022
baefa2d
Update hypertracking
fmazzasc May 4, 2022
ecb3458
Get ITS cluster dictionary from CCDB
mconcas Jun 15, 2022
04d54a6
Add phi-eta preselection
fmazzasc Jun 21, 2022
bfe43a6
Rectangular area for phi, eta selection
fmazzasc Jun 22, 2022
47fc42f
Directory and code refactoring
fmazzasc Jun 23, 2022
e6f5c78
Fix output structure
fmazzasc Jun 24, 2022
893fbdc
Add Cascades loop
fmazzasc Jun 24, 2022
57d29c4
Fix memory error
fmazzasc Jun 27, 2022
069f6a1
Remove debug cleaning
fmazzasc Jun 27, 2022
613eeab
Fetch geo and grp from ccdb
fmazzasc Aug 10, 2022
036da2e
Add config params
fmazzasc Aug 11, 2022
c35a40e
Fix params assignment
fmazzasc Aug 12, 2022
a91fa66
Add + parameters
fmazzasc Aug 16, 2022
7b236d3
Attach cascade daughters
fmazzasc Aug 30, 2022
666ed1e
Add macros
fmazzasc Dec 5, 2022
1b27f82
Clang format + remove utils
fmazzasc Dec 5, 2022
8a98d94
Fix clang for linkdef
fmazzasc Dec 5, 2022
e6ab8ec
Please consider the following formatting changes
alibuild Dec 5, 2022
2ce5b59
Merge pull request #4 from alibuild/alibot-cleanup-10437
fmazzasc Dec 5, 2022
c560aa6
Fix file headers
fmazzasc Dec 5, 2022
06c5def
Clear typo
fmazzasc Dec 5, 2022
305d0e4
Make macro compile + braces after if statements
fmazzasc Dec 6, 2022
9568f59
Remove extra space
fmazzasc Dec 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
/Detectors/ZDC @coppedis
/Detectors/CTF @shahor02
/Detectors/Raw @shahor02
/Detectors/StrangenessTracking @mconcas @mpuccio @fmazzasc

/EventVisualisation @jmyrcha
#/EventVisualisation/Base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#pragma link C++ class o2::track::TrackParCovD + ;
#pragma link C++ class o2::track::TrackParCov + ;
#pragma link C++ class o2::track::TrackParametrizationWithError < float> + ;
#pragma link C++ class std::vector < o2::track::TrackParametrizationWithError < float>> + ;

#pragma link C++ class o2::track::TrackParametrizationWithError < double> + ;
#pragma link C++ class o2::track::TrackParFwd + ;
#pragma link C++ class o2::track::PID + ;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ add_subdirectory(FOCAL)
add_subdirectory(GlobalTracking)
add_subdirectory(GlobalTrackingWorkflow)
add_subdirectory(Vertexing)

add_subdirectory(StrangenessTracking)
if(BUILD_ANALYSIS)
add_subdirectory(AOD)
endif()
Expand Down
14 changes: 14 additions & 0 deletions Detectors/StrangenessTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

add_subdirectory(workflow)
add_subdirectory(tracking)
add_subdirectory(macros)
10 changes: 10 additions & 0 deletions Detectors/StrangenessTracking/macros/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
o2_add_test_root_macro(XiTrackingStudy.C
PUBLIC_LINK_LIBRARIES O2::MathUtils
O2::ITSBase
O2::ITSMFTReconstruction
O2::ITSMFTSimulation
O2::DataFormatsITSMFT
O2::DataFormatsITS
O2::SimulationDataFormat
O2::StrangenessTracking
LABELS strangeness-tracking)
644 changes: 644 additions & 0 deletions Detectors/StrangenessTracking/macros/XiTrackingStudy.C

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions Detectors/StrangenessTracking/tracking/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

o2_add_library(StrangenessTracking
SOURCES src/StrangenessTracker.cxx
src/StrangenessTrackingConfigParam.cxx
PUBLIC_LINK_LIBRARIES O2::MathUtils
O2::ITSBase
O2::ITSMFTReconstruction
O2::ITSMFTSimulation
O2::DataFormatsITSMFT
O2::DataFormatsITS
O2::SimulationDataFormat
O2::DetectorsVertexing
O2::ReconstructionDataFormats
)

o2_target_root_dictionary(StrangenessTracking
HEADERS include/StrangenessTracking/StrangenessTrackingConfigParam.h
include/StrangenessTracking/IndexTableUtils.h
include/StrangenessTracking/StrangenessTracker.h


LINKDEF src/StrangenessTrackingLinkDef.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file IndexTableUtils.h
/// \brief
///
#ifndef STRTRACKING_INCLUDE_INDEXTABLEUTILS_H_
#define STRTRACKING_INCLUDE_INDEXTABLEUTILS_H_

#include "TMath.h"

namespace o2
{
namespace strangeness_tracking
{

struct IndexTableUtils {
int getEtaBin(float eta);
int getPhiBin(float phi);
int getBinIndex(float eta, float phi);
std::vector<int> getBinRect(float eta, float phi, float deltaEta, float deltaPhi);
int mEtaBins = 64, mPhiBins = 64;
float minEta = -1.5, maxEta = 1.5;
float minPhi = 0., maxPhi = 2 * TMath::Pi();
};

inline int IndexTableUtils::getEtaBin(float eta)
{
float deltaEta = (maxEta - minEta) / (mEtaBins);
int bEta = (eta - minEta) / deltaEta; // bins recentered to 0
return bEta;
};

inline int IndexTableUtils::getPhiBin(float phi)
{
float deltaPhi = (maxPhi - minPhi) / (mPhiBins);
int bPhi = (phi - minPhi) / deltaPhi; // bin recentered to 0
return bPhi;
}

inline int IndexTableUtils::getBinIndex(float eta, float phi)
{
float deltaPhi = (maxPhi - minPhi) / (mPhiBins);
float deltaEta = (maxEta - minEta) / (mEtaBins);
int bEta = getEtaBin(eta);
int bPhi = getPhiBin(phi);
return (bEta >= mEtaBins || bPhi >= mPhiBins || bEta < 0 || bPhi < 0) ? mEtaBins * mPhiBins : bEta + mEtaBins * bPhi;
}

inline std::vector<int> IndexTableUtils::getBinRect(float eta, float phi, float deltaEta, float deltaPhi)
{
std::vector<int> idxVec;
int centralBin = getBinIndex(eta, phi);
if (centralBin == mPhiBins * mEtaBins) { // condition for overflows
idxVec.push_back(centralBin);
return idxVec;
}
int minEtaBin = TMath::Max(0, getEtaBin(eta - deltaEta));
int maxEtaBin = getEtaBin(eta + deltaEta);
int minPhiBin = TMath::Max(0, getPhiBin(phi - deltaPhi));
int maxPhiBin = getPhiBin(phi + deltaPhi);

for (int iPhi{minPhiBin}; iPhi <= maxPhiBin; iPhi++) {
if (iPhi >= mPhiBins) {
break;
}
for (int iEta{minEtaBin}; iEta <= maxEtaBin; iEta++) {
if (iEta >= mEtaBins) {
break;
}
idxVec.push_back(iEta + mEtaBins * iPhi);
}
}
return idxVec;
};

} // namespace strangeness_tracking
} // namespace o2

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file StrangenessTracker.h
/// \brief
///

#ifndef _ALICEO2_STRANGENESS_TRACKER_
#define _ALICEO2_STRANGENESS_TRACKER_

#include <gsl/gsl>
#include <TLorentzVector.h>
#include "TMath.h"
#include "StrangenessTracking/IndexTableUtils.h"
#include "StrangenessTracking/StrangenessTrackingConfigParam.h"
#include "ReconstructionDataFormats/PID.h"
#include "ReconstructionDataFormats/V0.h"
#include "ReconstructionDataFormats/Cascade.h"

#include "DataFormatsITS/TrackITS.h"
#include "ITSBase/GeometryTGeo.h"
#include "ReconstructionDataFormats/Track.h"
#include "DataFormatsITSMFT/CompCluster.h"

#include "DetectorsVertexing/DCAFitterN.h"
#include "DetectorsBase/Propagator.h"

namespace o2
{
namespace strangeness_tracking
{

enum kPartType { kV0,
kCascade,
kThreeBody };

struct ClusAttachments {

std::array<unsigned int, 7> arr;
};

struct StrangeTrack {
kPartType mPartType;
o2::track::TrackParCovF mMother;
int mITSRef = -1;
int mDecayRef = -1;
std::array<float, 3> decayVtx;
std::array<float, 3> decayMom;
float mInvMass;
float mMatchChi2;
float mTopoChi2;
};

class StrangenessTracker
{
public:
using PID = o2::track::PID;
using TrackITS = o2::its::TrackITS;
using ITSCluster = o2::BaseCluster<float>;
using V0 = o2::dataformats::V0;
using Cascade = o2::dataformats::Cascade;
using GIndex = o2::dataformats::VtxTrackIndex;
using DCAFitter2 = o2::vertexing::DCAFitterN<2>;
using DCAFitter3 = o2::vertexing::DCAFitterN<3>;

StrangenessTracker() = default;
~StrangenessTracker() = default;

void initialise();
void process();

std::vector<ClusAttachments>& getClusAttachments() { return mClusAttachments; };
std::vector<StrangeTrack>& getStrangeTrackVec() { return mStrangeTrackVec; };

float getBz() const { return mBz; }
void setBz(float d) { mBz = d; }
void setCorrType(const o2::base::PropagatorImpl<float>::MatCorrType& type) { mCorrType = type; }

void setupFitters()
{
mFitterV0.setBz(mBz);
mFitter3Body.setBz(mBz);
mFitterV0.setUseAbsDCA(true);
mFitter3Body.setUseAbsDCA(true);
}

bool loadData(gsl::span<const o2::its::TrackITS> InputITStracks, std::vector<ITSCluster>& InputITSclusters, gsl::span<const int> InputITSidxs, gsl::span<const V0> InputV0tracks, gsl::span<const Cascade> InputCascadeTracks, o2::its::GeometryTGeo* geomITS);
double calcV0alpha(const V0& v0);
std::vector<ITSCluster> getTrackClusters();
float getMatchingChi2(o2::track::TrackParCovF, const TrackITS ITSTrack, ITSCluster matchingClus);
bool recreateV0(const o2::track::TrackParCov& posTrack, const o2::track::TrackParCov& negTrack, V0& newV0);

bool updateTrack(const ITSCluster& clus, o2::track::TrackParCov& track);
bool matchDecayToITStrack(float decayR);

protected:
gsl::span<const o2::its::TrackITS> mInputITStracks; // input ITS tracks
std::vector<int> mTracksIdxTable; // index table for ITS tracks
std::vector<ITSCluster> mInputITSclusters; // input ITS clusters
gsl::span<const int> mInputITSidxs; // input ITS track-cluster indexes
gsl::span<const V0> mInputV0tracks; // input V0 of decay daughters
gsl::span<const Cascade> mInputCascadeTracks; // input V0 of decay daughters

std::vector<o2::its::TrackITS> mSortedITStracks; // sorted ITS tracks
std::vector<int> mSortedITSindexes; // indexes of sorted ITS tracks
IndexTableUtils mUtils; // structure for computing eta/phi matching selections

std::vector<StrangeTrack> mStrangeTrackVec; // structure containing updated mother and daughter tracks
std::vector<ClusAttachments> mClusAttachments; // # of attached tracks, 1 for mother, 2 for daughter

const StrangenessTrackingParamConfig* mStrParams = nullptr;
float mBz = -5; // Magnetic field

DCAFitter2 mFitterV0; // optional DCA Fitter for recreating V0 with hypertriton mass hypothesis
DCAFitter3 mFitter3Body; // optional DCA Fitter for final 3 Body refit

o2::base::PropagatorImpl<float>::MatCorrType mCorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE; // use mat correction
o2::its::GeometryTGeo* mGeomITS; // ITS geometry

std::vector<o2::track::TrackParCovF> mDaughterTracks; // vector of daughter tracks
StrangeTrack mStrangeTrack; // structure containing updated mother and daughter track refs
ClusAttachments mStructClus; // # of attached tracks, 1 for mother, 2 for daughter
o2::its::TrackITS mITStrack; // ITS track
std::array<GIndex, 2> mV0dauIDs; // V0 daughter IDs

ClassDefNV(StrangenessTracker, 1);
};

} // namespace strangeness_tracking
} // namespace o2

#endif // _ALICEO2_STRANGENESS_TRACKER_
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file StrangenessTrackingConfigParam.h
/// \brief

#ifndef ALICEO2_STRANGENESS_TRACKING_PARAM_H_
#define ALICEO2_STRANGENESS_TRACKING_PARAM_H_

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"

namespace o2
{
namespace strangeness_tracking
{

struct StrangenessTrackingParamConfig : public o2::conf::ConfigurableParamHelper<StrangenessTrackingParamConfig> {

// parameters
float mRadiusTolIB = .3; // Radius tolerance for matching V0s in the IB
float mRadiusTolOB = .1; // Radius tolerance for matching V0s in the OB
float mPhiBinSize = 0.1; // Phi bin size for the matching grid
float mEtaBinSize = 0.1; // Eta bin size for the matching grid
float mMinMotherClus = 3.; // minimum number of cluster to be attached to the mother
float mMaxChi2 = 50; // Maximum matching chi2

O2ParamDef(StrangenessTrackingParamConfig, "strtracker");
};

} // namespace strangeness_tracking
} // namespace o2
#endif
Loading