Skip to content

Commit 9c8dd4d

Browse files
authored
Merge branch 'AliceO2Group:master' into Add-preselection-and-centrality-to-STTree-creatore
2 parents 8f07a7c + 34f73d2 commit 9c8dd4d

34 files changed

+2631
-1389
lines changed

.github/labeler.yml

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,89 @@
11
---
2-
alice3:
2+
infrastructure:
33
- changed-files:
4-
- any-glob-to-any-file: ['ALICE3/**']
4+
- any-glob-to-any-file:
5+
- ".checkov.yml"
6+
- ".clang-format"
7+
- ".clang-tidy"
8+
- ".flake8"
9+
- ".git-blame-ignore-revs"
10+
- ".github/**"
11+
- ".gitignore"
12+
- ".mega-linter.yml"
13+
- ".pre-commit-config.yaml"
14+
- "cmake/**"
15+
- "CMakeLists.txt"
16+
- "CODEOWNERS"
17+
- "COPYING"
18+
- "cppcheck_config"
19+
- "CPPLINT.cfg"
20+
- "dependencies/**"
21+
- "o2linter_config"
22+
- "packaging/**"
23+
- "pyproject.toml"
24+
- "README.md"
525

6-
common:
26+
datamodel:
727
- changed-files:
8-
- any-glob-to-any-file: ['Common/**']
28+
- any-glob-to-any-file: ["DataModel/**", "**/DataModel/**"]
929

10-
infrastructure:
30+
alice3:
1131
- changed-files:
12-
- any-glob-to-any-file:
13-
- '.clang-format'
14-
- '.clang-tidy'
15-
- '.flake8'
16-
- '.github/**'
17-
- '.checkov.yml'
18-
- '.mega-linter.yml'
19-
- '.pre-commit-config.yaml'
20-
- 'cmake/**'
21-
- 'CODEOWNERS'
22-
- 'CPPLINT.cfg'
23-
- 'dependencies/**'
24-
- 'packaging/**'
25-
- 'pyproject.toml'
32+
- any-glob-to-any-file: ["ALICE3/**"]
2633

27-
datamodel:
34+
common:
2835
- changed-files:
29-
- any-glob-to-any-file: ['DataModel/**', '**/DataModel/**']
36+
- any-glob-to-any-file: ["Common/**"]
3037

3138
dpg:
3239
- changed-files:
33-
- any-glob-to-any-file: ['DPG/**']
40+
- any-glob-to-any-file: ["DPG/**"]
3441

3542
pwgcf:
3643
- changed-files:
37-
- any-glob-to-any-file: ['PWGCF/**', '*/PWGCF/**']
44+
- any-glob-to-any-file: ["PWGCF/**", "*/PWGCF/**"]
3845

3946
pwgdq:
4047
- changed-files:
41-
- any-glob-to-any-file: ['PWGDQ/**', '*/PWGDQ/**']
48+
- any-glob-to-any-file: ["PWGDQ/**", "*/PWGDQ/**"]
4249

4350
pwgem:
4451
- changed-files:
45-
- any-glob-to-any-file: ['PWGEM/**', '*/PWGEM/**']
52+
- any-glob-to-any-file: ["PWGEM/**", "*/PWGEM/**"]
4653

4754
pwghf:
4855
- changed-files:
49-
- any-glob-to-any-file: ['PWGHF/**', '*/PWGHF/**']
56+
- any-glob-to-any-file: ["PWGHF/**", "*/PWGHF/**"]
5057

5158
pwgje:
5259
- changed-files:
53-
- any-glob-to-any-file: ['PWGJE/**', '*/PWGJE/**']
60+
- any-glob-to-any-file: ["PWGJE/**", "*/PWGJE/**"]
5461

5562
pwglf:
5663
- changed-files:
57-
- any-glob-to-any-file: ['PWGLF/**', '*/PWGLF/**', 'PWGMM/**', '*/PWGMM/**']
64+
- any-glob-to-any-file:
65+
["PWGLF/**", "*/PWGLF/**", "PWGMM/**", "*/PWGMM/**"]
66+
67+
pwgmm:
68+
- changed-files:
69+
- any-glob-to-any-file: ["PWGMM/**", "*/PWGMM/**"]
5870

5971
pwgud:
6072
- changed-files:
61-
- any-glob-to-any-file: ['PWGUD/**', '*/PWGUD/**']
73+
- any-glob-to-any-file: ["PWGUD/**", "*/PWGUD/**"]
74+
75+
scripts:
76+
- changed-files:
77+
- any-glob-to-any-file: ["Scripts/**"]
78+
79+
tools:
80+
- changed-files:
81+
- any-glob-to-any-file: ["Tools/**"]
6282

