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{
26namespace skimmedExampleTrack
27{
28DECLARE_SOA_COLUMN(Pt, pt, float);
29DECLARE_SOA_COLUMN(Eta, eta, float);
30} // namespace skimmedExampleTrack
31
32DECLARE_SOA_TABLE(SkimmedExampleTrack, "AOD", "SKIMEXTRK",
33 skimmedExampleTrack::Pt,
34 skimmedExampleTrack::Eta);
35} // namespace o2::aod
36
38 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
40 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
41 Filter trackFilter = o2::aod::track::pt < 10.f;
42
44 "registry",
45 {
46 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
47 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
48 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
49 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
50 } //
51 };
52
54 "registry2",
55 {
56 {"a/foo/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
57 {"fii/c/hpt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
58 {"a/foobar/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
59 {"fifi/ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
60 },
61 OutputObjHandlingPolicy::AnalysisObject,
62 false,
63 true};
64
66 {
67 if (!trackFilterString->empty()) {
69 }
70 }
71
72 void process(soa::Filtered<aod::Tracks> const& tracks, aod::FT0s const&)
73 {
74 LOGP(info, "Invoking the simple one");
75 for (auto& track : tracks) {
76 etaClsH->Fill(track.eta(), track.pt());
77 skimEx(track.pt(), track.eta());
78
79 registry.fill(HIST("a/b/eta"), track.eta());
80 registry.fill(HIST("a/phi"), track.phi());
81 registry.fill(HIST("c/pt"), track.pt());
82 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
83 }
84 }
85};
86
88 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
90 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
91 Filter trackFilter = o2::aod::track::pt < 10.f;
92
94 "registry",
95 {
96 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
97 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
98 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
99 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
100 } //
101 };
102
104 {
105 if (!trackFilterString->empty()) {
107 }
108 }
109
110 void process(soa::Filtered<aod::TracksIU> const& tracks, aod::FT0s const&)
111 {
112 LOGP(info, "Invoking the simple one IU");
113 for (auto& track : tracks) {
114 etaClsH->Fill(track.eta(), track.pt());
115 skimEx(track.pt(), track.eta());
116
117 registry.fill(HIST("a/b/eta"), track.eta());
118 registry.fill(HIST("a/phi"), track.phi());
119 registry.fill(HIST("c/pt"), track.pt());
120 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
121 }
122 }
123};
124
126 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)};
127
129 "registry",
130 {
131 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
132 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
133 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
134 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
135 } //
136 };
137
138 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
139 Filter trackFilter = o2::aod::track::pt < 10.f;
140
142 {
143 if (!trackFilterString->empty()) {
145 }
146 }
147
149 {
150 LOGP(info, "Invoking the run 3 one");
151 for (auto& track : tracks) {
152 etaClsH->Fill(track.eta(), track.tpcNClsFindable(), track.sigma1Pt());
153
154 registry.fill(HIST("a/b/eta"), track.eta());
155 registry.fill(HIST("a/phi"), track.phi());
156 registry.fill(HIST("c/pt"), track.pt());
157 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
158 }
159 }
160};
161
163{
164 std::string runType = "3";
165 std::vector<std::string> tables;
166 if (cfgc.options().hasOption("aod-metadata-Run")) {
167 runType = cfgc.options().get<std::string>("aod-metadata-Run");
168 }
169 if (cfgc.options().hasOption("aod-metadata-tables")) {
170 tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
171 }
172 LOGP(info, "Runtype is {}", runType);
173 bool hasTrackCov = false;
174 bool hasTrackIU = false;
175 for (auto& table : tables) {
176 if (table == "O2trackcov") {
177 hasTrackCov = true;
178 }
179 if (table.starts_with("O2track_iu")) {
180 hasTrackIU = true;
181 }
182 LOGP(info, "- {} present.", table);
183 }
184 // Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
185 if (runType == "2" || !hasTrackCov) {
186 LOGP(info, "Using only tracks {}", runType);
187 if (hasTrackIU) {
188 return WorkflowSpec{
189 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
190 };
191 }
192 return WorkflowSpec{
193 adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),
194 };
195 } else {
196 LOGP(info, "Using tracks extra {}", runType);
197 if (hasTrackIU) {
198 return WorkflowSpec{
199 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
200 };
201 }
202 return WorkflowSpec{
203 adaptAnalysisTask<EtaAndClsHistogramsFull>(cfgc, TaskName{"simple-histos"}),
204 };
205 }
206}
#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_,...)
Definition ASoA.h:3207
#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_)
Definition ASoA.h:2451
#define HIST(name)
std::vector< o2::its::TrackITS > tracks
ConfigParamRegistry & options() const
bool hasOption(const char *key) const
void fill(const HistName &histName, Ts... positionAndWeight)
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
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)