Skip to content

Commit 5e4b5b9

Browse files
committed
Add a converter for version 002 of reduced MC events
1 parent e702ca6 commit 5e4b5b9

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

PWGDQ/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ o2physics_add_dpl_workflow(model-converter-mc-reduced-event
144144
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGDQCore
145145
COMPONENT_NAME Analysis)
146146

147+
o2physics_add_dpl_workflow(model-converter-mc-reduced-event-002
148+
SOURCES ModelConverterReducedMCEventsV002.cxx
149+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGDQCore
150+
COMPONENT_NAME Analysis)
151+
147152
o2physics_add_dpl_workflow(tag-and-probe
148153
SOURCES TagAndProbe.cxx
149154
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no
13+
//
14+
// Task used to convert the data model from the old format to the new format. To avoid
15+
// the conflict with the old data model.
16+
17+
#include "PWGDQ/DataModel/ReducedInfoTables.h"
18+
19+
#include <Framework/AnalysisDataModel.h>
20+
#include <Framework/AnalysisHelpers.h>
21+
#include <Framework/AnalysisTask.h>
22+
#include <Framework/runDataProcessing.h>
23+
#include <sys/types.h>
24+
25+
using namespace o2;
26+
using namespace o2::framework;
27+
using namespace o2::framework::expressions;
28+
using namespace o2::aod;
29+
30+
struct reducedMCeventConverter002 {
31+
Produces<aod::ReducedMCEvents_002> reducedMCevent_002;
32+
33+
void init(InitContext const&)
34+
{
35+
if (doprocessV000ToV002 == false && doprocessV001ToV002 == false) {
36+
LOGF(fatal, "Neither processV000ToV002 nor processV001ToV002 is enabled. Please choose one!");
37+
}
38+
if (doprocessV000ToV002 == true && doprocessV001ToV002 == true) {
39+
LOGF(fatal, "Both processV000ToV002 and processV001ToV002 are enabled. Please choose only one!");
40+
}
41+
}
42+
43+
void processV000ToV002(aod::ReducedMCEvents_000 const& events)
44+
{
45+
for (const auto& event : events) {
46+
uint64_t globalBc = 0;
47+
reducedMCevent_002(globalBc, event.generatorsID(), event.mcPosX(), event.mcPosY(), event.mcPosZ(),
48+
event.t(), event.weight(), event.impactParameter(),
49+
-1.0f, -1.0f, -1.0f, -1.0f);
50+
}
51+
}
52+
PROCESS_SWITCH(reducedMCeventConverter002, processV000ToV002, "process v000-to-v002 conversion", false);
53+
54+
void processV001ToV002(aod::ReducedMCEvents_001 const& events)
55+
{
56+
for (const auto& event : events) {
57+
uint64_t globalBc = 0;
58+
reducedMCevent_002(globalBc, event.generatorsID(), event.mcPosX(), event.mcPosY(), event.mcPosZ(),
59+
event.t(), event.weight(), event.impactParameter(),
60+
event.centFT0C(), event.multMCNParticlesEta05(), event.multMCNParticlesEta08(), event.multMCNParticlesEta10());
61+
}
62+
}
63+
PROCESS_SWITCH(reducedMCeventConverter002, processV001ToV002, "process v001-to-v002 conversion", true);
64+
};
65+
66+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
67+
{
68+
return WorkflowSpec{
69+
adaptAnalysisTask<reducedMCeventConverter002>(cfgc)};
70+
}

0 commit comments

Comments
 (0)