Skip to content

Commit ce9f4e7

Browse files
committed
Fix MegaLinter errors
1 parent 4620b42 commit ce9f4e7

15 files changed

Lines changed: 92 additions & 70 deletions

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/checkTables.C‎

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
// Checks which strangeness tables (and which versions) are present in a derived AO2D
2-
// and reports which steps of the V0 tutorial (o2-analysistutorial-lf-strangeness-derived-v0-*) can run.
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.
34
//
4-
// Usage: root -l -b -q 'checkTables.C("data/AO2D.root")' or something like root -l -b -q "checkTables.C(\"$(cat input_data.txt)\")"
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.
11+
12+
/// \file checkTables.C
13+
/// \brief Checks which strangeness tables (and which versions) are present in a derived AO2D
14+
/// and reports which steps of the V0 tutorial (o2-analysistutorial-lf-strangeness-derived-v0-*) can run.
15+
///
16+
/// Usage: root -l -b -q 'checkTables.C("data/AO2D.root")' or something like root -l -b -q "checkTables.C(\"$(cat input_data.txt)\")"
517

18+
#include <TCollection.h>
619
#include <TDirectory.h>
720
#include <TFile.h>
821
#include <TKey.h>
@@ -14,17 +27,17 @@
1427
#include <vector>
1528

1629
struct RequiredTable {
17-
std::string base; // tree name without version, e.g. "o2straevsels"
18-
int version; // version required by the current O2Physics data model
19-
int firstStep; // first step that uses it (-1 = skeleton)
20-
std::string hint; // converter to use if the version in the file is older
30+
std::string base; // tree name without version, e.g. "o2straevsels"
31+
int version{0}; // version required by the current O2Physics data model
32+
int firstStep{-1}; // first step that uses it (-1 = skeleton)
33+
std::string hint; // converter to use if the version in the file is older
2134
};
2235

