62 template <
typename TR>
63 int process(
const TR& tracks,
const gsl::span<o2d::GlobalTrackID> gids,
const gsl::span<InteractionCandidate> intCand,
64 std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs,
65 const gsl::span<const o2::MCCompLabel> lblTracks, std::vector<o2::MCEventLabel>& lblVtx);
66 template <
typename TR>
67 int process(
const TR& tracks,
const gsl::span<o2d::GlobalTrackID> gids,
const gsl::span<o2::InteractionRecord> intRec,
68 std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs,
69 const gsl::span<const o2::MCCompLabel> lblTracks, std::vector<o2::MCEventLabel>& lblVtx);
71 int processFromExternalPool(
const std::vector<TrackVF>& pool, std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs);
87 void setBz(
float bz) { mBz = bz; }
102 mMeanVertexSeed = *
v;
103 initMeanVertexConstraint();
108 mITSROFrameLengthMUS =
v;
112 template <
typename TR>
140 static constexpr int DBS_UNDEF = -2, DBS_NOISE = -1, DBS_INCHECK = -10;
143 int runVertexing(gsl::span<o2d::GlobalTrackID> gids,
const gsl::span<InteractionCandidate> intCand,
144 std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs,
145 gsl::span<const o2::MCCompLabel> lblTracks, std::vector<o2::MCEventLabel>& lblVtx);
146 void createMCLabels(gsl::span<const o2::MCCompLabel> lblTracks,
const std::vector<uint32_t>& trackIDs,
const std::vector<V2TRef>& v2tRefs, std::vector<o2::MCEventLabel>& lblVtx);
147 void reduceDebris(std::vector<PVertex>& vertices, std::vector<int>& timeSort,
const std::vector<o2::MCEventLabel>& lblVtx);
149 void finalizeVertex(
const VertexingInput& input,
const PVertex& vtx, std::vector<PVertex>& vertices, std::vector<V2TRef>& v2tRefs, std::vector<uint32_t>& trackIDs,
SeedHistoTZ* histo =
nullptr);
154 float findZSeedHistoPeak()
const;
155 void initMeanVertexConstraint();
156 void applyConstraint(
VertexSeed& vtxSeed)
const;
160 void applyMADSelection(std::vector<PVertex>& vertices, std::vector<int>& timeSort,
const std::vector<V2TRef>& v2tRefs,
const std::vector<uint32_t>& trackIDs);
161 void applITSOnlyFractionCut(std::vector<PVertex>& vertices, std::vector<int>& timeSort,
const std::vector<V2TRef>& v2tRefs,
const std::vector<uint32_t>& trackIDs);
162 void applInteractionValidation(std::vector<PVertex>& vertices, std::vector<int>& timeSort,
const gsl::span<InteractionCandidate> intCand,
int minContrib);
164 template <
typename TR>
165 void createTracksPool(
const TR& tracks, gsl::span<const o2d::GlobalTrackID> gids);
167 int findVertices(
const VertexingInput& input, std::vector<PVertex>& vertices, std::vector<uint32_t>& trackIDs, std::vector<V2TRef>& v2tRefs);
168 void reAttach(std::vector<PVertex>& vertices, std::vector<int>& timeSort, std::vector<uint32_t>& trackIDs, std::vector<V2TRef>& v2tRefs);
170 std::pair<int, int> getBestIR(
const PVertex& vtx,
const gsl::span<InteractionCandidate> intCand,
int& currEntry)
const;
172 int dbscan_RangeQuery(
int idxs, std::vector<int>& cand, std::vector<int>& status);
173 void dbscan_clusterize();
174 void doDBScanDump(
const VertexingInput& input, gsl::span<const o2::MCCompLabel> lblTracks);
175 void doVtxDump(std::vector<PVertex>& vertices, std::vector<uint32_t> trackIDsLoc, std::vector<V2TRef>& v2tRefsLoc, gsl::span<const o2::MCCompLabel> lblTracks);
176 void doDBGPoolDump(gsl::span<const o2::MCCompLabel> lblTracks);
180 std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchAbove{-1};
181 std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchBelow{-1};
184 std::array<float, 3> mXYConstraintInvErr = {1.0f, 0.f, 1.0f};
186 std::vector<TrackVF> mTracksPool;
187 std::vector<TimeZCluster> mTimeZClusters;
188 float mITSROFrameLengthMUS = 0;
190 float mDBScanDeltaT = 0.;
191 float mDBSMaxZ2InvCorePoint = 0;
192 bool mValidateWithIR =
false;
196 std::vector<int> mRefitTrackIDs{};
201 std::vector<int> mSrcVec{};
202 const PVertexerParams* mPVParams =
nullptr;
204 static constexpr float kDefTukey = 5.0f;
205 static constexpr float kHugeF = 1.e12;
206 static constexpr float kAlmost0F = 1e-12;
207 static constexpr double kAlmost0D = 1e-16;
209 int mNKilledBCValid = 0;
210 int mNKilledIntCand = 0;
211 int mNKilledDebris = 0;
212 int mNKilledQuality = 0;
213 int mNKilledITSOnly = 0;
214 size_t mNTZClustersIni = 0;
215 size_t mTotTrials = 0;
216 size_t mMaxTrialPerCluster = 0;
217 float mMaxTDiffDebris = 0;
218 float mMaxTDiffDebrisExtra = 0;
219 float mMaxTDiffDebrisFiducial = 0;
220 float mMaxZDiffDebrisFiducial = 0;
221 float mMaxMultRatDebrisFiducial = 0;
222 long mLongestClusterTimeMS = 0;
223 int mLongestClusterMult = 0;
224 bool mPoolDumpProduced =
false;
225 bool mITSOnly =
false;
226 TStopwatch mTimeDBScan;
227 TStopwatch mTimeVertexing;
228 TStopwatch mTimeDebris;
229 TStopwatch mTimeMADSel;
230 TStopwatch mTimeReAttach;
231 std::string mPoolDumpDirectory{};
232#ifdef _PV_DEBUG_TREE_
233 std::unique_ptr<TFile> mDebugDumpFile;
234 std::unique_ptr<TTree> mDebugDBScanTree;
235 std::unique_ptr<TTree> mDebugPoolTree;
236 std::unique_ptr<TTree> mDebugVtxTree;
237 std::unique_ptr<TTree> mDebugVtxCompTree;
239 std::vector<TrackVFDump> mDebugDumpDBSTrc;
240 std::vector<GTrackID> mDebugDumpDBSGID;
241 std::vector<o2::MCCompLabel> mDebugDumpDBSTrcMC;
244 std::vector<TrackVFDump> mDebugDumpVtxTrc;
245 std::vector<GTrackID> mDebugDumpVtxGID;
246 std::vector<o2::MCCompLabel> mDebugDumpVtxTrcMC;
248 std::vector<PVtxCompDump> mDebugDumpPVComp;
249 std::vector<o2::MCEventLabel> mDebugDumpPVCompLbl0;
250 std::vector<o2::MCEventLabel> mDebugDumpPVCompLbl1;