Skip to content

Commit 0ea46f9

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 1111a89 + d8b84ce commit 0ea46f9

File tree

270 files changed

+19430
-8475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+19430
-8475
lines changed

.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@v8.5.0
41+
uses: oxsecurity/megalinter@v8.7.0
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/

.mega-linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ PYTHON_PYRIGHT_CONFIG_FILE: pyproject.toml
3939
PYTHON_RUFF_CONFIG_FILE: pyproject.toml
4040
CPP_CPPLINT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
4141
CPP_CLANG_FORMAT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"]
42+
CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --check-level=exhaustive
4243
REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true

ALICE3/Core/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@
1212
o2physics_add_library(ALICE3Core
1313
SOURCES TOFResoALICE3.cxx
1414
DelphesO2TrackSmearer.cxx
15-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)
15+
PUBLIC_LINK_LIBRARIES O2::Framework
16+
O2Physics::AnalysisCore)
1617

1718
o2physics_target_root_dictionary(ALICE3Core
1819
HEADERS TOFResoALICE3.h
20+
TrackUtilities.h
1921
DelphesO2TrackSmearer.h
2022
LINKDEF ALICE3CoreLinkDef.h)
2123

2224
o2physics_add_library(FastTracker
2325
SOURCES FastTracker.cxx
24-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)
26+
DetLayer.cxx
27+
PUBLIC_LINK_LIBRARIES O2::Framework
28+
O2Physics::AnalysisCore)
2529

2630
o2physics_target_root_dictionary(FastTracker
2731
HEADERS FastTracker.h
32+
DetLayer.h
2833
LINKDEF FastTrackerLinkDef.h)

ALICE3/Core/DetLayer.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.
11+
12+
///
13+
/// \file DetLayer.cxx
14+
/// \author David Dobrigkeit Chinellato
15+
/// \since 11/03/2021
16+
/// \brief Basic struct to hold information regarding a detector layer to be used in fast simulation
17+
///
18+
19+
#include "DetLayer.h"

ALICE3/Core/FastTracker.cxx

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho,
6060
layers.push_back(newLayer);
6161
}
6262

63-
DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers)
63+
DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers) const
6464
{
6565
int layerIdx = layer;
6666
if (ignoreBarrelLayers) {
@@ -74,6 +74,18 @@ DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers)
7474
return layers[layerIdx];
7575
}
7676

