1414// / @brief Workflow definition for the TPC reconstruction
1515
1616#include " Framework/WorkflowSpec.h"
17-
17+ # include " Utils/MakeRootTreeWriterSpec.h "
1818#include " TPCWorkflow/RecoWorkflow.h"
1919#include " DigitReaderSpec.h"
2020#include " ClusterReaderSpec.h"
2121#include " ClustererSpec.h"
2222#include " ClusterConverterSpec.h"
2323#include " ClusterDecoderRawSpec.h"
2424#include " CATrackerSpec.h"
25- #include " RootFileWriterSpec.h"
2625#include " DataFormatsTPC/Constants.h"
2726#include " DataFormatsTPC/ClusterGroupAttribute.h"
27+ #include " DataFormatsTPC/TrackTPC.h"
28+ #include " SimulationDataFormat/MCTruthContainer.h"
29+ #include " SimulationDataFormat/MCCompLabel.h"
2830
2931#include " FairMQLogger.h"
3032#include < string>
@@ -43,6 +45,8 @@ namespace RecoWorkflow
4345{
4446
4547using namespace framework ;
48+ template <typename T>
49+ using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>;
4650
4751const std::unordered_map<std::string, InputType> InputMap{
4852 { " digitizer" , InputType::Digitizer },
@@ -144,7 +148,31 @@ framework::WorkflowSpec getWorkflow(bool propagateMC, int nLanes, std::string cf
144148
145149 if (outputType == OutputType::Tracks) {
146150 specs.emplace_back (o2::TPC::getCATrackerSpec (propagateMC, nLanes));
147- specs.emplace_back (o2::TPC::getRootFileWriterSpec (propagateMC));
151+
152+ // defining the track writer process using the generic RootTreeWriter and generator tool
153+ //
154+ // defaults
155+ const char * processName = " tpc-track-writer" ;
156+ const char * defaultFileName = " tpctracks.root" ;
157+ const char * defaultTreeName = " tpcrec" ;
158+
159+ // branch definitions for RootTreeWriter spec
160+ using TrackOutputType = std::vector<o2::TPC ::TrackTPC>;
161+ using MCLabelContainer = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;
162+ auto tracksdef = BranchDefinition<TrackOutputType>{ InputSpec{ " input" , " TPC" , " TRACKS" }, //
163+ " TPCTracks" , " track-branch-name" }; //
164+ auto mcdef = BranchDefinition<MCLabelContainer>{ InputSpec{ " mcinput" , " TPC" , " TRACKMCLBL" }, //
165+ " TPCTracksMCTruth" , " trackmc-branch-name" }; //
166+
167+ // depending on the MC propagation flag, the RootTreeWriter spec is created with two
168+ // or one branch definition
169+ if (propagateMC) {
170+ specs.push_back (MakeRootTreeWriterSpec (processName, defaultFileName, defaultTreeName, //
171+ std::move (tracksdef), std::move (mcdef))()); //
172+ } else { //
173+ specs.push_back (MakeRootTreeWriterSpec (processName, defaultFileName, defaultTreeName, //
174+ std::move (tracksdef))()); //
175+ }
148176 } else if (outputType == OutputType::DecodedClusters) {
149177 specs.emplace_back (DataProcessorSpec{ " writer" ,
150178 { createInputSpec () },
0 commit comments