Skip to content

Commit 59a8763

Browse files
authored
TrackCosmicsExt.Reader pushes TF ID info only if explicitly requested (#16035)
1 parent 25c4b35 commit 59a8763

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

‎DataFormats/Detectors/GlobalTracking/include/DataFormatsGlobalTracking/RecoContainer.h‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ class StrangeTrack;
174174
class TrackCosmics;
175175
struct TrackCosmicsExtended;
176176
struct CosmicsTFInfo;
177-
struct TFIDInfo;
178177
class GlobalFwdTrack;
179178
class MatchInfoFwd;
180179
class TrackMCHMID;
@@ -330,7 +329,6 @@ struct RecoContainer {
330329
COSM_TRACKS_MC,
331330
COSMEXT_TRACKS, // extended cosmics (with clusters), no MC
332331
COSMEXT_TFINFO, // per-TF info of the extended cosmics
333-
COSMEXT_TFID, // TFIDInfo of the extended cosmics
334332
NCOSMSLOTS };
335333

336334
// slots to register ITS/MFT clusters data (per layer, or all layers together in the slot 0)
@@ -378,7 +376,7 @@ struct RecoContainer {
378376
std::unique_ptr<const std::vector<o2::MCCompLabel>> mcMIDTracks;
379377
o2::ctp::LumiInfo mCTPLumi;
380378

381-
std::shared_ptr<const void> cosmExtHolder[3]; // owners of the extended cosmics, TF info and TFID objects deserialized from the messages
379+
std::shared_ptr<const void> cosmExtHolder[2]; // owners of the extended cosmics and TF info objects deserialized from the messages
382380
gsl::span<const unsigned char> clusterShMapTPC; ///< externally set TPC clusters sharing map
383381
gsl::span<const unsigned int> occupancyMapTPC; ///< externally set TPC clusters occupancy map
384382

@@ -764,11 +762,10 @@ struct RecoContainer {
764762
auto getCosmicTracks() const { return cosmPool.getSpan<o2::dataformats::TrackCosmics>(COSM_TRACKS); }
765763
auto getCosmicTrackMCLabels() const { return cosmPool.getSpan<o2::MCCompLabel>(COSM_TRACKS_MC); }
766764

767-
// Extended cosmic tracks (with clusters); the user must include DataFormatsGlobalTracking/TrackCosmicsExtended.h and CommonDataFormat/TFIDInfo.h
765+
// Extended cosmic tracks (with clusters); the user must include DataFormatsGlobalTracking/TrackCosmicsExtended.h
768766
const o2::dataformats::TrackCosmicsExtended& getCosmicExtTrack(int i) const { return cosmPool.get_as<o2::dataformats::TrackCosmicsExtended>(COSMEXT_TRACKS, i); }
769767
auto getCosmicExtTracks() const { return cosmPool.getSpan<o2::dataformats::TrackCosmicsExtended>(COSMEXT_TRACKS); }
770768
const o2::dataformats::CosmicsTFInfo& getCosmicExtTFInfo() const { return cosmPool.get_as<o2::dataformats::CosmicsTFInfo>(COSMEXT_TFINFO, 0); }
771-
const o2::dataformats::TFIDInfo& getCosmicExtTFID() const { return cosmPool.get_as<o2::dataformats::TFIDInfo>(COSMEXT_TFID, 0); }
772769

773770
// IRFrames where ITS was reconstructed and tracks were seen (e.g. sync.w-flow mult. selection)
774771
auto getIRFramesITS() const { return getSpan<o2::dataformats::IRFrame>(GTrackID::ITS, VARIA); }

‎DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "ReconstructionDataFormats/VtxTrackRef.h"
3333
#include "ReconstructionDataFormats/TrackCosmics.h"
3434
#include "DataFormatsGlobalTracking/TrackCosmicsExtended.h"
35-
#include "CommonDataFormat/TFIDInfo.h"
3635
#include "ReconstructionDataFormats/TrackMCHMID.h"
3736
#include "DataFormatsITSMFT/TrkClusRef.h"
3837
#include "DataFormatsITSMFT/TopologyDictionary.h"
@@ -435,7 +434,6 @@ void DataRequest::requestCosmicExtTracks(bool mc)
435434
{
436435
addInput({"cosmicsExt", "GLO", "COSMFULL", 0, Lifetime::Timeframe});
437436
addInput({"cosmicsExtTF", "GLO", "COSMFULLTF", 0, Lifetime::Timeframe});
438-
addInput({"cosmicsExtTFID", "GLO", "COSMFULLTFID", 0, Lifetime::Timeframe});
439437
if (mc) {
440438
LOG(error) << "Extended cosmics do not support MC truth";
441439
}
@@ -925,18 +923,14 @@ void RecoContainer::addPVerticesTMP(ProcessingContext& pc, bool mc)
925923
void RecoContainer::addCosmicExtTracks(ProcessingContext& pc, bool mc)
926924
{
927925
using o2::dataformats::CosmicsTFInfo;
928-
using o2::dataformats::TFIDInfo;
929926
using o2::dataformats::TrackCosmicsExtended;
930927
// the messages are ROOT-serialized, keep the deserialized objects alive until the next TF
931928
std::shared_ptr<const std::vector<TrackCosmicsExtended>> cosm = pc.inputs().get<std::vector<TrackCosmicsExtended>*>("cosmicsExt");
932929
std::shared_ptr<const CosmicsTFInfo> tfInfo = pc.inputs().get<CosmicsTFInfo*>("cosmicsExtTF");
933-
std::shared_ptr<const TFIDInfo> tfID = pc.inputs().get<TFIDInfo*>("cosmicsExtTFID");
934930
cosmPool.registerContainer(*cosm, COSMEXT_TRACKS);
935931
cosmPool.registerContainer(gsl::span<const CosmicsTFInfo>(tfInfo.get(), 1), COSMEXT_TFINFO);
936-
cosmPool.registerContainer(gsl::span<const TFIDInfo>(tfID.get(), 1), COSMEXT_TFID);
937932
cosmExtHolder[0] = std::move(cosm);
938933
cosmExtHolder[1] = std::move(tfInfo);
939-
cosmExtHolder[2] = std::move(tfID);
940934
if (mc) {
941935
LOG(error) << "Extended cosmics do not support MC truth";
942936
}

‎Detectors/GlobalTrackingWorkflow/readers/include/GlobalTrackingWorkflowReaders/TrackCosmicsExtendedReaderSpec.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TrackCosmicsExtendedReader : public Task
3939

4040
private:
4141
void connectTree(const std::string& filename);
42+
bool mIncludeTFIDInfo = false;
4243
std::unique_ptr<TFile> mFile;
4344
std::unique_ptr<TTree> mTree;
4445
std::string mFileName = "";

‎Detectors/GlobalTrackingWorkflow/readers/src/TrackCosmicsExtendedReaderSpec.cxx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace globaltracking
2828
{
2929
void TrackCosmicsExtendedReader::init(InitContext& ic)
3030
{
31+
mIncludeTFIDInfo = ic.options().get<bool>("push-tfid-info");
3132
mFileName = o2::utils::Str::concat_string(o2::utils::Str::rectifyDirectory(ic.options().get<std::string>("input-dir")),
3233
ic.options().get<std::string>("cosmics-full-infile"));
3334
connectTree(mFileName);
@@ -50,8 +51,9 @@ void TrackCosmicsExtendedReader::run(ProcessingContext& pc)
5051

5152
pc.outputs().snapshot(Output{"GLO", "COSMFULL", 0}, mCosmics);
5253
pc.outputs().snapshot(Output{"GLO", "COSMFULLTF", 0}, mTFInfo);
53-
pc.outputs().snapshot(Output{"GLO", "COSMFULLTFID", 0}, mTFID);
54-
54+
if (mIncludeTFIDInfo) {
55+
pc.outputs().snapshot(Output{"GLO", "COSMFULLTFID", 0}, mTFID);
56+
}
5557
if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
5658
pc.services().get<ControlService>().endOfStream();
5759
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
@@ -71,7 +73,9 @@ void TrackCosmicsExtendedReader::connectTree(const std::string& filename)
7173
}
7274
mTree->SetBranchAddress("cosmics", &mCosmicsPtr);
7375
mTree->SetBranchAddress("tfInfo", &mTFInfoPtr);
74-
mTree->SetBranchAddress("tfID", &mTFIDPtr);
76+
if (mIncludeTFIDInfo) {
77+
mTree->SetBranchAddress("tfID", &mTFIDPtr);
78+
}
7579
LOG(info) << "Loaded tree from " << filename << " with " << mTree->GetEntries() << " entries";
7680
}
7781

@@ -89,6 +93,7 @@ DataProcessorSpec getTrackCosmicsExtendedReaderSpec()
8993
AlgorithmSpec{adaptFromTask<TrackCosmicsExtendedReader>()},
9094
Options{
9195
{"cosmics-full-infile", VariantType::String, "o2_cosmics_full.root", {"Name of the input file"}},
96+
{"push-tfid-info", VariantType::Bool, false, {"Include tfID branch (identical to o2_tfidinfo.root content pushed by DPL)"}},
9297
{"input-dir", VariantType::String, "none", {"Input directory"}}}};
9398
}
9499

0 commit comments

Comments
 (0)