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{
28namespace skimmedExampleTrack
29{
30DECLARE_SOA_COLUMN(Pt, pt, float);
31DECLARE_SOA_COLUMN(Eta, eta, float);
32} // namespace skimmedExampleTrack
33
34DECLARE_SOA_TABLE(SkimmedExampleTrack, "AOD", "SKIMEXTRK",
35 skimmedExampleTrack::Pt,
36 skimmedExampleTrack::Eta);
37} // namespace o2::aod
38
40 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
42
43 void process(aod::Tracks const& tracks)
44 {
45 LOGP(info, "Invoking the simple one");
46 for (auto& track : tracks) {
47 etaClsH->Fill(track.eta(), track.pt());
48 skimEx(track.pt(), track.eta());
49 }
50 }
51};
52
54 OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
56
57 void process(aod::TracksIU const& tracks)
58 {
59 LOGP(info, "Invoking the simple one");
60 for (auto& track : tracks) {
61 etaClsH->Fill(track.eta(), track.pt());
62 skimEx(track.pt(), track.eta());
63 }
64 }
65};
66
68 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)};
69
71 {
72 LOGP(info, "Invoking the run 3 one");
73 for (auto& track : tracks) {
74 etaClsH->Fill(track.eta(), track.tpcNClsFindable(), track.sigma1Pt());
75 }
76 }
77};
78
80{
81 std::string runType = "3";
82 std::vector<std::string> tables;
83 if (cfgc.options().hasOption("aod-metadata-Run")) {
84 runType = cfgc.options().get<std::string>("aod-metadata-Run");
85 }
86 if (cfgc.options().hasOption("aod-metadata-tables")) {
87 tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
88 }
89 LOGP(info, "Runtype is {}", runType);
90 bool hasTrackCov = false;
91 bool hasTrackIU = false;
92 for (auto& table : tables) {
93 if (table == "O2trackcov") {
94 hasTrackCov = true;
95 }
96 if (table.starts_with("O2track_iu")) {
97 hasTrackIU = true;
98 }
99 LOGP(info, "- {} present.", table);
100 }
101 // Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
102 if (runType == "2" || !hasTrackCov) {
103 LOGP(info, "Using only tracks {}", runType);
104 if (hasTrackIU) {
105 return WorkflowSpec{
106 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
107 };
108 }
109 return WorkflowSpec{
110 adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),
111 };
112 } else {
113 LOGP(info, "Using tracks extra {}", runType);
114 if (hasTrackIU) {
115 return WorkflowSpec{
116 adaptAnalysisTask<EtaAndClsHistogramsIUSimple>(cfgc, TaskName{"simple-histos"}),
117 };
118 }
119 return WorkflowSpec{
120 adaptAnalysisTask<EtaAndClsHistogramsFull>(cfgc, TaskName{"simple-histos"}),
121 };
122 }
123}
#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_,...)
Definition ASoA.h:3052
#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_)
Definition ASoA.h:2314
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 process(soa::Join< aod::FullTracks, aod::TracksCov > const &tracks)
void process(aod::TracksIU const &tracks)
Produces< o2::aod::SkimmedExampleTrack > skimEx
void process(aod::Tracks const &tracks)
Produces< o2::aod::SkimmedExampleTrack > skimEx
Struct to differentiate task names from possible task string arguments.