6383
trigger:
6484
- changed-files:
65-
- any-glob-to-any-file: ['EventFiltering/**']
85+
- any-glob-to-any-file: ["EventFiltering/**"]
6686

6787
tutorial:
6888
- changed-files:
69-
- any-glob-to-any-file: ['Tutorials/**']
89+
- any-glob-to-any-file: ["Tutorials/**"]

.github/workflows/mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
id: ml
3939
# You can override MegaLinter flavor used to have faster performances
4040
# More info at https://megalinter.io/flavors/
41-
uses: oxsecurity/megalinter@v9.1.0
41+
uses: oxsecurity/megalinter@v9.2.0
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/

ALICE3/Core/FastTracker.cxx

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,42 @@ void FastTracker::AddTPC(float phiResMean, float zResMean)
236236
}
237237
}
238238

239+
std::map<std::string, std::map<std::string, std::string>> FastTracker::parseTEnvConfiguration(std::string filename)
240+
{
241+
std::map<std::string, std::map<std::string, std::string>> configMap;
242+
243+
TEnv env(filename.c_str());
244+
THashList* table = env.GetTable();
245+
std::vector<std::string> layers;
246+
for (int i = 0; i < table->GetEntries(); ++i) {
247+
const std::string key = table->At(i)->GetName();
248+
// key should contain exactly one dot
249+
if (key.find('.') == std::string::npos || key.find('.') != key.rfind('.')) {
250+
LOG(fatal) << "Key " << key << " does not contain exactly one dot";
251+
continue;
252+
}
253+
const std::string firstPart = key.substr(0, key.find('.'));
254+
if (std::find(layers.begin(), layers.end(), firstPart) == layers.end()) {
255+
layers.push_back(firstPart);
256+
}
257+
}
258+
env.Print();
259+
260+
// Layers
261+
for (const auto& layer : layers) {
262+
LOG(info) << " Reading layer " << layer;
263+
for (int i = 0; i < table->GetEntries(); ++i) {
264+
const std::string key = table->At(i)->GetName();
265+
if (key.find(layer + ".") == 0) {
266+
const std::string paramName = key.substr(key.find('.') + 1);
267+
const std::string value = env.GetValue(key.c_str(), "");
268+
configMap[layer][paramName] = value;
269+
}
270+
}
271+
}
272+
return configMap;
273+
}
274+
239275
void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager)
240276
{
241277
LOG(info) << " Adding generic detector from file " << filename;
@@ -263,54 +299,27 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa
263299
return;
264300
}
265301

