Project
Loading...
Searching...
No Matches
o2TestHistograms.cxx
Go to the documentation of this file.
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.
15
18#include <TH2F.h>
19
20using namespace o2;
21using namespace o2::framework;
22using namespace o2::framework::expressions;
23
24namespace o2::aod
25{
26O2ORIGIN("EMB");
27namespace skimmedExampleTrack
28{
29DECLARE_SOA_COLUMN(Pt, pt, float);
30DECLARE_SOA_COLUMN(Eta, eta, float);
31} // namespace skimmedExampleTrack
32
33DECLARE_SOA_TABLE(SkimmedExampleTrack, "AOD", "SKIMEXTRK",
34 skimmedExampleTrack::Pt,
35 skimmedExampleTrack::Eta);
36} // namespace o2::aod
37
39 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
41 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
42 Filter trackFilter = o2::aod::track::pt < 10.f;
43
45 "registry",
46 {
47 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
48 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
49 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
50 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
51 } //
52 };
53
55 "registry2",
56 {
57 {"a/foo/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
58 {"fii/c/hpt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
59 {"a/foobar/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
60 {"fifi/ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
61 },
62 OutputObjHandlingPolicy::AnalysisObject,
63 false,
64 true};
65
67 {
68 if (!trackFilterString->empty()) {
70 }
71 }
72
73 void process(soa::Filtered<aod::Tracks> const& tracks, aod::FT0s const&)
74 {
75 LOGP(info, "Invoking the simple one");
76 for (auto& track : tracks) {
77 etaClsH->Fill(track.eta(), track.pt());
78 skimEx(track.pt(), track.eta());
79
80 registry.fill(HIST("a/b/eta"), track.eta());
81 registry.fill(HIST("a/phi"), track.phi());
82 registry.fill(HIST("c/pt"), track.pt());
83 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
84 }
85 }
86};
87
89 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
91 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
92 Filter trackFilter = o2::aod::track::pt < 10.f;
93
95 "registry",
96 {
97 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
98 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
99 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
100 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
101 } //
102 };
103
105 {
106 if (!trackFilterString->empty()) {
108 }
109 }
110
111 void process(soa::Filtered<aod::TracksIU> const& tracks, aod::FT0s const&)
112 {
113 LOGP(info, "Invoking the simple one IU");
114 for (auto& track : tracks) {
115 etaClsH->Fill(track.eta(), track.pt());
116 skimEx(track.pt(), track.eta());
117
118 registry.fill(HIST("a/b/eta"), track.eta());
119 registry.fill(HIST("a/phi"), track.phi());
120 registry.fill(HIST("c/pt"), track.pt());
121 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
122 }
123 }
124};
125
127 OutputObj<TH3F> etaClsH{TH3F("eta_vs_cls_vs_sigmapT", "#eta vs N_{cls} vs sigma_{1/pT}", 102, -2.01, 2.01, 160, -0.5, 159.5, 100, 0, 10)};
128
130 "registry",
131 {
132 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
133 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
134 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
135 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
136 } //
137 };
138
139 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
140 Filter trackFilter = o2::aod::track::pt < 10.f;
141
143 {
144 if (!trackFilterString->empty()) {
146 }
147 }
148
150 {
151 LOGP(info, "Invoking the run 3 one");
152 for (auto& track : tracks) {
153 etaClsH->Fill(track.eta(), track.tpcNClsFindable(), track.sigma1Pt());
154
155 registry.fill(HIST("a/b/eta"), track.eta());
156 registry.fill(HIST("a/phi"), track.phi());
157 registry.fill(HIST("c/pt"), track.pt());
158 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
159 }
160 }
161};
162
164{
165 std::string runType = "3";
166 std::vector<std::string> tables;
167 if (cfgc.options().hasOption("aod-metadata-Run")) {
168 runType = cfgc.options().get<std::string>("aod-metadata-Run");
169 }
170 if (cfgc.options().hasOption("aod-metadata-tables")) {
171 tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
172 }
173 LOGP(info, "Runtype is {}", runType);
174 bool hasTrackCov = false;
175 bool hasTrackIU = false;
176 for (auto& table : tables) {
177 if (table == "O2trackcov") {
178 hasTrackCov = true;
179 }
180 if (table.starts_with("O2track_iu")) {
181 hasTrackIU = true;
182 }
183 LOGP(info, "- {} present.", table);
184 }
185 // Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
186 if (runType == "2" || !hasTrackCov) {
187 LOGP(info, "Using only tracks {}", runType);
188 if (hasTrackIU) {
189 return WorkflowSpec{
190 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
191 };
192 }
193 return WorkflowSpec{
194 adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),
195 };
196 } else {
197 LOGP(info, "Using tracks extra {}", runType);
198 if (hasTrackIU) {
199 return WorkflowSpec{
200 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
201 };
202 }
203 return WorkflowSpec{
204 adaptAnalysisTask<EtaAndClsHistogramsFull>(cfgc, TaskName{"simple-histos"}),
205 };
206 }
207}
#define O2ORIGIN(_Str_)
Pre-declare Hash specialization for an origin string.
Definition ASoA.h:302
#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_,...)
Definition ASoA.h:3244
#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_)
Definition ASoA.h:2469
#define HIST(name)
ConfigParamRegistry & options() const
bool hasOption(const char *key) const
void fill(const HistName &histName, Ts... positionAndWeight)
Defining PrimaryVertex explicitly as messageable.
std::vector< DataProcessorSpec > WorkflowSpec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
void process(soa::Filtered< soa::Join< aod::FullTracks, aod::TracksCov > > const &tracks)
Configurable< std::string > trackFilterString
void process(soa::Filtered< aod::TracksIU > const &tracks, aod::FT0s const &)
Configurable< std::string > trackFilterString
Produces< o2::aod::SkimmedExampleTrack > skimEx
Configurable< std::string > trackFilterString
void process(soa::Filtered< aod::Tracks > const &tracks, aod::FT0s const &)
Produces< o2::aod::SkimmedExampleTrack > skimEx
Struct to differentiate task names from possible task string arguments.
A struct, containing the root of the expression tree.
static Node parse(std::string const &input)