-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathaodreader.cxx
More file actions
156 lines (140 loc) · 4.14 KB
/
aodreader.cxx
File metadata and controls
156 lines (140 loc) · 4.14 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// 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"
/// This example is to be used together with the aodwriter example.
/// aodwriter creates three tables and writes them to two sets of files.
/// aodreader reads these files and creates related tables. aodwriter takes an
/// aod file with tracks as input.
///
/// USAGE:
///
/// o2-analysistutorial-aodwriter --aod-file AO2D_ppK0starToyMC_v3.root --json-file writerConfiguration.json
/// ls -1 treResults*.root > resultFiles.txt
/// ls -1 unodueResults*.root >> resultFiles.txt
/// o2-analysistutorial-aodreader --json-file readerConfiguration.json
///
/// writerConfiguration.json:
/// {
/// "OutputDirector": {
/// "debugmode": true,
/// "resfile": "unodueResults",
/// "resfilemode": "RECREATE",
/// "ntfmerge": 1,
/// "OutputDescriptors": [
/// {
/// "table": "AOD/UNO/0",
/// "treename": "unotree"
/// },
/// {
/// "table": "AOD/DUE/0",
/// "columns": [
/// "due_1",
/// "due_3",
/// "due_5"
/// ],
/// "treename": "duetree"
/// },
/// {
/// "table": "AOD/TRE/0",
/// "filename": "treResults"
/// }
/// ]
/// }
/// }
///
/// readerConfiguration.json:
/// {
/// "InputDirector": {
/// "debugmode": true,
/// "resfiles": "@resultFiles.txt",
/// "fileregex": "(unodue)(.*)",
/// "InputDescriptors": [
/// {
/// "table": "AOD/EINS/0",
/// "treename": "unotree"
/// },
/// {
/// "table": "AOD/ZWEI/0",
/// "treename": "duetree"
/// },
/// {
/// "table": "AOD/DREI/0",
/// "treename": "TRE",
/// "fileregex": "(treResults)(.*)"
/// }
/// ]
/// }
/// }
namespace o2::aod
{
namespace eins
{
DECLARE_SOA_COLUMN_FULL(Eta, eta, float, "uno_1");
DECLARE_SOA_COLUMN_FULL(Mom, mom, double, "uno_3");
} // namespace eins
DECLARE_SOA_TABLE(Eins, "AOD", "EINS",
eins::Eta, eins::Mom);
namespace zwei
{
DECLARE_SOA_COLUMN_FULL(Ok, ok, bool, "due_1");
DECLARE_SOA_COLUMN_FULL(Phi, phi, float, "due_3");
DECLARE_SOA_COLUMN_FULL(Pt, pt, double, "due_5");
} // namespace zwei
DECLARE_SOA_TABLE(Zwei, "AOD", "ZWEI",
zwei::Ok, zwei::Phi, zwei::Pt);
namespace drei
{
DECLARE_SOA_COLUMN_FULL(Eta, eta, float, "tre_1");
DECLARE_SOA_COLUMN_FULL(Phi, phi, float, "tre_2");
DECLARE_SOA_COLUMN_FULL(Mom, mom, double, "tre_3");
} // namespace drei
DECLARE_SOA_TABLE(Drei, "AOD", "DREI",
drei::Eta, drei::Phi, drei::Mom);
} // namespace o2::aod
using namespace o2;
using namespace o2::framework;
struct ATask {
void process(aod::Eins const& unos, aod::Zwei const& dues, aod::Drei const& tres)
{
int cnt = 0;
for (auto& uno : unos) {
auto eta = uno.eta();
auto mom = uno.mom();
cnt++;
LOGF(INFO, "Eins (%i): (%f, %f)", cnt, eta, mom);
}
LOGF(INFO, "ATask Processed %i data points from Eins", cnt);
cnt = 0;
for (auto& due : dues) {
auto ok = due.ok();
auto phi = due.phi();
auto pt = due.pt();
cnt++;
LOGF(INFO, "Zwei (%i): (%i, %f, %f)", cnt, ok, phi, pt);
}
LOGF(INFO, "ATask Processed %i data points from Zwei", cnt);
cnt = 0;
for (auto& tre : tres) {
auto eta = tre.eta();
auto phi = tre.phi();
auto mom = tre.mom();
cnt++;
LOGF(INFO, "Drei (%i): (%f, %f, %f)", cnt, eta, phi, mom);
}
LOGF(INFO, "ATask Processed %i data points from Drei", cnt);
}
};
WorkflowSpec defineDataProcessing(ConfigContext const&)
{
return WorkflowSpec{
adaptAnalysisTask<ATask>("process-unoduetre")};
}