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