Skip to content

Commit 80bfe14

Browse files
committed
Fix: Proper treatment of --disable-mc in PHOS CellConverterSpec
1 parent a23e53a commit 80bfe14

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Detectors/PHOS/workflow/include/PHOSWorkflow/CellConverterSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class CellConverterSpec : public framework::Task
7575
std::vector<Cell> mOutputCells; ///< Container with output cells
7676
std::vector<TriggerRecord> mOutputCellTrigRecs; ///< Container with trigger records for output cells
7777
o2::dataformats::MCTruthContainer<MCLabel> mOutputTruthCont; ///< output MC labels
78-
std::vector<uint> mOutputTruthMap; ///< output MC labels
78+
std::vector<uint32_t> mOutputTruthMap; ///< output MC labels
7979
o2::phos::BadChannelMap* mBadMap = nullptr; ///< Bad channels map
8080
};
8181

Detectors/PHOS/workflow/src/CellConverterSpec.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "Framework/ControlService.h"
1717
#include "DataFormatsPHOS/MCLabel.h"
1818
#include "SimulationDataFormat/MCTruthContainer.h"
19+
#include "SimulationDataFormat/ConstMCTruthContainer.h"
1920
#include "CommonDataFormat/InteractionRecord.h"
2021
#include "PHOSBase/PHOSSimParams.h"
2122
#include "CCDB/CcdbApi.h"
@@ -44,11 +45,15 @@ void CellConverterSpec::run(framework::ProcessingContext& ctx)
4445

4546
auto digits = ctx.inputs().get<std::vector<o2::phos::Digit>>("digits");
4647
auto digitsTR = ctx.inputs().get<std::vector<o2::phos::TriggerRecord>>("digitTriggerRecords");
47-
auto truthcont = ctx.inputs().get<o2::dataformats::MCTruthContainer<o2::phos::MCLabel>*>("digitsmctr");
48+
gsl::span<const char> labelbuffer;
4849
if (mPropagateMC) {
50+
labelbuffer = ctx.inputs().get<gsl::span<char>>("digitsmctr");
51+
// auto truthcont = ctx.inputs().get<o2::dataformats::MCTruthContainer<o2::phos::MCLabel>*>("digitsmctr");
52+
4953
mOutputTruthCont.clear();
5054
mOutputTruthMap.clear();
5155
}
56+
o2::dataformats::ConstMCTruthContainerView<o2::phos::MCLabel> truthcont(labelbuffer);
5257
LOG(INFO) << "[PHOSCellConverter - run] Received " << digits.size() << " digits and " << digitsTR.size() << " TriggerRecords";
5358

5459
//Get TimeStamp from TriggerRecord
@@ -100,7 +105,7 @@ void CellConverterSpec::run(framework::ProcessingContext& ctx)
100105
if (mPropagateMC) { //copy MC info,
101106
int iLab = dig.getLabel();
102107
if (iLab > -1) {
103-
mOutputTruthCont.addElements(labelIndex, truthcont->getLabels(iLab));
108+
mOutputTruthCont.addElements(labelIndex, truthcont.getLabels(iLab));
104109
mOutputTruthMap.emplace_back(icell); //Relate cell index and label index
105110
labelIndex++;
106111
}
@@ -115,8 +120,6 @@ void CellConverterSpec::run(framework::ProcessingContext& ctx)
115120
//ctx.outputs().snapshot(o2::framework::Output{"PHS", "CELLSMCTR", 0, o2::framework::Lifetime::Timeframe}, mOutputTruthCont);
116121
//ctx.outputs().snapshot(o2::framework::Output{"PHS", "CELLSMCMAP", 0, o2::framework::Lifetime::Timeframe}, mOutputTruthMap);
117122
}
118-
LOG(INFO) << "Finished ";
119-
ctx.services().get<o2::framework::ControlService>().readyToQuit(framework::QuitRequest::Me);
120123
}
121124

122125
o2::framework::DataProcessorSpec o2::phos::reco_workflow::getCellConverterSpec(bool propagateMC)

0 commit comments

Comments
 (0)