2336
int findVersion(TDirectory* dir, const std::string& base)
2437
{
2538
int found = -1;
2639
TIter next(dir->GetListOfKeys());
27-
while (TKey* key = static_cast<TKey*>(next())) {
40+
while (TKey* key = dynamic_cast<TKey*>(next())) {
2841
TString name = key->GetName();
2942
name.ToLower();
3043
if (name == base.c_str()) {
@@ -42,27 +55,27 @@ int findVersion(TDirectory* dir, const std::string& base)
4255
void checkTables(const char* fname = "data/AO2D.root")
4356
{
4457
const std::vector<RequiredTable> required = {
45-
{"o2stracollision", 0, -1, ""},
46-
{"o2straevsels", 6, -1, "o2-analysis-lf-straevselsconverterN (chain up to straevselsconverter6)"},
47-
{"o2v0core", 0, 0, ""},
48-
{"o2v0extra", 0, 2, ""},
49-
{"o2dautrackextra", 3, 2, "o2-analysis-lf-stradautracksextraconverterN (up to stradautracksextraconverter3)"},
50-
{"o2dautracktpcpid", 1, 2, "o2-analysis-lf-stradautrackstpcpidconverter"},
58+
{.base = "o2stracollision", .version = 0, .firstStep = -1, .hint = ""},
59+
{.base = "o2straevsels", .version = 6, .firstStep = -1, .hint = "o2-analysis-lf-straevselsconverterN (chain up to straevselsconverter6)"},
60+
{.base = "o2v0core", .version = 0, .firstStep = 0, .hint = ""},
61+
{.base = "o2v0extra", .version = 0, .firstStep = 2, .hint = ""},
62+
{.base = "o2dautrackextra", .version = 3, .firstStep = 2, .hint = "o2-analysis-lf-stradautracksextraconverterN (up to stradautracksextraconverter3)"},
63+
{.base = "o2dautracktpcpid", .version = 1, .firstStep = 2, .hint = "o2-analysis-lf-stradautrackstpcpidconverter"},
5164
// step 3: tables read as input by the helper task strangenesstofpid,
5265
// not by the analysis itself: the tutorial only uses V0s
53-
{"o2strastamps", 1, 3, "o2-analysis-lf-strastampsconverter"},
54-
{"o2straevtimes", 1, 3, "o2-analysis-lf-stradautrackstofpidconverter3"},
55-
{"o2dautracktofpid", 3, 3, "o2-analysis-lf-stradautrackstofpidconverterN (up to stradautrackstofpidconverter4)"},
56-
{"o2v0collref", 0, 3, ""},
57-
{"o2casccore", 0, 3, ""},
58-
{"o2cascextra", 0, 3, ""},
59-
{"o2casccollref", 0, 3, ""},
66+
{.base = "o2strastamps", .version = 1, .firstStep = 3, .hint = "o2-analysis-lf-strastampsconverter"},
67+
{.base = "o2straevtimes", .version = 1, .firstStep = 3, .hint = "o2-analysis-lf-stradautrackstofpidconverter3"},
68+
{.base = "o2dautracktofpid", .version = 3, .firstStep = 3, .hint = "o2-analysis-lf-stradautrackstofpidconverterN (up to stradautrackstofpidconverter4)"},
69+
{.base = "o2v0collref", .version = 0, .firstStep = 3, .hint = ""},
70+
{.base = "o2casccore", .version = 0, .firstStep = 3, .hint = ""},
71+
{.base = "o2cascextra", .version = 0, .firstStep = 3, .hint = ""},
72+
{.base = "o2casccollref", .version = 0, .firstStep = 3, .hint = ""},
6073
// step 4: MC
61-
{"o2v0coremclabel", 0, 4, ""},
62-
{"o2v0mccore", 2, 4, "o2-analysis-lf-v0coresconverter / v0coresconverter2"},
63-
{"o2v0mccollref", 0, 4, ""},
64-
{"o2stracolllabels", 0, 4, ""},
65-
{"o2stramccollision", 2, 4, "o2-analysis-lf-stramccollisionconverter / stramccollisionconverter2"},
74+
{.base = "o2v0coremclabel", .version = 0, .firstStep = 4, .hint = ""},
75+
{.base = "o2v0mccore", .version = 2, .firstStep = 4, .hint = "o2-analysis-lf-v0coresconverter / v0coresconverter2"},
76+
{.base = "o2v0mccollref", .version = 0, .firstStep = 4, .hint = ""},
77+
{.base = "o2stracolllabels", .version = 0, .firstStep = 4, .hint = ""},
78+
{.base = "o2stramccollision", .version = 2, .firstStep = 4, .hint = "o2-analysis-lf-stramccollisionconverter / stramccollisionconverter2"},
6679
};
6780

6881
TFile* f = TFile::Open(fname);
@@ -72,7 +85,7 @@ void checkTables(const char* fname = "data/AO2D.root")
7285
}
7386
TDirectory* df = nullptr;
7487
TIter next(f->GetListOfKeys());
75-
while (TKey* key = static_cast<TKey*>(next())) {
88+
while (TKey* key = dynamic_cast<TKey*>(next())) {
7689
if (TString(key->GetName()).BeginsWith("DF_")) {
7790
df = f->GetDirectory(key->GetName());
7891
break;
@@ -85,7 +98,7 @@ void checkTables(const char* fname = "data/AO2D.root")
8598

8699
std::cout << "\nTrees in " << df->GetName() << ":\n";
87100
TIter nextTree(df->GetListOfKeys());
88-
while (TKey* key = static_cast<TKey*>(nextTree())) {
101+
while (TKey* key = dynamic_cast<TKey*>(nextTree())) {
89102
std::cout << " " << key->GetName() << "\n";
90103
}
91104

@@ -116,7 +129,7 @@ void checkTables(const char* fname = "data/AO2D.root")
116129
std::cout << "\nSummary:\n";
117130
for (int s = -1; s <= 4; s++) {
118131
TString name = s < 0 ? "skeleton" : Form("step%d", s);
119-
TString res = s >= firstBrokenStep ? "CANNOT run with this file"
132+
TString res = s >= firstBrokenStep ? "CANNOT run with this file"
120133
: s >= firstConverterStep ? "ok, but converters are needed"
121134
: "ok";
122135
std::cout << Form(" %-8s %s\n", name.Data(), res.Data());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file:///eos/user/s/spucillo/O2AT6_tutorial/MC/AO2D.root
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file:///eos/user/s/spucillo/O2AT6_tutorial/data/AO2D.root

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/skeleton.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"aod-file": "@input_data.txt"
1111
},
1212
"internal-dpl-aod-spawner": "",
13-
"strangeness_derived_tutorial": {
13+
"strangeness-derived-v0-tutorial": {
1414
"nBins": "100",
1515
"cutzvertex": "10"
1616
},

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/step0.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"aod-file": "@input_data.txt"
1111
},
1212
"internal-dpl-aod-spawner": "",
13-
"strangeness_derived_tutorial": {
13+
"strangeness-derived-v0-tutorial": {
1414
"nBins": "100",
1515
"cutzvertex": "10"
1616
},

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/step1.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"step-value-enumeration": "1",
1010
"aod-file": "@input_data.txt"
1111
},
12-
"strangeness_derived_tutorial": {
12+
"strangeness-derived-v0-tutorial": {
1313
"nBins": "100",
1414
"cutzvertex": "10",
1515
"v0setting_dcav0dau": "0.5",

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/step2.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"step-value-enumeration": "1",
1010
"aod-file": "@input_data.txt"
1111
},
12-
"strangeness_derived_tutorial": {
12+
"strangeness-derived-v0-tutorial": {
1313
"nBins": "100",
1414
"cutzvertex": "10",
1515
"v0setting_dcav0dau": "0.5",

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/step3.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
"tofPosition": "377.934",
179179
"doQANSigma": "0"
180180
},
181-
"strangeness_derived_tutorial": {
181+
"strangeness-derived-v0-tutorial": {
182182
"nBins": "100",
183183
"cutzvertex": "10",
184184
"v0setting_dcav0dau": "0.5",

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/jsonConfigs/step4.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
"tofPosition": "377.934",
179179
"doQANSigma": "0"
180180
},
181-
"strangeness_derived_tutorial": {
181+
"strangeness-derived-v0-tutorial": {
182182
"nBins": "100",
183183
"cutzvertex": "10",
184184
"v0setting_dcav0dau": "0.5",

‎Tutorials/PWGLF/Strangeness/StrangenessV0s_HandsOn/o2physics/AnalysisV0/strangeness_derived_v0_skeleton.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using namespace o2::framework::expressions;
4242
// Goal of the hands-on: improve this file step by step up to step 4
4343
// (checkpoints: strangeness_derived_v0_stepX.cxx).
4444

45-
struct strangeness_derived_tutorial {
45+
struct StrangenessDerivedV0Skeleton {
4646
// Histograms are defined with HistogramRegistry
4747
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
4848

@@ -77,5 +77,5 @@ struct strangeness_derived_tutorial {
7777
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
7878
{
7979
return WorkflowSpec{
80-
adaptAnalysisTask<strangeness_derived_tutorial>(cfgc)};
80+
adaptAnalysisTask<StrangenessDerivedV0Skeleton>(cfgc, TaskName{"strangeness-derived-v0-tutorial"})};
8181
}

0 commit comments

Comments
 (0)