77+
int FastTracker::GetLayerIndex(std::string name) const
78+
{
79+
int i = 0;
80+
for (const auto& layer : layers) {
81+
if (layer.name == name) {
82+
return i;
83+
}
84+
i++;
85+
}
86+
return -1;
87+
}
88+
7789
void FastTracker::Print()
7890
{
7991
// print out layer setup
@@ -100,18 +112,18 @@ void FastTracker::AddSiliconALICE3v4(std::vector<float> pixelResolution)
100112
float resRPhiOT = pixelResolution[2];
101113
float resZOT = pixelResolution[3];
102114

103-
layers.push_back(DetLayer{"bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0}); // 150 mum Be
104-
layers.push_back(DetLayer{"ddd0", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
105-
layers.push_back(DetLayer{"ddd1", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
106-
layers.push_back(DetLayer{"ddd2", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
107-
layers.push_back(DetLayer{"bpipe1", 5.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0}); // 500 mum Be
108-
layers.push_back(DetLayer{"ddd3", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
109-
layers.push_back(DetLayer{"ddd4", 10., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
110-
layers.push_back(DetLayer{"ddd5", 13., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
111-
layers.push_back(DetLayer{"ddd6", 16., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
112-
layers.push_back(DetLayer{"ddd7", 25., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
113-
layers.push_back(DetLayer{"ddd8", 40., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
114-
layers.push_back(DetLayer{"ddd9", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
115+
AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be
116+
AddLayer("ddd0", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
117+
AddLayer("ddd1", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
118+
AddLayer("ddd2", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
119+
AddLayer("bpipe1", 5.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be
120+
AddLayer("ddd3", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
121+
AddLayer("ddd4", 10., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
122+
AddLayer("ddd5", 13., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
123+
AddLayer("ddd6", 16., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
124+
AddLayer("ddd7", 25., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
125+
AddLayer("ddd8", 40., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
126+
AddLayer("ddd9", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
115127
}
116128

117129
void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution)
@@ -128,19 +140,19 @@ void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution)
128140
float resRPhiOT = pixelResolution[2];
129141
float resZOT = pixelResolution[3];
130142

131-
layers.push_back(DetLayer{"bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0}); // 150 mum Be
132-
layers.push_back(DetLayer{"B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
133-
layers.push_back(DetLayer{"B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
134-
layers.push_back(DetLayer{"B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
135-
layers.push_back(DetLayer{"bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0}); // 500 mum Be
136-
layers.push_back(DetLayer{"B03", 3.75, 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
137-
layers.push_back(DetLayer{"B04", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
138-
layers.push_back(DetLayer{"B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
139-
layers.push_back(DetLayer{"B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
140-
layers.push_back(DetLayer{"B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
141-
layers.push_back(DetLayer{"B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
142-
layers.push_back(DetLayer{"B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
143-
layers.push_back(DetLayer{"B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
143+
AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be
144+
AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
145+
AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
146+
AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
147+
AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be
148+
AddLayer("B03", 3.75, 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
149+
AddLayer("B04", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
150+
AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
151+
AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
152+
AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
153+
AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
154+
AddLayer("B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
155+
AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
144156
}
145157

146158
void FastTracker::AddTPC(float phiResMean, float zResMean)
@@ -333,7 +345,6 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
333345
// was there a problem on this layer?
334346
if (!ok && il > 0) { // may fail to reach target layer due to the eloss
335347
float rad2 = inputTrack.getX() * inputTrack.getX() + inputTrack.getY() * inputTrack.getY();
336-
float fMinRadTrack = 132.;
337348
float maxR = layers[il - 1].r + kTrackingMargin * 2;
338349
float minRad = (fMinRadTrack > 0 && fMinRadTrack < maxR) ? fMinRadTrack : maxR;
339350
if (rad2 - minRad * minRad < kTrackingMargin * kTrackingMargin) { // check previously reached layer

ALICE3/Core/FastTracker.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class FastTracker
3535
virtual ~FastTracker() {}
3636

3737
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);
38-
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true);
38+
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const;
39+
int GetLayerIndex(const std::string name) const;
3940

4041
void AddSiliconALICE3v4(std::vector<float> pixelResolution);
4142
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
@@ -55,6 +56,15 @@ class FastTracker
5556
// Definition of detector layers
5657
std::vector<DetLayer> layers;
5758
std::vector<std::vector<float>> hits; // bookkeep last added hits
59+
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].x0 = x0; }
60+
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].r = r; }
61+
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].resRPhi = resRPhi; }
62+
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].resZ = resZ; }
63+
void SetResolution(const std::string layerName, float resRPhi, float resZ)
64+
{
65+
SetResolutionRPhi(layerName, resRPhi);
66+
SetResolutionZ(layerName, resZ);
67+
}
5868

5969
// operational
6070
bool applyZacceptance; // check z acceptance or not
@@ -75,6 +85,17 @@ class FastTracker
7585
float avgRapidity;
7686
float lhcUPCScale;
7787
float upcBackgroundMultiplier;
88+
float fMinRadTrack = 132.;
89+
90+
// Setters and getters
91+
void SetIntegrationTime(float t) { integrationTime = t; }
92+
void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; }
93+
void SetAvgRapidity(float y) { avgRapidity = y; }
94+
void SetdNdEtaCent(float d) { dNdEtaCent = d; }
95+
void SetLhcUPCscale(float s) { lhcUPCScale = s; }
96+
void SetBField(float b) { magneticField = b; }
97+
void SetMinRadTrack(float r) { fMinRadTrack = r; }
98+
// void SetAtLeastHits(int n) { fMinRadTrack = n; }
7899

79100
uint64_t covMatOK; // cov mat has negative eigenvals
80101
uint64_t covMatNotOK; // cov mat has negative eigenvals
@@ -84,6 +105,7 @@ class FastTracker
84105
int nSiliconPoints; // silicon-based space points added to track
85106
int nGasPoints; // tpc-based space points added to track
86107
std::vector<float> goodHitProbability;
108+
float GetGoodHitProb(int layer) const { return goodHitProbability[layer]; }
87109

88110
ClassDef(FastTracker, 1);
89111
};

ALICE3/Core/TrackUtilities.h

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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.
11+
///
12+
/// \file TrackUtilities.h
13+
///
14+
/// \brief Set of utilities for the ALICE3 track handling
15+
///
16+
/// \since May 21, 2025
17+
///
18+
19+
#ifndef ALICE3_CORE_TRACKUTILITIES_H_
20+
#define ALICE3_CORE_TRACKUTILITIES_H_
21+
22+
#include <vector>
23+
24+
#include "ReconstructionDataFormats/Track.h"
25+
#include "Framework/O2DatabasePDGPlugin.h"
26+
#include "Framework/AnalysisHelpers.h"
27+
#include "TLorentzVector.h"
28+
29+
namespace o2::upgrade
30+
{
31+
32+
/// Function to convert a TLorentzVector into a perfect Track
33+
/// \param charge particle charge (integer)
34+
/// \param particle the particle to convert (TLorentzVector)
35+
/// \param productionVertex where the particle was produced
36+
/// \param o2track the address of the resulting TrackParCov
37+
void convertTLorentzVectorToO2Track(const int charge,
38+
const TLorentzVector particle,
39+
const std::vector<double> productionVertex,
40+
o2::track::TrackParCov& o2track)
41+
{
42+
std::array<float, 5> params;
43+
std::array<float, 15> covm = {0.};
44+
float s, c, x;
45+
o2::math_utils::sincos(static_cast<float>(particle.Phi()), s, c);
46+
o2::math_utils::rotateZInv(static_cast<float>(productionVertex[0]), static_cast<float>(productionVertex[1]), x, params[0], s, c);
47+
params[1] = static_cast<float>(productionVertex[2]);
48+
params[2] = 0.; // since alpha = phi
49+
const auto theta = 2. * std::atan(std::exp(-particle.PseudoRapidity()));
50+
params[3] = 1. / std::tan(theta);
51+
params[4] = charge / particle.Pt();
52+
53+
// Initialize TrackParCov in-place
54+
new (&o2track)(o2::track::TrackParCov)(x, particle.Phi(), params, covm);
55+
}
56+
57+
/// Function to convert a TLorentzVector into a perfect Track
58+
/// \param pdgCode particle pdg
59+
/// \param particle the particle to convert (TLorentzVector)
60+
/// \param productionVertex where the particle was produced
61+
/// \param o2track the address of the resulting TrackParCov
62+
/// \param pdg the pdg service
63+
void convertTLorentzVectorToO2Track(int pdgCode,
64+
TLorentzVector particle,
65+
std::vector<double> productionVertex,
66+
o2::track::TrackParCov& o2track,
67+
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
68+
{
69+
const auto pdgInfo = pdg->GetParticle(pdgCode);
70+
int charge = 0;
71+
if (pdgInfo != nullptr) {
72+
charge = pdgInfo->Charge() / 3;
73+
}
74+
convertTLorentzVectorToO2Track(charge, particle, productionVertex, o2track);
75+
}
76+
77+
/// Function to convert a McParticle into a perfect Track
78+
/// \param particle the particle to convert (mcParticle)
79+
/// \param o2track the address of the resulting TrackParCov
80+
/// \param pdg the pdg service
81+
template <typename McParticleType>
82+
void convertMCParticleToO2Track(McParticleType& particle,
83+
o2::track::TrackParCov& o2track,
84+
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
85+
{
86+
static TLorentzVector tlv;
87+
tlv.SetPxPyPzE(particle.px(), particle.py(), particle.pz(), particle.e());
88+
tlv.SetXYZT(particle.vx(), particle.vy(), particle.vz(), particle.vt());
89+
convertTLorentzVectorToO2Track(particle.pdgCode(), tlv, {particle.vx(), particle.vy(), particle.vz()}, o2track, pdg);
90+
}
91+
92+
/// Function to convert a McParticle into a perfect Track
93+
/// \param particle the particle to convert (mcParticle)
94+
/// \param o2track the address of the resulting TrackParCov
95+
/// \param pdg the pdg service
96+
template <typename McParticleType>
97+
o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle,
98+
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
99+
{
100+
o2::track::TrackParCov o2track;
101+
convertMCParticleToO2Track(particle, o2track, pdg);
102+
return o2track;
103+
}
104+
105+
} // namespace o2::upgrade
106+
107+
#endif // ALICE3_CORE_TRACKUTILITIES_H_

0 commit comments

Comments
 (0)