Skip to content

Commit 596a7ab

Browse files
committed
Add selection of track sources for p.vertexing, vtx/track matching
1 parent 46961d4 commit 596a7ab

File tree

6 files changed

+72
-83
lines changed

6 files changed

+72
-83
lines changed

Detectors/GlobalTrackingWorkflow/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
# Global tracking workflows
66

7+
## Primary vertexer and vertex-track matcher
8+
9+
Builds primary vertices from all allowed sources (currently by default: ITS, ITS-TPC, ITS-TPC-TOF, can be reduced with `--vertexing-sources <source0,source1...>`) and if builds a vector of indices (`VtxTrackIndex`) of tracks from every source (currently by default: ITS, TPC, ITS-TPC, TPC-TOF, ITS-TPC-TOF, can be reduced with `--vetex-track-matching-sources`) which either contributes to vertex (flagged) or matches to it time-wise (ambiguous matches are flagged). To disable vertex tracks matching used `--vetex-track-matching-sources none`.
10+
```cpp
11+
o2-primary-vertexing-workflow
12+
```
13+
The list of track sources used for vertexing can be steer
14+
715
## Cosmics tracker
816

917
Matches and refits top-bottom legs of cosmic tracks. A test case:
@@ -18,4 +26,6 @@ o2-tof-matcher-tpc --shm-segment-size 10000000000 --run | tee recTOF_TPC.log
1826
o2-cosmics-match-workflow --shm-segment-size 10000000000 --run | tee cosmics.log
1927
```
2028

21-
One can account contributions of a limited set of detectors only (by default: ITS, TPC, [TRD] and TOF) by providing optiont `--skipDet` or `--onlyDet`.
29+
One can account contributions of a limited set of track sources (currently by default: ITS, TPC, ITS-TPC, TPC-TOF, ITS-TPC-TOF) by providing optiont `--track-sources`.
30+
31+

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/PrimaryVertexingSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PrimaryVertexingSpec : public Task
4545
};
4646

4747
/// create a processor spec
48-
DataProcessorSpec getPrimaryVertexingSpec(DetID::mask_t dets, bool validateWithFT0, bool useMC);
48+
DataProcessorSpec getPrimaryVertexingSpec(GTrackID::mask_t src, bool validateWithFT0, bool useMC);
4949

5050
} // namespace vertexing
5151
} // namespace o2

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/VertexTrackMatcherSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace vertexing
2626
{
2727

2828
using namespace o2::framework;
29+
using GTrackID = o2::dataformats::GlobalTrackID;
2930

3031
class VertexTrackMatcherSpec : public Task
3132
{
@@ -42,7 +43,7 @@ class VertexTrackMatcherSpec : public Task
4243
};
4344

4445
/// create a processor spec
45-
DataProcessorSpec getVertexTrackMatcherSpec(o2::detectors::DetID::mask_t dets);
46+
DataProcessorSpec getVertexTrackMatcherSpec(GTrackID::mask_t src);
4647

4748
} // namespace vertexing
4849
} // namespace o2

Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,20 @@ void PrimaryVertexingSpec::endOfStream(EndOfStreamContext& ec)
146146
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
147147
}
148148

149-
DataProcessorSpec getPrimaryVertexingSpec(DetID::mask_t dets, bool validateWithFT0, bool useMC)
149+
DataProcessorSpec getPrimaryVertexingSpec(GTrackID::mask_t src, bool validateWithFT0, bool useMC)
150150
{
151151
std::vector<OutputSpec> outputs;
152-
if (dets[DetID::ITS]) {
152+
if (src[GTrackID::ITS]) {
153153
dataRequest.requestITSTracks(useMC);
154154
}
155-
if (dets[DetID::TPC]) {
155+
if (src[GTrackID::ITSTPC] || src[GTrackID::ITSTPCTOF]) { // ITSTPCTOF does not provide tracks, only matchInfo
156156
dataRequest.requestITSTPCTracks(useMC);
157-
if (dets[DetID::TRD]) {
158-
// RSTODO will add once TRD tracking available
159-
}
160-
if (dets[DetID::TOF]) {
161-
dataRequest.requestTOFMatches(useMC);
162-
dataRequest.requestTOFClusters(false);
163-
}
164157
}
165-
if (validateWithFT0 && dets[DetID::FT0]) {
158+
if (src[GTrackID::ITSTPCTOF]) {
159+
dataRequest.requestTOFMatches(useMC);
160+
dataRequest.requestTOFClusters(false);
161+
}
162+
if (validateWithFT0 && src[GTrackID::FT0]) {
166163
dataRequest.requestFT0RecPoints(false);
167164
}
168165

Detectors/GlobalTrackingWorkflow/src/VertexTrackMatcherSpec.cxx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,27 @@ void VertexTrackMatcherSpec::endOfStream(EndOfStreamContext& ec)
7171
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
7272
}
7373

74-
DataProcessorSpec getVertexTrackMatcherSpec(DetID::mask_t dets)
74+
DataProcessorSpec getVertexTrackMatcherSpec(GTrackID::mask_t src)
7575
{
7676
std::vector<OutputSpec> outputs;
7777

78-
if (dets[DetID::ITS]) {
78+
if (src[GTrackID::ITS]) {
7979
dataRequestV2T.requestITSTracks(false);
8080
}
81-
if (dets[DetID::TPC]) {
82-
dataRequestV2T.requestITSTPCTracks(false);
81+
if (src[GTrackID::TPC]) {
8382
dataRequestV2T.requestTPCTracks(false);
84-
if (dets[DetID::TRD]) {
85-
// RSTODO will add once TRD tracking available
86-
}
87-
if (dets[DetID::TOF]) {
88-
dataRequestV2T.requestTPCTOFTracks(false);
89-
dataRequestV2T.requestTOFClusters(false);
90-
if (dets[DetID::ITS]) {
91-
dataRequestV2T.requestTOFMatches(false);
92-
}
93-
}
9483
}
84+
if (src[GTrackID::ITSTPC] || src[GTrackID::ITSTPCTOF]) { // ITSTPCTOF does not provide tracks, only matchInfo
85+
dataRequestV2T.requestITSTPCTracks(false);
86+
}
87+
if (src[GTrackID::ITSTPCTOF]) {
88+
dataRequestV2T.requestTOFMatches(false);
89+
dataRequestV2T.requestTOFClusters(false);
90+
}
91+
if (src[GTrackID::TPCTOF]) {
92+
dataRequestV2T.requestTPCTOFTracks(false);
93+
}
94+
9595
auto& inputs = dataRequestV2T.inputs;
9696
inputs.emplace_back("vertices", "GLO", "PVTX", 0, Lifetime::Timeframe);
9797
inputs.emplace_back("vtxTracks", "GLO", "PVTX_CONTID", 0, Lifetime::Timeframe);

Detectors/GlobalTrackingWorkflow/src/primary-vertexing-workflow.cxx

Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
#include "TOFWorkflow/TOFMatchedReaderSpec.h"
1818
#include "TOFWorkflowUtils/ClusterReaderSpec.h"
1919
#include "FT0Workflow/RecPointReaderSpec.h"
20+
#include "ReconstructionDataFormats/GlobalTrackID.h"
2021
#include "DetectorsCommonDataFormats/DetID.h"
2122
#include "CommonUtils/ConfigurableParam.h"
2223
#include "Framework/CompletionPolicy.h"
2324
#include "Framework/ConfigParamSpec.h"
2425

2526
using namespace o2::framework;
27+
using GID = o2::dataformats::GlobalTrackID;
2628
using DetID = o2::detectors::DetID;
2729
// ------------------------------------------------------------------
2830

@@ -34,10 +36,9 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3436
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation"}},
3537
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
3638
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
37-
{"onlyDet", VariantType::String, std::string{DetID::NONE}, {"comma-separated list of detectors to use. Overrides skipDet"}},
38-
{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}},
39+
{"vertexing-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use in vertexing"}},
3940
{"validate-with-ft0", o2::framework::VariantType::Bool, false, {"use FT0 time for vertex validation"}},
40-
{"disable-vertex-track-matching", o2::framework::VariantType::Bool, false, {"disable matching of vertex to non-contributor tracks"}},
41+
{"vetex-track-matching-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use in vertex-track associations or \"none\" to disable matching"}},
4142
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
4243

4344
std::swap(workflowOptions, options);
@@ -50,81 +51,61 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
5051
WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
5152
{
5253
WorkflowSpec specs;
53-
DetID::mask_t dets = DetID::getMask("ITS,TPC,TRD,TOF,FT0");
54+
55+
GID::mask_t alowedSourcesPV = GID::getSourcesMask("ITS,ITS-TPC,ITS-TPC-TOF");
56+
GID::mask_t alowedSourcesVT = GID::getSourcesMask("ITS,ITS-TPC,ITS-TPC-TOF,TPC,TPC-TOF");
5457

5558
// Update the (declared) parameters if changed from the command line
5659
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
5760
// write the configuration used for the workflow
5861
o2::conf::ConfigurableParam::writeINI("o2primary-vertexing-workflow_configuration.ini");
5962

60-
if (!configcontext.helpOnCommandLine()) {
61-
auto mskOnly = DetID::getMask(configcontext.options().get<std::string>("onlyDet"));
62-
auto mskSkip = DetID::getMask(configcontext.options().get<std::string>("skipDet"));
63-
if (mskOnly.any()) {
64-
dets &= mskOnly;
65-
} else {
66-
dets ^= mskSkip;
67-
}
68-
}
6963

7064
auto useMC = !configcontext.options().get<bool>("disable-mc");
7165
auto disableRootInp = configcontext.options().get<bool>("disable-root-input");
7266
auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
7367
auto validateWithFT0 = configcontext.options().get<bool>("validate-with-ft0");
74-
auto disableMatching = configcontext.options().get<bool>("disable-vertex-track-matching");
7568

76-
bool readerTrackITSDone = false, readerTrackITSTPCDone = false, readerGloTOFDone = false;
69+
GID::mask_t srcPV = alowedSourcesPV & GID::getSourcesMask(configcontext.options().get<std::string>("vertexing-sources"));
70+
GID::mask_t srcVT = alowedSourcesVT & GID::getSourcesMask(configcontext.options().get<std::string>("vetex-track-matching-sources"));
71+
GID::mask_t srcComb = srcPV | srcVT;
7772

73+
// decide what to read, MC is needed (if requested) only for P.Vertexing
7874
if (!disableRootInp) {
79-
if (dets[DetID::ITS]) {
80-
specs.emplace_back(o2::its::getITSTrackReaderSpec(useMC));
81-
readerTrackITSDone = true;
75+
76+
if (srcComb[GID::ITS]) {
77+
specs.emplace_back(o2::its::getITSTrackReaderSpec(useMC && srcPV[GID::ITS]));
78+
}
79+
80+
if (srcComb[GID::TPC]) {
81+
specs.emplace_back(o2::tpc::getTPCTrackReaderSpec(useMC && srcPV[GID::TPC]));
82+
}
83+
84+
if (srcComb[GID::ITSTPC] || srcComb[GID::ITSTPCTOF]) { // ITSTPCTOF does not provide tracks, only matchInfo
85+
specs.emplace_back(o2::globaltracking::getTrackTPCITSReaderSpec(useMC && (srcPV[GID::ITSTPC] || srcPV[GID::ITSTPCTOF])));
86+
}
87+
88+
if (srcComb[GID::ITSTPCTOF]) {
89+
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(useMC && srcPV[GID::ITSTPCTOF], false, false)); // MC, MatchInfo_glo, no TOF_TPCtracks
90+
specs.emplace_back(o2::tof::getClusterReaderSpec(false)); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
8291
}
83-
if (dets[DetID::TPC]) {
84-
specs.emplace_back(o2::globaltracking::getTrackTPCITSReaderSpec(useMC));
85-
readerTrackITSTPCDone = true;
86-
if (dets[DetID::TRD]) {
87-
// RSTODO will add once TRD tracking available
88-
}
89-
if (dets[DetID::TOF]) {
90-
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(true, false, false)); // MC, MatchInfo_glo, no TOF_TPCtracks
91-
readerGloTOFDone = true;
92-
specs.emplace_back(o2::tof::getClusterReaderSpec(false)); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
93-
}
92+
93+
if (srcComb[GID::TPCTOF]) {
94+
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(srcPV[GID::TPCTOF], true, true)); // mc, MatchInfo_TPC, TOF_TPCtracks
9495
}
96+
9597
if (validateWithFT0) {
9698
specs.emplace_back(o2::ft0::getRecPointReaderSpec(false));
9799
}
98100
}
99-
specs.emplace_back(o2::vertexing::getPrimaryVertexingSpec(dets, validateWithFT0, useMC));
100-
101-
if (!disableMatching) {
102-
if (!disableRootInp) {
103-
104-
if (dets[DetID::ITS]) {
105-
if (!readerTrackITSDone) {
106-
specs.emplace_back(o2::its::getITSTrackReaderSpec(false));
107-
}
108-
}
109-
if (dets[DetID::TPC]) {
110-
if (dets[DetID::ITS] && !readerTrackITSTPCDone) {
111-
specs.emplace_back(o2::globaltracking::getTrackTPCITSReaderSpec(false));
112-
}
113-
specs.emplace_back(o2::tpc::getTPCTrackReaderSpec(false));
114-
if (dets[DetID::TOF]) {
115-
if (!readerGloTOFDone) {
116-
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(false, false, false)); // MC, MatchInfo_glo, no TOF_TPCtracks
117-
specs.emplace_back(o2::tof::getClusterReaderSpec(false)); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
118-
}
119-
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(false, true, true)); // mc, MatchInfo_TPC, TOF_TPCtracks
120-
}
121-
}
122-
}
123-
specs.emplace_back(o2::vertexing::getVertexTrackMatcherSpec(dets));
101+
102+
specs.emplace_back(o2::vertexing::getPrimaryVertexingSpec(srcPV, validateWithFT0, useMC));
103+
if (!srcVT.none()) {
104+
specs.emplace_back(o2::vertexing::getVertexTrackMatcherSpec(srcVT));
124105
}
125106

126107
if (!disableRootOut) {
127-
specs.emplace_back(o2::vertexing::getPrimaryVertexWriterSpec(disableMatching, useMC));
108+
specs.emplace_back(o2::vertexing::getPrimaryVertexWriterSpec(srcVT.none(), useMC));
128109
}
129110
return std::move(specs);
130111
}

0 commit comments

Comments
 (0)