@@ -43,6 +43,7 @@ namespace o2
4343{
4444namespace tpc
4545{
46+
4647// / create the processor spec for TPC raw cluster decoder converting TPC raw to native clusters
4748// / Input: raw pages of TPC raw clusters
4849// / Output: vector of containers with clusters in ClusterNative format, one container per
@@ -79,27 +80,18 @@ DataProcessorSpec getClusterDecoderRawSpec(bool sendMC)
7980 // init the stacks for forwarding the sector header
8081 // FIXME check if there is functionality in the DPL to forward the stack
8182 // FIXME make one function
82- o2::header::Stack rawHeaderStack;
83- o2::header::Stack mcHeaderStack;
8483 o2::tpc::TPCSectorHeader const * sectorHeaderMC = nullptr ;
8584 if (DataRefUtils::isValid (mclabelref)) {
8685 sectorHeaderMC = DataRefUtils::getHeader<o2::tpc::TPCSectorHeader*>(mclabelref);
87- if (sectorHeaderMC) {
88- o2::header::Stack actual{*sectorHeaderMC};
89- std::swap (mcHeaderStack, actual);
90- if (sectorHeaderMC->sector () < 0 ) {
91- pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLNATIVEMCLBL" ), fanSpec, std::move (mcHeaderStack)}, fanSpec);
92- }
93- }
86+ }
87+
88+ if (sectorHeaderMC && sectorHeaderMC->sector () < 0 ) {
89+ pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLNATIVEMCLBL" ), fanSpec, {*sectorHeaderMC}}, fanSpec);
9490 }
9591 auto const * sectorHeader = DataRefUtils::getHeader<o2::tpc::TPCSectorHeader*>(ref);
96- if (sectorHeader) {
97- o2::header::Stack actual{*sectorHeader};
98- std::swap (rawHeaderStack, actual);
99- if (sectorHeader->sector () < 0 ) {
100- pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLUSTERNATIVE" ), fanSpec, std::move (rawHeaderStack)}, fanSpec);
101- return ;
102- }
92+ if (sectorHeader && sectorHeader->sector () < 0 ) {
93+ pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLUSTERNATIVE" ), fanSpec, {*sectorHeader}}, fanSpec);
94+ return ;
10395 }
10496 assert (sectorHeaderMC == nullptr || sectorHeader->sector () == sectorHeaderMC->sector ());
10597
@@ -166,8 +158,8 @@ DataProcessorSpec getClusterDecoderRawSpec(bool sendMC)
166158 // output of the decoder is sorted in (sector,globalPadRow) coordinates, individual
167159 // containers are created for clusters and MC labels per (sector,globalPadRow) address
168160 char * outputBuffer = nullptr ;
169- auto outputAllocator = [&pc, &fanSpec, &outputBuffer, &rawHeaderStack ](size_t size) -> char * {
170- outputBuffer = pc.outputs ().newChunk (Output{gDataOriginTPC , DataDescription (" CLUSTERNATIVE" ), fanSpec, std::move (rawHeaderStack) }, size).data ();
161+ auto outputAllocator = [&pc, &fanSpec, &outputBuffer, sectorHeader ](size_t size) -> char * {
162+ outputBuffer = pc.outputs ().newChunk (Output{gDataOriginTPC , DataDescription (" CLUSTERNATIVE" ), fanSpec, sectorHeader ? o2::header::Stack{*sectorHeader} : o2::header::Stack{} }, size).data ();
171163 return outputBuffer;
172164 };
173165 MCLabelContainer mcout;
@@ -188,7 +180,7 @@ DataProcessorSpec getClusterDecoderRawSpec(bool sendMC)
188180 // serialize the complete list of MC label containers
189181 ConstMCLabelContainer labelsFlat;
190182 mcout.flatten_to (labelsFlat);
191- pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLNATIVEMCLBL" ), fanSpec, std::move (mcHeaderStack) }, labelsFlat);
183+ pc.outputs ().snapshot (Output{gDataOriginTPC , DataDescription (" CLNATIVEMCLBL" ), fanSpec, sectorHeaderMC ? o2::header::Stack{*sectorHeaderMC} : o2::header::Stack{} }, labelsFlat);
192184 }
193185 };
194186
0 commit comments