Skip to content

Commit bcafdb6

Browse files
authored
New options: writing tables directly into a .root file and MC tracks filtering. (#5646)
* New options: writing tables directly into a .root file and MC tracks filtering. * Rearrange run() to write tables right after filling + some fixes * Release MC tracks from memory after usage * Merge findRelatives() and fillMCParticlesTable() into one function to fetch MC tracks only once Related to https://alice.its.cern.ch/jira/browse/O2-2091.
1 parent dd95d89 commit bcafdb6

5 files changed

Lines changed: 319 additions & 127 deletions

File tree

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace o2::aodproducer
1919
{
2020

21-
framework::WorkflowSpec getAODProducerWorkflow();
21+
framework::WorkflowSpec getAODProducerWorkflow(int ignoreWriter);
2222

2323
} // namespace o2::aodproducer
2424
#endif

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include "Framework/Task.h"
2121
#include "GlobalTrackingWorkflow/PrimaryVertexingSpec.h"
2222
#include "TStopwatch.h"
23-
#include <CCDB/BasicCCDBManager.h>
23+
#include "CCDB/BasicCCDBManager.h"
24+
#include "Steer/MCKinematicsReader.h"
25+
#include "SimulationDataFormat/MCCompLabel.h"
2426
#include <string>
2527
#include <vector>
2628

@@ -96,18 +98,20 @@ using MCParticlesTable = o2::soa::Table<o2::aod::mcparticle::McCollisionId,
9698
class AODProducerWorkflowDPL : public Task
9799
{
98100
public:
99-
AODProducerWorkflowDPL() = default;
101+
AODProducerWorkflowDPL(int ignoreWriter) : mIgnoreWriter(ignoreWriter){};
100102
~AODProducerWorkflowDPL() override = default;
101103
void init(InitContext& ic) final;
102104
void run(ProcessingContext& pc) final;
103105
void endOfStream(framework::EndOfStreamContext& ec) final;
104106

105107
private:
106-
int mFillTracksITS = 1;
107-
int mFillTracksTPC = 0;
108-
int mFillTracksITSTPC = 1;
109-
int mTFNumber = -1;
110-
int mTruncate = 1;
108+
int mFillTracksITS{1};
109+
int mFillTracksTPC{0};
110+
int mFillTracksITSTPC{1};
111+
int mTFNumber{-1};
112+
int mTruncate{1};
113+
int mIgnoreWriter{0};
114+
int mRecoOnly{0};
111115
TStopwatch mTimer;
112116

113117
// truncation is enabled by default
@@ -148,15 +152,22 @@ class AODProducerWorkflowDPL : public Task
148152
uint64_t minGlBC = INT64_MAX;
149153

150154
void findMinMaxBc(gsl::span<const o2::ft0::RecPoints>& ft0RecPoints, gsl::span<const o2::vertexing::PVertex>& primVertices, const std::vector<o2::InteractionTimeRecord>& mcRecords);
151-
int64_t getTFNumber(uint64_t firstVtxGlBC, int runNumber);
155+
uint64_t getTFNumber(uint64_t firstVtxGlBC, int runNumber);
152156

153157
template <typename TTracks, typename TTracksCursor, typename TTracksCovCursor, typename TTracksExtraCursor>
154158
void fillTracksTable(const TTracks& tracks, std::vector<int>& vCollRefs, const TTracksCursor& tracksCursor,
155159
const TTracksCovCursor& tracksCovCursor, const TTracksExtraCursor& tracksExtraCursor, int trackType);
160+
161+
template <typename MCParticlesCursorType>
162+
void fillMCParticlesTable(o2::steer::MCKinematicsReader& mcReader, const MCParticlesCursorType& mcParticlesCursor,
163+
gsl::span<const o2::MCCompLabel>& mcTruthITS, gsl::span<const o2::MCCompLabel>& mcTruthTPC,
164+
std::vector<std::vector<std::vector<int>>>& toStore);
165+
166+
void writeTableToFile(TFile* outfile, std::shared_ptr<arrow::Table>& table, const std::string& tableName, uint64_t tfNumber);
156167
};
157168

158169
/// create a processor spec
159-
framework::DataProcessorSpec getAODProducerWorkflowSpec();
170+
framework::DataProcessorSpec getAODProducerWorkflowSpec(int ignoreWriter);
160171

161172
} // namespace o2::aodproducer
162173

Detectors/AOD/src/AODProducerWorkflow.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
namespace o2::aodproducer
3232
{
3333

34-
framework::WorkflowSpec getAODProducerWorkflow()
34+
framework::WorkflowSpec getAODProducerWorkflow(int ignoreWriter)
3535
{
3636
// TODO:
3737
// switch to configurable parameters (?)
@@ -47,7 +47,7 @@ framework::WorkflowSpec getAODProducerWorkflow()
4747
o2::tpc::getTPCTrackReaderSpec(useMC),
4848
o2::ft0::getDigitReaderSpec(useMC),
4949
o2::ft0::getReconstructionSpec(useMC),
50-
o2::aodproducer::getAODProducerWorkflowSpec()};
50+
o2::aodproducer::getAODProducerWorkflowSpec(ignoreWriter)};
5151

5252
return specs;
5353
}

0 commit comments

Comments
 (0)