Project
Loading...
Searching...
No Matches
SVertexer.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#ifndef O2_S_VERTEXER_H
16#define O2_S_VERTEXER_H
17
18#include "gsl/span"
35#include <numeric>
36#include <algorithm>
37#include "GPUO2InterfaceRefit.h"
38#include "TPCFastTransform.h"
40
41namespace o2
42{
43namespace tpc
44{
45class VDriftCorrFact;
46}
47namespace gpu
48{
49class CorrectionMapsHelper;
50}
51
52namespace vertexing
53{
54
56{
57 public:
70
80
86
98
99 static constexpr int POS = 0, NEG = 1;
103 float minR = 0; // track lowest point r
104 bool hasTPC = false;
105 int8_t nITSclu = -1;
106 bool compatibleProton = false; // dE/dx compatibility with proton hypothesis (FIXME: use better, uint8_t compat mask?)
107 bool hasITS() const
108 {
109 return nITSclu > 0;
110 }
111 };
112
113 SVertexer(bool enabCascades = true, bool enab3body = false) : mEnableCascades{enabCascades}, mEnable3BodyDecays{enab3body}
114 {
115 }
116
117 void setEnableCascades(bool v) { mEnableCascades = v; }
118 void setEnable3BodyDecays(bool v) { mEnable3BodyDecays = v; }
119 void init();
122 int getNV0s() const { return mNV0s; }
123 int getNCascades() const { return mNCascades; }
124 int getN3Bodies() const { return mN3Bodies; }
125 int getNStrangeTracks() const { return mNStrangeTracks; }
126 auto& getMeanVertex() const { return mMeanVertex; }
128 {
129 if (v == nullptr) {
130 return;
131 }
132 mMeanVertex = v->getMeanVertex();
133 }
134
135 void setNThreads(int n);
136 int getNThreads() const { return mNThreads; }
137 void setUseMC(bool v) { mUseMC = v; }
138 bool getUseMC() const { return mUseMC; }
139
140 void setTPCTBin(int nbc)
141 {
142 // set TPC time bin in BCs
143 mMUS2TPCBin = 1.f / (nbc * o2::constants::lhc::LHCBunchSpacingMUS);
144 }
149
150 std::array<size_t, 3> getNFitterCalls() const;
152
153 private:
154 template <class TVI, class TCI, class T3I, class TR>
155 void extractPVReferences(const TVI& v0s, TR& vtx2V0Refs, const TCI& cascades, TR& vtx2CascRefs, const T3I& vtxs3, TR& vtx2body3Refs);
156 bool checkV0(const TrackCand& seed0, const TrackCand& seed1, int iP, int iN, int ithread);
157 int checkCascades(const V0Index& v0Idx, const V0& v0, float rv0, std::array<float, 3> pV0, float p2V0, int avoidTrackID, int posneg, VBracket v0vlist, int ithread);
158 int check3bodyDecays(const V0Index& v0Idx, const V0& v0, float rv0, std::array<float, 3> pV0, float p2V0, int avoidTrackID, int posneg, VBracket v0vlist, int ithread);
159 void setupThreads();
160 void buildT2V(const o2::globaltracking::RecoContainer& recoTracks);
161 void updateTimeDependentParams();
162 bool acceptTrack(const GIndex gid, const o2::track::TrackParCov& trc) const;
163 bool processTPCTrack(const o2::tpc::TrackTPC& trTPC, GIndex gid, int vtxid);
164 float correctTPCTrack(TrackCand& trc, const o2::tpc::TrackTPC& tTPC, float tmus, float tmusErr) const;
165
166 uint64_t getPairIdx(GIndex id1, GIndex id2) const
167 {
168 return (uint64_t(id1) << 32) | id2;
169 }
170 const o2::globaltracking::RecoContainer* mRecoCont = nullptr;
171 GIndex::mask_t mSrc{};
172
173 const o2::tpc::ClusterNativeAccess* mTPCClusterIdxStruct = nullptr;
174 gsl::span<const o2::tpc::TrackTPC> mTPCTracksArray;
175 gsl::span<const o2::tpc::TPCClRefElem> mTPCTrackClusIdx;
176 gsl::span<const unsigned char> mTPCRefitterShMap;
177 gsl::span<const unsigned int> mTPCRefitterOccMap;
178 o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
179 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mTPCRefitter;
181 gsl::span<const PVertex> mPVertices;
182 std::vector<std::vector<V0>> mV0sTmp;
183 std::vector<std::vector<Cascade>> mCascadesTmp;
184 std::vector<std::vector<Decay3Body>> m3bodyTmp;
185 std::vector<std::vector<V0Index>> mV0sIdxTmp;
186 std::vector<std::vector<CascadeIndex>> mCascadesIdxTmp;
187 std::vector<std::vector<Decay3BodyIndex>> m3bodyIdxTmp;
188 std::array<std::vector<TrackCand>, 2> mTracksPool{}; // pools of positive and negative seeds sorted in min VtxID
189 std::array<std::vector<int>, 2> mVtxFirstTrack{}; // 1st pos. and neg. track of the pools for each vertex
190
191 o2::dataformats::VertexBase mMeanVertex{{0., 0., 0.}, {0.1 * 0.1, 0., 0.1 * 0.1, 0., 0., 6. * 6.}};
192 const SVertexerParams* mSVParams = nullptr;
193 std::array<SVertexHypothesis, NHypV0> mV0Hyps;
194 std::array<SVertexHypothesis, NHypCascade> mCascHyps;
195 std::array<SVertex3Hypothesis, NHyp3body> m3bodyHyps;
196 std::vector<DCAFitterN<2>> mFitterV0;
197 std::vector<DCAFitterN<2>> mFitterCasc;
198 std::vector<DCAFitterN<3>> mFitter3body;
199
200 PIDResponse mPIDresponse;
201
202 int mNThreads = 1;
203 int mNV0s = 0, mNCascades = 0, mN3Bodies = 0, mNStrangeTracks = 0;
204 float mBz = 0;
205 float mMinR2ToMeanVertex = 0;
206 float mMaxDCAXY2ToMeanVertex = 0;
207 float mMaxDCAXY2ToMeanVertexV0Casc = 0;
208 float mMaxDCAXY2ToMeanVertex3bodyV0 = 0;
209 float mMinR2DiffV0Casc = 0;
210 float mMaxR2ToMeanVertexCascV0 = 0;
211 float mMinPt2V0 = 1e-6;
212 float mMaxTgl2V0 = 2. * 2.;
213 float mMinPt2Casc = 1e-4;
214 float mMaxTgl2Casc = 2. * 2.;
215 float mMinPt23Body = 1e-4;
216 float mMaxTgl23Body = 2.f * 2.f;
217 float mMUS2TPCBin = 1.f / (8 * o2::constants::lhc::LHCBunchSpacingMUS);
218 float mTPCBin2Z = 0;
219 float mTPCVDrift = 0;
220 float mTPCVDriftCorrFact = 1.;
221 float mTPCVDriftRef = 0;
222 float mTPCDriftTimeOffset = 0;
223
224 bool mEnableCascades = true;
225 bool mEnable3BodyDecays = false;
226 bool mUseMC = false;
227};
228
229} // namespace vertexing
230} // namespace o2
231
232#endif
Helper class to read the binary format of TPC ClusterNative.
Defintions for N-prongs secondary vertex fit.
Wrapper container for different reconstructed object types.
Class to refer to the 1st entry and N elements of some group in the continuous container.
V0 or Cascade and 3-body decay hypothesis checker.
Configurable params for secondary vertexer.
Definition of TPCFastTransform class.
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...
TO BE DONE: extend to generic N body vertex.
Definition Decay3Body.h:26
PID response class.
Definition PIDResponse.h:39
o2::tpc::PIDResponse PIDResponse
Definition SVertexer.h:69
void setEnableCascades(bool v)
Definition SVertexer.h:117
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper *maph)
std::array< size_t, 3 > getNFitterCalls() const
void setEnable3BodyDecays(bool v)
Definition SVertexer.h:118
o2::math_utils::Bracket< int > VBracket
Definition SVertexer.h:68
o2::strangeness_tracking::StrangenessTracker * getStrangenessTracker()
Definition SVertexer.h:148
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
static constexpr int POS
Definition SVertexer.h:99
void setMeanVertex(const o2::dataformats::MeanVertexObject *v)
Definition SVertexer.h:127
static constexpr int NEG
Definition SVertexer.h:99
void setTPCTBin(int nbc)
Definition SVertexer.h:140
void setStrangenessTracker(o2::strangeness_tracking::StrangenessTracker *tracker)
Definition SVertexer.h:147
int getNStrangeTracks() const
Definition SVertexer.h:125
void setSources(GIndex::mask_t src)
Definition SVertexer.h:151
SVertexer(bool enabCascades=true, bool enab3body=false)
Definition SVertexer.h:113
void produceOutput(o2::framework::ProcessingContext &pc)
Definition SVertexer.cxx:87
auto & getMeanVertex() const
Definition SVertexer.h:126
GLdouble n
Definition glcorearb.h:1982
GLenum src
Definition glcorearb.h:1767
const GLdouble * v
Definition glcorearb.h:832
GLfloat v0
Definition glcorearb.h:811
constexpr double LHCBunchSpacingMUS
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...