Skip to content

Commit 127824d

Browse files
committed
example AOD rewrite workflow
1 parent 63c7419 commit 127824d

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Framework/TestWorkflows/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ o2_add_dpl_workflow(analysis-emb
5050
SOURCES src/o2TestMultisource.cxx
5151
COMPONENT_NAME TestWorkflows)
5252

53+
o2_add_dpl_workflow(analysis-aod-rewrite
54+
SOURCES src/o2testAODrewrite.cxx
55+
COMPONENT_NAME TestWorkflows)
56+
5357
o2_add_dpl_workflow(two-timers
5458
SOURCES src/o2TwoTimers.cxx
5559
COMPONENT_NAME TestWorkflows)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
///
12+
/// \brief Example for rewriting AOD tables
13+
/// \author
14+
/// \since
15+
16+
#include "Framework/runDataProcessing.h"
17+
#include "Framework/AnalysisTask.h"
18+
19+
using namespace o2;
20+
using namespace o2::framework;
21+
using namespace o2::framework::expressions;
22+
23+
struct RewriteMcParticles {
24+
Produces<aod::StoredMcParticles_001From<o2::aod::Hash<"AOD1"_h>>> mcparts;
25+
26+
Filter lessThan15 = nabs(aod::mcparticle::eta) < 1.5f;
27+
28+
void process(soa::Filtered<aod::McParticles_001> const& mcparticles) // subscribe to full to have Eta
29+
{
30+
for (auto& particle : mcparticles) {
31+
mcparts(
32+
particle.mcCollisionId(),
33+
particle.pdgCode(),
34+
particle.statusCode(),
35+
particle.flags(),
36+
particle.mothersIds(),
37+
particle.daughtersIds().data(),
38+
particle.weight(),
39+
particle.px(),
40+
particle.py(),
41+
particle.pz(),
42+
particle.e(),
43+
particle.vx(),
44+
particle.vy(),
45+
particle.vz(),
46+
particle.vt()
47+
);
48+
}
49+
}
50+
};
51+
52+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
53+
{
54+
return {adaptAnalysisTask<RewriteMcParticles>(cfgc)};
55+
}

0 commit comments

Comments
 (0)