Skip to content

Commit d9fbe03

Browse files
committed
Optionally store refs on ITS parts of all PV contributors
To allow accessing them w/o going throught all kinds of tracks
1 parent 98167be commit d9fbe03

6 files changed

Lines changed: 42 additions & 2 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/VtxTrackRef.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,17 @@ class VtxTrackRef : public RangeReference<int, int>
8080
// set the last +1 element index and finalize all references
8181
void setEnd(int end);
8282

83+
const RangeReference<int, int>& getITSGloContributors() const { return mITSGloContributors; }
84+
RangeReference<int, int>& getITSGloContributors() { return mITSGloContributors; }
85+
8386
private:
8487
using RangeReference<int, int>::RangeReference;
8588
int mVtxID = -1; // vertex ID. The reference for unassigned tracks will have it negative!
8689
std::array<int, VtxTrackIndex::Source::NSources - 1> mFirstEntrySource{0};
8790

88-
ClassDefNV(VtxTrackRef, 2);
91+
RangeReference<int, int> mITSGloContributors; // optionally filled to keep ITS parts of all contributors (including ITS-only ones)
92+
93+
ClassDefNV(VtxTrackRef, 3);
8994
};
9095

9196
std::ostream& operator<<(std::ostream& os, const o2::dataformats::VtxTrackRef& v);

DataFormats/Reconstruction/src/VtxTrackRef.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ std::string VtxTrackRef::asString(bool skipEmpty) const
3131
str += fmt::format(", N{:s} : {:d}", VtxTrackIndex::getSourceName(i), getEntriesOfSource(i));
3232
}
3333
}
34+
if (mITSGloContributors.getEntries()) {
35+
str += fmt::format("| ITScontributors: {} from {}", mITSGloContributors.getEntries(), mITSGloContributors.getFirstEntry());
36+
}
3437
return str;
3538
}
3639

Detectors/GlobalTrackingWorkflow/src/VertexTrackMatcherSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void VertexTrackMatcherSpec::updateTimeDependentParams(ProcessingContext& pc)
9898
mMatcher.setITSROFrameLengthMUS(o2::base::GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::ITS) ? alpParamsITS.roFrameLengthInBC * o2::constants::lhc::LHCBunchSpacingMUS : alpParamsITS.roFrameLengthTrig * 1.e-3);
9999
const auto& alpParamsMFT = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>::Instance();
100100
mMatcher.setMFTROFrameLengthMUS(o2::base::GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::MFT) ? alpParamsMFT.roFrameLengthInBC * o2::constants::lhc::LHCBunchSpacingMUS : alpParamsMFT.roFrameLengthTrig * 1.e-3);
101+
mMatcher.init();
101102
LOGP(info, "VertexTrackMatcher ITSROFrameLengthMUS:{} MFTROFrameLengthMUS:{}", mMatcher.getITSROFrameLengthMUS(), mMatcher.getMFTROFrameLengthMUS());
102103
}
103104
// we may have other params which need to be queried regularly

Detectors/Vertexing/include/DetectorsVertexing/PVertexerParams.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct PVertexerParams : public o2::conf::ConfigurableParamHelper<PVertexerParam
116116
float nSigmaTimeTrack = 4.; ///< define track time bracket as +- this number of sigmas of its time resolution
117117
float timeMarginTrackTime = 0.5; ///< additive marginal error in \mus to track time bracket
118118
float timeMarginVertexTime = 0.0; ///< additive marginal error to \mus vertex time bracket
119-
119+
bool fillITSGloContributors = false; ///< fill separate entry for ITS contributors
120120
O2ParamDef(PVertexerParams, "pvertexer");
121121
};
122122

Detectors/Vertexing/include/DetectorsVertexing/VertexTrackMatcher.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class VertexTrackMatcher
5151
int origID = -1; ///< vertex origin id
5252
};
5353

54+
void init();
5455
void process(const o2::globaltracking::RecoContainer& recoData,
5556
std::vector<VTIndex>& trackIndex, // Global ID's for associated tracks
5657
std::vector<VRef>& vtxRefs); // references on these tracks
@@ -69,6 +70,7 @@ class VertexTrackMatcher
6970

7071
private:
7172
void extractTracks(const o2::globaltracking::RecoContainer& data, const std::unordered_map<GIndex, bool>& vcont);
73+
std::vector<int> mITSGloSources;
7274
std::vector<TrackTBracket> mTBrackets;
7375
float mITSROFrameLengthMUS = 0; ///< ITS RO frame in mus
7476
float mMFTROFrameLengthMUS = 0; ///< MFT RO frame in mus

Detectors/Vertexing/src/VertexTrackMatcher.cxx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121

2222
using namespace o2::vertexing;
2323

24+
void VertexTrackMatcher::init()
25+
{
26+
const auto& PVParams = o2::vertexing::PVertexerParams::Instance();
27+
mITSGloSources.clear();
28+
if (PVParams.fillITSGloContributors) { // collect sources of global tracks with ITS contributor
29+
for (int i = 0; i < GIndex::NSources; i++) {
30+
if (GIndex::includesDet(o2::detectors::DetID::ITS, GIndex::getSourceDetectorsMask(i)) && i != GIndex::ITSAB) {
31+
mITSGloSources.push_back(i);
32+
}
33+
}
34+
}
35+
}
36+
2437
void VertexTrackMatcher::process(const o2::globaltracking::RecoContainer& recoData,
2538
std::vector<VTIndex>& trackIndex,
2639
std::vector<VRef>& vtxRefs)
@@ -123,6 +136,22 @@ void VertexTrackMatcher::process(const o2::globaltracking::RecoContainer& recoDa
123136
vr.setFirstEntryOfSource(oldSrc, trackIndex.size());
124137
}
125138
vr.setEnd(trackIndex.size());
139+
140+
if (PVParams.fillITSGloContributors) {
141+
auto& ITSGloContributors = vr.getITSGloContributors();
142+
ITSGloContributors.setFirstEntry(trackIndex.size());
143+
for (auto srcITS : mITSGloSources) {
144+
const int fst = vr.getFirstEntryOfSource(srcITS), lst = fst + vr.getEntriesOfSource(srcITS);
145+
for (int ii = fst; ii < lst; ii++) {
146+
auto vid = trackIndex[ii];
147+
if (vid.isPVContributor()) {
148+
trackIndex.push_back(ii == GIndex::ITS ? vid : recoData.getITSContributorGID(vid));
149+
}
150+
}
151+
}
152+
ITSGloContributors.setEntries(trackIndex.size() - ITSGloContributors.getFirstEntry());
153+
}
154+
126155
if (logVertices) {
127156
LOG(info) << vr;
128157
}

0 commit comments

Comments
 (0)