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 {
48 if (!trackFilterString->empty()) {
50 }
51 }
52
53 void process(soa::Filtered<aod::Tracks> const& tracks, aod::FT0s const&, aod::StoredTracksFrom<o2::aod::Hash<"EMB"_h>> const& ortherTracks)
54 {
55 LOGP(info, "Invoking the simple one");
56 for (auto& track : tracks) {
57 etaClsH->Fill(track.eta(), track.pt());
58 skimEx(track.pt(), track.eta());
59 }
60 }
61};
62
64 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
66 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
67 Filter trackFilter = o2::aod::track::pt < 10.f;
68
70 {
71 if (!trackFilterString->empty()) {
73 }
74 }
75
76 void process(soa::Filtered<aod::TracksIU> const& tracks, aod::FT0s const&, aod::TracksIUFrom<o2::aod::Hash<"EMB"_h>> const& otherTracks)
77 {
78 LOGP(info, "Invoking the simple one IU");
79 for (auto& track : tracks) {
80 etaClsH->Fill(track.eta(), track.pt());
81 skimEx(track.pt(), track.eta());
82 }
83 }
84};
85
87 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)};
88 Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
89 Filter trackFilter = o2::aod::track::pt < 10.f;
90
92 {
93 if (!trackFilterString->empty()) {
95 }
96 }
97
99 {
100 LOGP(info, "Invoking the run 3 one");
101 for (auto& track : tracks) {
102 etaClsH->Fill(track.eta(), track.tpcNClsFindable(), track.sigma1Pt());
103 }
104 }
105};
106
108{
109 std::string runType = "3";
110 std::vector<std::string> tables;
111 if (cfgc.options().hasOption("aod-metadata-Run")) {
112 runType = cfgc.options().get<std::string>("aod-metadata-Run");
113 }
114 if (cfgc.options().hasOption("aod-metadata-tables")) {
115 tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
116 }
117 LOGP(info, "Runtype is {}", runType);
118 bool hasTrackCov = false;
119 bool hasTrackIU = false;
120 for (auto& table : tables) {
121 if (table == "O2trackcov") {
122 hasTrackCov = true;
123 }
124 if (table.starts_with("O2track_iu")) {
125 hasTrackIU = true;
126 }
127 LOGP(info, "- {} present.", table);
128 }
129 // Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
130 if (runType == "2" || !hasTrackCov) {
131 LOGP(info, "Using only tracks {}", runType);
132 if (hasTrackIU) {
133 return WorkflowSpec{
134 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
135 };
136 }
137 return WorkflowSpec{
138 adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),
139 };
140 } else {
141 LOGP(info, "Using tracks extra {}", runType);
142 if (hasTrackIU) {
143 return WorkflowSpec{
144 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
145 };
146 }
147 return WorkflowSpec{
148 adaptAnalysisTask<EtaAndClsHistogramsFull>(cfgc, TaskName{"simple-histos"}),
149 };
150 }
151}
#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
ConfigParamRegistry & options() const
bool hasOption(const char *key) const
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 init(InitContext &)
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)