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 {
58 if (!trackFilterString->empty()) {
60 }
61 }
62
63 void process(soa::Filtered<aod::Tracks> const& tracks, aod::FT0s const&, aod::StoredTracksFrom<o2::aod::Hash<"EMB"_h>> const& ortherTracks)
64 {
65 LOGP(info, "Invoking the simple one");
66 for (auto& track : tracks) {
67 etaClsH->Fill(track.eta(), track.pt());
68 skimEx(track.pt(), track.eta());
69
70 registry.fill(HIST("a/b/eta"), track.eta());
71 registry.fill(HIST("a/phi"), track.phi());
72 registry.fill(HIST("c/pt"), track.pt());
73 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
74 }
75 }
76};
77
79 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
81 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
82 Filter trackFilter = o2::aod::track::pt < 10.f;
83
85 "registry",
86 {
87 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
88 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
89 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
90 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
91 } //
92 };
93
95 {
96 if (!trackFilterString->empty()) {
98 }
99 }
100
101 void process(soa::Filtered<aod::TracksIU> const& tracks, aod::FT0s const&, aod::TracksIUFrom<o2::aod::Hash<"EMB"_h>> const& otherTracks)
102 {
103 LOGP(info, "Invoking the simple one IU");
104 for (auto& track : tracks) {
105 etaClsH->Fill(track.eta(), track.pt());
106 skimEx(track.pt(), track.eta());
107
108 registry.fill(HIST("a/b/eta"), track.eta());
109 registry.fill(HIST("a/phi"), track.phi());
110 registry.fill(HIST("c/pt"), track.pt());
111 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
112 }
113 }
114};
115
117 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)};
118
120 "registry",
121 {
122 {"a/b/eta", "#Eta", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, //
123 {"a/phi", "#Phi", {HistType::kTH1D, {{102, 0, 2 * M_PI}}}}, //
124 {"c/pt", "p_{T}", {HistType::kTH1D, {{1002, -0.01, 50.1}}}}, //
125 {"ptToPt", "#ptToPt", {HistType::kTH2F, {{100, -0.01, 10.01}, {100, -0.01, 10.01}}}} //
126 } //
127 };
128
129 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
130 Filter trackFilter = o2::aod::track::pt < 10.f;
131
133 {
134 if (!trackFilterString->empty()) {
136 }
137 }
138
140 {
141 LOGP(info, "Invoking the run 3 one");
142 for (auto& track : tracks) {
143 etaClsH->Fill(track.eta(), track.tpcNClsFindable(), track.sigma1Pt());
144
145 registry.fill(HIST("a/b/eta"), track.eta());
146 registry.fill(HIST("a/phi"), track.phi());
147 registry.fill(HIST("c/pt"), track.pt());
148 registry.fill(HIST("ptToPt"), track.pt(), track.signed1Pt());
149 }
150 }
151};
152
154{
155 std::string runType = "3";
156 std::vector<std::string> tables;
157 if (cfgc.options().hasOption("aod-metadata-Run")) {
158 runType = cfgc.options().get<std::string>("aod-metadata-Run");
159 }
160 if (cfgc.options().hasOption("aod-metadata-tables")) {
161 tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
162 }
163 LOGP(info, "Runtype is {}", runType);
164 bool hasTrackCov = false;
165 bool hasTrackIU = false;
166 for (auto& table : tables) {
167 if (table == "O2trackcov") {
168 hasTrackCov = true;
169 }
170 if (table.starts_with("O2track_iu")) {
171 hasTrackIU = true;
172 }
173 LOGP(info, "- {} present.", table);
174 }
175 // Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
176 if (runType == "2" || !hasTrackCov) {
177 LOGP(info, "Using only tracks {}", runType);
178 if (hasTrackIU) {
179 return WorkflowSpec{
180 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
181 };
182 }
183 return WorkflowSpec{
184 adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),
185 };
186 } else {
187 LOGP(info, "Using tracks extra {}", runType);
188 if (hasTrackIU) {
189 return WorkflowSpec{
190 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
191 };
192 }
193 return WorkflowSpec{
194 adaptAnalysisTask<EtaAndClsHistogramsFull>(cfgc, TaskName{"simple-histos"}),
195 };
196 }
197}
#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)