266-
TEnv env(filename.c_str());
267-
THashList* table = env.GetTable();
268-
std::vector<std::string> layers;
269-
for (int i = 0; i < table->GetEntries(); ++i) {
270-
const std::string key = table->At(i)->GetName();
271-
// key should contain exactly one dot
272-
if (key.find('.') == std::string::npos || key.find('.') != key.rfind('.')) {
273-
LOG(fatal) << "Key " << key << " does not contain exactly one dot";
274-
continue;
275-
}
276-
const std::string firstPart = key.substr(0, key.find('.'));
277-
if (std::find(layers.begin(), layers.end(), firstPart) == layers.end()) {
278-
layers.push_back(firstPart);
279-
}
280-
}
281-
// env.Print();
302+
std::map<std::string, std::map<std::string, std::string>> configMap = parseTEnvConfiguration(filename);
282303
// Layers
283-
for (const auto& layer : layers) {
284-
LOG(info) << " Reading layer " << layer;
285-
286-
auto getKey = [&layer, &env](const std::string& name, const bool required = true) {
287-
std::string key = layer + "." + name;
288-
if (!env.Defined(key.c_str())) {
289-
if (required) {
290-
LOG(fatal) << "Key " << key << " not defined in configuration file";
291-
}
292-
LOG(debug) << "Key " << key << " not defined in configuration file, getting the default value";
293-
}
294-
LOG(debug) << " Getting key " << key << " from configuration file";
295-
return key;
296-
};
297-
const float r = env.GetValue(getKey("r").c_str(), -1.0f);
298-
LOG(info) << " Layer " << layer << " has radius " << r;
299-
const float z = env.GetValue(getKey("z").c_str(), -1.0f);
300-
const float x0 = env.GetValue(getKey("x0").c_str(), 0.0f);
301-
const float xrho = env.GetValue(getKey("xrho").c_str(), 0.0f);
302-
const float resRPhi = env.GetValue(getKey("resRPhi").c_str(), 0.0f);
303-
const float resZ = env.GetValue(getKey("resZ").c_str(), 0.0f);
304-
const float eff = env.GetValue(getKey("eff").c_str(), 0.0f);
305-
const int type = env.GetValue(getKey("type").c_str(), 0);
306-
const char* deadPhiRegions = env.GetValue(getKey("deadPhiRegions", false).c_str(), "");
304+
for (const auto& layer : configMap) {
305+
LOG(info) << " Reading layer " << layer.first;
306+
const float r = std::stof(layer.second.at("r"));
307+
LOG(info) << " Layer " << layer.first << " has radius " << r;
308+
const float z = std::stof(layer.second.at("z"));
309+
const float x0 = std::stof(layer.second.at("x0"));
310+
const float xrho = std::stof(layer.second.at("xrho"));
311+
const float resRPhi = std::stof(layer.second.at("resRPhi"));
312+
const float resZ = std::stof(layer.second.at("resZ"));
313+
const float eff = std::stof(layer.second.at("eff"));
314+
const int type = std::stoi(layer.second.at("type"));
315+
const std::string deadPhiRegions = layer.second.at("deadPhiRegions");
307316

308317
// void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0);
309-
LOG(info) << " Adding layer " << layer << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type << " deadPhiRegions=" << deadPhiRegions;
318+
LOG(info) << " Adding layer " << layer.first << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type << " deadPhiRegions=" << deadPhiRegions;
310319

311-
DetLayer* addedLayer = AddLayer(layer.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type);
312-
if (strlen(deadPhiRegions) > 0) { // Taking it as ccdb path or local file
313-
// Check if it begins with ccdb:
320+
DetLayer* addedLayer = AddLayer(layer.first.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type);
321+
if (!deadPhiRegions.empty()) { // Taking it as ccdb path or local file
322+
// Check if it begins with ccdb:
314323
if (std::string(deadPhiRegions).rfind("ccdb:", 0) == 0) {
315324
std::string ccdbPath = std::string(deadPhiRegions).substr(5); // remove "ccdb:" prefix
316325
if (ccdbManager == nullptr) {
@@ -321,7 +330,7 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa
321330
addedLayer->setDeadPhiRegions(g);
322331
} else {
323332
// Taking it as local file
324-
TFile infile(deadPhiRegions, "READ");
333+
TFile infile(deadPhiRegions.c_str(), "READ");
325334
if (!infile.IsOpen()) {
326335
LOG(fatal) << "Cannot open dead phi regions file " << deadPhiRegions;
327336
return;
@@ -331,7 +340,7 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa
331340
addedLayer->setDeadPhiRegions(g);
332341
}
333342
} else {
334-
LOG(debug) << " No dead phi regions for layer " << layer;
343+
LOG(debug) << " No dead phi regions for layer " << layer.first;
335344
}
336345
}
337346
}

ALICE3/Core/FastTracker.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <fairlogger/Logger.h>
2121

22+
#include <map>
2223
#include <string>
2324
#include <vector>
2425

@@ -68,6 +69,14 @@ class FastTracker
6869
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
6970
void AddSiliconALICE3(float scaleX0VD, std::vector<float> pixelResolution);
7071
void AddTPC(float phiResMean, float zResMean);
72+
73+
/**
74+
* @brief Parses a TEnv configuration file and returns the key-value pairs split per entry
75+
* @param filename Path to the TEnv configuration file
76+
* @return A map where each key is a layer name and the value is another map of key-value pairs for that layer
77+
*/
78+
std::map<std::string, std::map<std::string, std::string>> parseTEnvConfiguration(std::string filename);
79+
7180
/**
7281
* @brief Adds a generic detector configuration from the specified file.
7382
*

ALICE3/TableProducer/alice3-decayfinder.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct alice3decayFinder {
7979

8080
// Vertexing
8181
Configurable<bool> propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"};
82-
Configurable<bool> useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"};
82+
Configurable<bool> useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"};
8383
Configurable<bool> useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"};
8484
Configurable<double> maxR{"maxR", 200., "reject PCA's above this radius"};
8585
Configurable<double> maxDZIni{"maxDZIni", 1e9, "reject (if>0) PCA candidate if tracks DZ exceeds threshold"};
@@ -324,19 +324,21 @@ struct alice3decayFinder {
324324
o2::track::TrackParCov trackParVar0 = getTrackParCov(prong0);
325325
o2::track::TrackParCov trackParVar1 = getTrackParCov(prong1);
326326
o2::track::TrackParCov trackParVar2 = getTrackParCov(prong2);
327-
328327
//}-{}-{}-{}-{}-{}-{}-{}-{}-{}
329328
// Move close to minima
330329
int nCand = 0;
331330
try {
331+
histos.fill(HIST("hCandidateBuilderStatus3Prong"), 0.f); // builds candidate
332332
nCand = fitter3.process(trackParVar0, trackParVar1, trackParVar2);
333333
} catch (...) {
334334
LOG(info) << "Second vertex fit failed";
335335
return false;
336336
}
337+
histos.fill(HIST("hCandidateBuilderStatus3Prong"), 1.f); // builds candidate
337338
if (nCand == 0) {
338339
return false;
339340
}
341+
histos.fill(HIST("hCandidateBuilderStatus3Prong"), 2.f); // builds candidate
340342
//}-{}-{}-{}-{}-{}-{}-{}-{}-{}
341343

342344
auto covMatrixPCA = fitter3.calcPCACovMatrixFlat();
@@ -345,6 +347,7 @@ struct alice3decayFinder {
345347
if (cand3prong.dcaDau > dcaDaughtersSelection) {
346348
return false;
347349
}
350+
histos.fill(HIST("hCandidateBuilderStatus3Prong"), 3.f); // builds candidate
348351

349352
cand3prong.primaryVertex = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()};
350353
auto secondaryVertex = fitter3.getPCACandidate();
@@ -571,6 +574,7 @@ struct alice3decayFinder {
571574
}
572575
}
573576
if (doprocessFindLc) {
577+
histos.add("hCandidateBuilderStatus3Prong", "hCandidateBuilderStatus3Prong", kTH1D, {{10, -0.5, 9.5}});
574578
histos.add("h2dGen3Prong", "h2dGen3Prong", kTH2F, {axisPt, axisEta});
575579
histos.add("h2dGen3ProngBar", "h2dGen3ProngBar", kTH2F, {axisPt, axisEta});
576580
histos.add("h3dRec3Prong", "h3dRec3Prong", kTH3F, {axisPt, axisEta, axisLcMass});

ALICE3/TableProducer/alice3-decaypreselector.cxx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,38 @@
1717
// HF decays. Work in progress: use at your own risk!
1818
//
1919

20-
#include <cmath>
21-
#include <array>
22-
#include <cstdlib>
23-
#include <map>
24-
#include <iterator>
25-
#include <vector>
26-
#include <utility>
20+
#include "PWGLF/DataModel/LFParticleIdentification.h"
21+
#include "PWGLF/DataModel/LFStrangenessTables.h"
2722

28-
#include "Framework/runDataProcessing.h"
29-
#include "Framework/RunningWorkflowInfo.h"
30-
#include "Framework/AnalysisTask.h"
31-
#include "Framework/AnalysisDataModel.h"
32-
#include "Framework/ASoAHelpers.h"
33-
#include "DCAFitter/DCAFitterN.h"
34-
#include "ReconstructionDataFormats/Track.h"
23+
#include "ALICE3/DataModel/A3DecayFinderTables.h"
24+
#include "ALICE3/DataModel/OTFRICH.h"
25+
#include "ALICE3/DataModel/OTFTOF.h"
3526
#include "Common/Core/RecoDecay.h"
36-
#include "Common/Core/trackUtilities.h"
37-
#include "PWGLF/DataModel/LFStrangenessTables.h"
38-
#include "PWGLF/DataModel/LFParticleIdentification.h"
3927
#include "Common/Core/TrackSelection.h"
28+
#include "Common/Core/trackUtilities.h"
4029
#include "Common/DataModel/TrackSelectionTables.h"
41-
#include "DetectorsBase/Propagator.h"
42-
#include "DetectorsBase/GeometryManager.h"
43-
#include "DataFormatsParameters/GRPObject.h"
44-
#include "DataFormatsParameters/GRPMagField.h"
45-
#include "CCDB/BasicCCDBManager.h"
46-
#include "DataFormatsCalibration/MeanVertexObject.h"
47-
#include "ALICE3/DataModel/OTFTOF.h"
48-
#include "ALICE3/DataModel/OTFRICH.h"
49-
#include "ALICE3/DataModel/A3DecayFinderTables.h"
30+
31+
#include <CCDB/BasicCCDBManager.h>
32+
#include <DCAFitter/DCAFitterN.h>
33+
#include <DataFormatsCalibration/MeanVertexObject.h>
34+
#include <DataFormatsParameters/GRPMagField.h>
35+
#include <DataFormatsParameters/GRPObject.h>
36+
#include <DetectorsBase/GeometryManager.h>
37+
#include <DetectorsBase/Propagator.h>
38+
#include <Framework/ASoAHelpers.h>
39+
#include <Framework/AnalysisDataModel.h>
40+
#include <Framework/AnalysisTask.h>
41+
#include <Framework/RunningWorkflowInfo.h>
42+
#include <Framework/runDataProcessing.h>
43+
#include <ReconstructionDataFormats/Track.h>
44+
45+
#include <array>
46+
#include <cmath>
47+
#include <cstdlib>
48+
#include <iterator>
49+
#include <map>
50+
#include <utility>
51+
#include <vector>
5052

5153
using namespace o2;
5254
using namespace o2::framework;

0 commit comments

Comments
 (0)