-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathZDCVZeroIteration.cxx
More file actions
95 lines (88 loc) · 3.8 KB
/
ZDCVZeroIteration.cxx
File metadata and controls
95 lines (88 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
// This task shows how to access the ZDC and the Run2 V0 information which belongs to a collision
// The association is made through the BC column (and in Run 3 may not be unique!)
// To run this workflow, the o2-analysis-run2-matcher has to be run as well.
// Example: o2-analysis-run2-matcher --aod-file AO2D.root | o2-analysistutorial-zdc-vzero-iteration
// This example access the collisions and the related Run2V0 information.
// Note that one has to subscribe to aod::Collisions const& and aod::Run2V0s const& to load
// the relevant data even if you access the data itself through m.collision() and m.run2v0()
// Here the "sparse" matcher is used which means, there can be collisions without Run2V0 information
// To find out, m.has_run2v0() has to be called. Otherwise m.run2v0() will fail.
struct IterateV0 {
void process(aod::Run2MatchedSparse::iterator const& m, aod::Collisions const&, aod::Run2V0s const&)
{
LOGF(INFO, "Vertex = %f", m.collision().posZ());
if (m.has_run2v0()) {
auto v0 = m.run2v0();
LOGF(info, "V0: %f %f", v0.adc()[0], v0.adc()[1]);
} else {
LOGF(INFO, "No V0 info");
}
}
};
// This example is identical to IterateV0, but uses the exclusive match. This means that lines where any
// of the tables asked for in Run2MatchedExclusive (see AnalysisDataModel.h) are missing are not listed.
// Only to be used if one is sure that all your events have the desired information
struct IterateV0Exclusive {
void process(aod::Run2MatchedExclusive::iterator const& m, aod::Collisions const&, aod::Run2V0s const&)
{
LOGF(INFO, "Vertex = %f", m.collision().posZ());
auto v0 = m.run2v0();
LOGF(info, "V0: %f %f", v0.adc()[0], v0.adc()[1]);
}
};
// This example builds on IterateV0 and in addition accesses also the tracks grouped to the specific collision.
// The tracks are directly access through its pointer.
struct IterateV0Tracks {
void process(aod::Run2MatchedSparse::iterator const& m, aod::Collisions const&, aod::Run2V0s const&, aod::Tracks const& tracks)
{
LOGF(INFO, "Vertex = %f. %d tracks", m.collision().posZ(), tracks.size());
if (m.has_run2v0()) {
auto v0 = m.run2v0();
LOGF(info, "V0: %f %f", v0.adc()[0], v0.adc()[1]);
} else {
LOGF(INFO, "No V0 info");
}
}
};
// This example accesses V0 and ZDC information
struct IterateV0ZDC {
void process(aod::Run2MatchedSparse::iterator const& m, aod::Collisions const&, aod::Run2V0s const&, aod::Zdcs const&)
{
LOGF(INFO, "Vertex = %f", m.collision().posZ());
if (m.has_run2v0()) {
auto v0 = m.run2v0();
LOGF(info, "V0: %f %f", v0.adc()[0], v0.adc()[1]);
} else {
LOGF(INFO, "No V0 info");
}
if (m.has_zdc()) {
LOGF(INFO, "ZDC: E1 = %.3f; E2 = %.3f", m.zdc().energyZEM1(), m.zdc().energyZEM2());
} else {
LOGF(INFO, "No ZDC info");
}
}
};
WorkflowSpec defineDataProcessing(ConfigContext const&)
{
return WorkflowSpec{
adaptAnalysisTask<IterateV0>("iterate-v0"),
adaptAnalysisTask<IterateV0Exclusive>("iterate-v0-exclusive"),
adaptAnalysisTask<IterateV0Tracks>("iterate-v0-tracks"),
adaptAnalysisTask<IterateV0ZDC>("iterate-v0-zdc"),
};
}