Skip to content

Commit e999d1b

Browse files
authored
[EMCAL-888] Add caloLabelConverter task (#2331)
- Add caloLabelConverter task to convert McCaloLabels_000 to McCaloLabels_001 for backwards compatibility. The amplitude fraction which is new in McCaloLabels_001 will be initilised with 0 since we don't have that information in tge old McCaloLabels_000.
1 parent f21f945 commit e999d1b

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Common/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,8 @@ o2physics_add_dpl_workflow(track-to-collision-associator
9999
SOURCES trackToCollisionAssociator.cxx
100100
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
101101
COMPONENT_NAME Analysis)
102+
103+
o2physics_add_dpl_workflow(calo-label-converter
104+
SOURCES caloLabelConverter.cxx
105+
PUBLIC_LINK_LIBRARIES O2::Framework
106+
COMPONENT_NAME Analysis)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#include "Framework/runDataProcessing.h"
12+
#include "Framework/AnalysisTask.h"
13+
#include "Framework/AnalysisDataModel.h"
14+
15+
using namespace o2;
16+
using namespace o2::framework;
17+
18+
// Converts the old McCaloLabels_000 table to the new McCaloLabels_001 table where we have a variable size array for associated MCParticles for each calo cell
19+
struct caloLabelConverter {
20+
Produces<aod::McCaloLabels_001> McCaloLabels_001;
21+
22+
void process(aod::McCaloLabels_000 const& mccalolabelTable)
23+
{
24+
std::vector<float> amplitude = {0};
25+
std::vector<int32_t> particleId = {0};
26+
for (auto& mccalolabel : mccalolabelTable) {
27+
particleId[0] = mccalolabel.mcParticleId();
28+
// Repopulate new table
29+
McCaloLabels_001(
30+
particleId,
31+
mccalolabel.mcMask(),
32+
amplitude);
33+
}
34+
}
35+
};
36+
37+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
38+
{
39+
return WorkflowSpec{
40+
adaptAnalysisTask<caloLabelConverter>(cfgc),
41+
};
42+
}

0 commit comments

Comments
 (0)