Skip to content

Commit 46961d4

Browse files
committed
Add selection of track sources for cosmics matching
1 parent c00777e commit 46961d4

File tree

3 files changed

+50
-48
lines changed

3 files changed

+50
-48
lines changed

Detectors/GlobalTrackingWorkflow/include/GlobalTrackingWorkflow/CosmicsMatchingSpec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "GlobalTracking/MatchCosmics.h"
1717
#include "DataFormatsITSMFT/TopologyDictionary.h"
1818
#include "DataFormatsTPC/Constants.h"
19-
#include "DetectorsCommonDataFormats/DetID.h"
19+
#include "ReconstructionDataFormats/GlobalTrackID.h"
2020
#include "Framework/DataProcessorSpec.h"
2121
#include "Framework/Task.h"
2222
#include <string>
@@ -46,7 +46,7 @@ class CosmicsMatchingSpec : public Task
4646
};
4747

4848
/// create a processor spec
49-
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::detectors::DetID::mask_t dets, bool useMC);
49+
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC);
5050

5151
} // namespace globaltracking
5252
} // namespace o2

Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,35 @@ void CosmicsMatchingSpec::endOfStream(EndOfStreamContext& ec)
115115
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
116116
}
117117

118-
DataProcessorSpec getCosmicsMatchingSpec(DetID::mask_t dets, bool useMC)
118+
DataProcessorSpec getCosmicsMatchingSpec(GTrackID::mask_t src, bool useMC)
119119
{
120120

121121
std::vector<InputSpec> inputs;
122122
std::vector<OutputSpec> outputs;
123-
if (dets[DetID::ITS]) {
123+
124+
if (src[GTrackID::ITS]) {
124125
dataRequest.requestITSTracks(useMC);
125-
dataRequest.requestITSClusters(false);
126126
}
127-
if (dets[DetID::TPC]) {
127+
if (src[GTrackID::TPC]) {
128128
dataRequest.requestTPCTracks(useMC);
129-
dataRequest.requestTPCClusters(false);
130129
}
131-
if (dets[DetID::ITS] && dets[DetID::TPC]) {
130+
if (src[GTrackID::ITSTPC]) {
132131
dataRequest.requestITSTPCTracks(useMC);
133132
}
134-
if (dets[DetID::TPC] && dets[DetID::TOF]) {
133+
if (src[GTrackID::TPCTOF]) {
135134
dataRequest.requestTPCTOFTracks(useMC);
135+
}
136+
if (src[GTrackID::ITSTPCTOF]) {
137+
dataRequest.requestTOFMatches(useMC);
136138
dataRequest.requestTOFClusters(false); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
137-
if (dets[DetID::ITS]) {
138-
dataRequest.requestTOFMatches(useMC);
139-
}
139+
}
140+
141+
// clusters needed for refits
142+
if (GTrackID::includesDet(DetID::ITS, src)) {
143+
dataRequest.requestITSClusters(false);
144+
}
145+
if (GTrackID::includesDet(DetID::TPC, src)) {
146+
dataRequest.requestTPCClusters(false);
140147
}
141148

142149
outputs.emplace_back("GLO", "COSMICTRC", 0, Lifetime::Timeframe);

Detectors/GlobalTrackingWorkflow/src/cosmics-match-workflow.cxx

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919
#include "TOFWorkflowUtils/ClusterReaderSpec.h"
2020
#include "TOFWorkflow/TOFMatchedReaderSpec.h"
2121
#include "TOFWorkflowUtils/ClusterReaderSpec.h"
22+
#include "ReconstructionDataFormats/GlobalTrackID.h"
23+
#include "DetectorsCommonDataFormats/DetID.h"
2224
#include "GlobalTrackingWorkflow/TrackTPCITSReaderSpec.h"
2325
#include "GlobalTrackingWorkflow/CosmicsMatchingSpec.h"
2426
#include "GlobalTrackingWorkflow/TrackCosmicsWriterSpec.h"
2527
#include "Algorithm/RangeTokenizer.h"
2628

2729
using namespace o2::framework;
2830
using DetID = o2::detectors::DetID;
31+
using GID = o2::dataformats::GlobalTrackID;
2932
// ------------------------------------------------------------------
3033

3134
// we need to add workflow options before including Framework/runDataProcessing
@@ -36,8 +39,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
3639
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
3740
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
3841
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
39-
{"onlyDet", VariantType::String, std::string{DetID::NONE}, {"comma-separated list of detectors to use. Overrides skipDet"}},
40-
{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}},
42+
{"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
4143
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
4244

4345
std::swap(workflowOptions, options);
@@ -62,18 +64,7 @@ void customize(std::vector<o2::framework::CompletionPolicy>& policies)
6264
WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6365
{
6466
WorkflowSpec specs;
65-
DetID::mask_t dets;
66-
dets.set(); // by default read all
67-
68-
if (!configcontext.helpOnCommandLine()) {
69-
auto mskOnly = DetID::getMask(configcontext.options().get<std::string>("onlyDet"));
70-
auto mskSkip = DetID::getMask(configcontext.options().get<std::string>("skipDet"));
71-
if (mskOnly.any()) {
72-
dets &= mskOnly;
73-
} else {
74-
dets ^= mskSkip;
75-
}
76-
}
67+
GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,TPC-TOF,ITS-TPC-TOF");
7768

7869
// Update the (declared) parameters if changed from the command line
7970
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
@@ -87,16 +78,36 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
8778
std::vector<int> tpcClusSectors = o2::RangeTokenizer::tokenize<int>("0-35");
8879
std::vector<int> tpcClusLanes = tpcClusSectors;
8980

81+
GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
82+
9083
if (!disableRootInp) {
91-
// ITS tracks and clusters
92-
if (dets[DetID::ITS]) {
84+
85+
if (src[GID::ITS]) {
9386
specs.emplace_back(o2::its::getITSTrackReaderSpec(useMC));
94-
specs.emplace_back(o2::itsmft::getITSClusterReaderSpec(false, true)); // mc not neaded
9587
}
9688

97-
// TPC tracks and clusters
98-
if (dets[DetID::TPC]) {
89+
if (src[GID::TPC]) {
9990
specs.emplace_back(o2::tpc::getTPCTrackReaderSpec(useMC));
91+
}
92+
93+
if (src[GID::ITSTPC] || src[GID::ITSTPCTOF]) { // ITSTPCTOF does not provide tracks, only matchInfo
94+
specs.emplace_back(o2::globaltracking::getTrackTPCITSReaderSpec(useMC));
95+
}
96+
97+
if (src[GID::ITSTPCTOF]) {
98+
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(useMC, false, false)); // MC, MatchInfo_glo, no TOF_TPCtracks
99+
specs.emplace_back(o2::tof::getClusterReaderSpec(false)); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
100+
}
101+
102+
if (src[GID::TPCTOF]) {
103+
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(useMC, true, true)); // mc, MatchInfo_TPC, TOF_TPCtracks
104+
}
105+
106+
// clusters for refit
107+
if (GID::includesDet(DetID::ITS, src)) {
108+
specs.emplace_back(o2::itsmft::getITSClusterReaderSpec(false, true)); // mc not neaded
109+
}
110+
if (GID::includesDet(DetID::TPC, src)) {
100111
specs.emplace_back(o2::tpc::getPublisherSpec(o2::tpc::PublisherConf{
101112
"tpc-native-cluster-reader",
102113
"tpc-native-clusters.root",
@@ -110,25 +121,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
110121
false));
111122
specs.emplace_back(o2::tpc::getClusterSharingMapSpec());
112123
}
113-
114-
// ITS-TPC matches
115-
if (dets[DetID::ITS] && dets[DetID::TPC]) {
116-
specs.emplace_back(o2::globaltracking::getTrackTPCITSReaderSpec(true));
117-
}
118-
119-
if (dets[DetID::TPC] && dets[DetID::TOF]) {
120-
// TPC-TOF matches
121-
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(true, true, true)); // MC info here is redundant
122-
// TOF clusters
123-
specs.emplace_back(o2::tof::getClusterReaderSpec(false)); // RSTODO Needed just to set the time of ITSTPC track, consider moving to MatchInfoTOF
124-
// ITS-TPC-TOF matches
125-
if (dets[DetID::ITS]) {
126-
specs.emplace_back(o2::tof::getTOFMatchedReaderSpec(true, false, false)); // MC info here is redundant
127-
}
128-
}
129124
}
130125

131-
specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(dets, useMC));
126+
specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(src, useMC));
132127

133128
if (!disableRootOut) {
134129
specs.emplace_back(o2::globaltracking::getTrackCosmicsWriterSpec(useMC));

0 commit comments

Comments
 (0)