Project
Loading...
Searching...
No Matches
TrackCuts.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16// This class is developed in order to be used for extensive track selections. The selections are done detector wise
17//(or for detector combinations).
18// sources: https://github.com/AliceO2Group/AliceO2/blob/e988b0c43346ccb24f3515d1a24f058313f14a0f/DataFormats/Reconstruction/include/ReconstructionDataFormats/GlobalTrackID.h#L40
19//
20// !!! For further development:
21// The main method is isSelected(o2::dataformats::GlobalTrackID, o2::globaltracking::RecoContainer&), which is a boolean
22// that returns true only if all the checks are passed. First, based on the global track id, the track detector source is
23// inquired(e.g. below for ITS and TPC tracks). The source-specific tracks is initialized in order to access the
24// source-specific parameters than one wants to perform selections on.
25// For each detector source, the inquiry should be done in such way that “false” should be returned if the checks are not passed,
26// moving to the next detector source otherwise.
27// (e.g below for TPC tracks, where the track selections used here: https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/GlobalTracking/src/MatchITSTPCQC.cxx#L318
28// are reproduced;
29// Moreover, an example of how this class should be used can be found here: https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/GlobalTracking/src/MatchITSTPCQC.cxx#L184).
30
31#ifndef ALICEO2_TRACKCUTS_H
32#define ALICEO2_TRACKCUTS_H
33
34#include "Framework/Logger.h"
35#include "Framework/DataTypes.h"
44#include <set>
45#include <vector>
46#include "Rtypes.h"
47#include <gsl/span>
48namespace o2
49{
53{
54 public:
57 void setMinPtITSCut(float value) { mPtITSCut = value; }
58 void setEtaITSCut(float value) { mEtaITSCut = value; }
59 void setMinNClustersITS(int32_t value) { mMinNClustersITS = value; }
60 void setMaxChi2PerClusterITS(float value) { mMaxChi2PerClusterITS = value; }
61 void setRequireHitsInITSLayers(int8_t minNRequiredHits, std::set<uint8_t> requiredLayers)
62 {
63 mRequiredITSHits.push_back(std::make_pair(minNRequiredHits, requiredLayers));
64 LOG(info) << "Track selection, set require hits in ITS layers: " << static_cast<int>(minNRequiredHits);
65 }
67 void setMinPtTPCCut(float value) { mPtTPCCut = value; }
68 void setEtaTPCCut(float value) { mEtaTPCCut = value; }
69 void setMinNTPCClustersCut(int32_t value) { mNTPCClustersCut = value; }
70 void setMaxDCATPCCut(float value) { mDCATPCCut = value; }
71 void setMaxDCATPCCutY(float value) { mDCATPCCutY = value; }
73 void setMinPtCut(float value) { mMinPt = value; }
74 void setMaxPtCut(float value) { mMaxPt = value; }
75 void setEtaCut(float valueMin, float valueMax)
76 {
77 mMinEta = valueMin;
78 mMaxEta = valueMax;
79 }
80
83 {
85 auto contributorsGID = data.getSingleDetectorRefs(trackIndex);
86 auto src = trackIndex.getSource(); // make selections depending on track source
87 // ITS tracks
88 if (contributorsGID[GIndex::Source::ITS].isIndexSet()) { // ITS tracks selection
89 const auto& itsTrk = data.getITSTrack(contributorsGID[GID::ITS]);
90 int ITSnClusters = itsTrk.getNClusters();
91 float ITSchi2 = itsTrk.getChi2();
92 float itsChi2NCl = ITSnClusters != 0 ? ITSchi2 / (float)ITSnClusters : 0;
93 uint8_t itsClusterMap = itsTrk.getPattern();
94 if (itsTrk.getPt() <= mPtITSCut ||
95 std::abs(itsTrk.getEta()) > mEtaITSCut || // TODO: define 2 different values for min and max (**)
96 ITSnClusters <= mMinNClustersITS ||
97 itsChi2NCl >= mMaxChi2PerClusterITS ||
98 TrackMethods::FulfillsITSHitRequirements(itsClusterMap, mRequiredITSHits) == false) {
99 return false;
100 }
101 }
102 // TPC tracks
103 if (contributorsGID[GIndex::Source::TPC].isIndexSet()) {
104 const auto& tpcTrk = data.getTPCTrack(contributorsGID[GID::TPC]);
105 math_utils::Point3D<float> v{}; // vertex not defined?!
106 std::array<float, 2> dca;
107 if (tpcTrk.getPt() < mPtTPCCut || std::abs(tpcTrk.getEta()) > mEtaTPCCut || tpcTrk.getNClusters() < mNTPCClustersCut) { // TODO: define 2 different values for min and max (***)
108 return false;
109 }
110 o2::track::TrackPar trTmp(tpcTrk);
111 if (!trTmp.propagateParamToDCA(v, mBz, &dca, mDCATPCCut) || std::abs(dca[0]) > mDCATPCCutY || std::hypot(dca[0], dca[1]) > mDCATPCCut) {
112 return false;
113 }
114 }
115 // ITS-TPC matched cuts
116 // --> currently inactive in MatchITSTPCQC, since either GID::TPC or GID::ITS
120 src == o2::dataformats::GlobalTrackID::ITSTPCTRDTOF) { // track selection for barrel tracks (ITS-TPC matched)
121 trk = data.getTrackParam(trackIndex);
122 float trkEta = trk.getEta();
123 if (trk.getPt() < mMinPt || trk.getPt() > mMaxPt || trkEta < mMinEta || trkEta > mMaxEta) {
124 return false;
125 }
126 }
127 return true;
128 }
129
130 private:
133 float mPtITSCut = 0.f; // min pT for ITS track
134 float mEtaITSCut = 1e10f; // eta window for ITS track --> TODO: define 2 different values for min and max (**)
135 int mMinNClustersITS{0}; // min number of ITS clusters
136 float mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster
137 std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits{}; // vector of ITS requirements (minNRequiredHits in specific requiredLayers)
139 float mPtTPCCut = 0.1f; // min pT for TPC track
140 float mEtaTPCCut = 1.4f; // eta window for TPC track --> TODO: define 2 different values for min and max (***)
141 int32_t mNTPCClustersCut = 60; // minimum number of TPC clusters for TPC track
142 float mDCATPCCut = 100.f; // max DCA 3D to PV for TPC track
143 float mDCATPCCutY = 10.f; // max DCA xy to PV for TPC track
144 // ITS+TPC track kinematics
145 float mMinPt{0.f}, mMaxPt{1e10f}; // range in pT
146 float mMinEta{-1e10f}, mMaxEta{1e10f}; // range in eta
147
148 float mBz = o2::base::Propagator::Instance()->getNominalBz();
149
150 ClassDefNV(TrackCuts, 2);
151};
152} // namespace o2
153
154#endif
Wrapper container for different reconstructed object types.
Base track model for the Barrel, params only, w/o covariance.
Class to store the output of the matching to TOF.
Extention of GlobalTrackID by flags relevant for verter-track association.
void setMinPtCut(float value)
ITS+TPC kinematics.
Definition TrackCuts.h:73
void setMinNClustersITS(int32_t value)
Definition TrackCuts.h:59
void setMinNTPCClustersCut(int32_t value)
Definition TrackCuts.h:69
bool isSelected(GID trackIndex, o2::globaltracking::RecoContainer &data)
Definition TrackCuts.h:82
void setMaxPtCut(float value)
Definition TrackCuts.h:74
void setEtaITSCut(float value)
Definition TrackCuts.h:58
void setMaxChi2PerClusterITS(float value)
Definition TrackCuts.h:60
void setEtaTPCCut(float value)
Definition TrackCuts.h:68
void setMaxDCATPCCut(float value)
Definition TrackCuts.h:70
void setMinPtITSCut(float value)
Definition TrackCuts.h:57
void setMinPtTPCCut(float value)
TPC.
Definition TrackCuts.h:67
void setEtaCut(float valueMin, float valueMax)
Definition TrackCuts.h:75
void setMaxDCATPCCutY(float value)
Definition TrackCuts.h:71
void setRequireHitsInITSLayers(int8_t minNRequiredHits, std::set< uint8_t > requiredLayers)
Definition TrackCuts.h:61
static bool FulfillsITSHitRequirements(uint8_t itsClusterMap, std::vector< std::pair< int8_t, std::set< uint8_t > > > mRequiredITSHits)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:143
GLenum src
Definition glcorearb.h:1767
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean * data
Definition glcorearb.h:298
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"