Skip to content

Commit 0b80174

Browse files
Merge branch 'master' into pp_correl
2 parents 0032efe + 6152593 commit 0b80174

376 files changed

Lines changed: 46672 additions & 18442 deletions

File tree

Some content is hidden

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

‎.pre-commit-config.yaml‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v6.0.0
5+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
66
hooks:
7-
- id: trailing-whitespace
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: check-merge-conflict
12+
- id: check-symlinks
13+
- id: check-yaml
814
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
- repo: https://github.com/shellcheck-py/shellcheck-py
17+
rev: a6564f5d57444e123433a5c9af733e3975c77229 # frozen: v0.11.0.1-1
18+
hooks:
19+
- id: shellcheck
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: f12be1ebaa5351c1fc76472de98db2c3446c8253 # frozen: v0.16.10
22+
hooks:
23+
- id: ruff-check # linter
24+
args: ["--fix"]
25+
- id: ruff-format # formatter
26+
- repo: local
27+
hooks:
28+
- id: format-includes
29+
name: format includes
30+
language: python
31+
entry: Scripts/format_includes.py
32+
types: [c++]
933
- repo: https://github.com/pre-commit/mirrors-clang-format
10-
rev: v20.1.3 # clang-format version (keep synced with https://github.com/alisw/ali-bot/blob/master/.github/workflows/c++-code-formatting.yml)
34+
# clang-format version (keep synced with https://github.com/alisw/ali-bot/blob/master/.github/workflows/c++-code-formatting.yml)
35+
rev: 7ec07eeb4135dc6ecf410d24ac4ead986a5d413d # frozen: v20.1.3
1136
hooks:
1237
- id: clang-format
1338
- repo: https://github.com/cpplint/cpplint
14-
rev: 2.0.2
39+
rev: 350702a4d39395571bd118c9a3cff0a573488d61 # frozen: 2.0.2
1540
hooks:
1641
- id: cpplint
42+
- repo: local
43+
hooks:
44+
- id: O2 linter
45+
name: O2 linter
46+
language: python
47+
entry: Scripts/o2_linter.py
48+
types_or: [c++, cmake, python]

‎ALICE3/Core/DetLayer.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ struct DetLayer {
108108
TString mName;
109109

110110
// position variables
111-
float mR; // radius in centimeters
112-
float mZ; // mZ dimension in centimeters
111+
float mR{}; // radius in centimeters
112+
float mZ{}; // mZ dimension in centimeters
113113

114114
// material variables
115-
float mX0; // radiation length
116-
float mXrho; // density
115+
float mX0{}; // radiation length
116+
float mXrho{}; // density
117117

118118
// resolution variables for active layers
119-
float mResRPhi; // RPhi resolution in centimeters
120-
float mResZ; // Z resolution in centimeters
119+
float mResRPhi{}; // RPhi resolution in centimeters
120+
float mResZ{}; // Z resolution in centimeters
121121

122122
// efficiency
123-
float mEff; // detection efficiency
123+
float mEff{1.f}; // detection efficiency
124124

125125
// dead regions in phi (in radians)
126126
TGraph* mDeadPhiRegions = nullptr;
127127

128128
// layer type
129-
int mType; // 0: undefined/inert, 1: silicon, 2: gas/tpc
129+
int mType{0}; // 0: undefined/inert, 1: silicon, 2: gas/tpc
130130
};
131131

132132
} // namespace o2::fastsim

‎ALICE3/Core/FastTracker.cxx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
312312
nIntercepts = 0;
313313
nSiliconPoints = 0;
314314
nGasPoints = 0;
315+
trackIU = -1.f;
316+
trackOU = -1.f;
315317
std::array<float, 3> posIni{}; // provision for != PV
316318
inputTrack.getXYZGlo(posIni);
317319
const float initialRadius = std::hypot(posIni[0], posIni[1]);
@@ -416,6 +418,9 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
416418
firstLayerReached = il;
417419
}
418420
lastLayerReached = il;
421+
if (layers[il].isTOF()) {
422+
continue; // TOF layers are not used for tracking, but are kept in range for the innermost/outermost update
423+
}
419424
nIntercepts++;
420425
}
421426

@@ -475,7 +480,7 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
475480
continue;
476481
}
477482

478-
if (!layers[il].isInert()) { // only update covm for tracker hits
483+
if (!layers[il].isInert() && !layers[il].isTOF()) { // only update covm for tracker hits
479484
const o2::track::TrackParametrization<float>::dim2_t hitpoint = {xyz1[1], xyz1[2]};
480485
const o2::track::TrackParametrization<float>::dim3_t hitpointcov = {layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi(), 0.f, layers[il].getResolutionZ() * layers[il].getResolutionZ()};
481486

@@ -510,7 +515,14 @@ int FastTracker::fastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
510515
}
511516

512517
hits.push_back(thisHit);
513-
if (!layers[il].isInert()) { // good hit probability calculation
518+
if (!layers[il].isInert()) {
519+
trackIU = std::hypot(spacePoint[0], spacePoint[1]);
520+
if (trackOU < 0.f) {
521+
trackOU = trackIU;
522+
}
523+
}
524+
525+
if (!layers[il].isInert() && !layers[il].isTOF()) { // good hit probability calculation
514526
float sigYCmb = o2::math_utils::sqrt(inwardTrack.getSigmaY2() + layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi());
515527
float sigZCmb = o2::math_utils::sqrt(inwardTrack.getSigmaZ2() + layers[il].getResolutionZ() * layers[il].getResolutionZ());
516528
goodHitProbability[il] = probGoodChiSqHit(layers[il].getRadius() * 100, sigYCmb * 100, sigZCmb * 100);

‎ALICE3/Core/FastTracker.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class FastTracker
5858
/// \param phiEnd End angle of the dead region (in radians)
5959
void addDeadPhiRegionInLayer(const std::string& layerName, float phiStart, float phiEnd);
6060
[[nodiscard]] DetLayer getLayer(const int layer) const { return layers[layer]; }
61-
[[nodiscard]] std::vector<DetLayer> getLayers() const { return layers; }
61+
[[nodiscard]] const std::vector<DetLayer>& getLayers() const { return layers; }
6262
[[nodiscard]] int getLayerIndex(const std::string& name) const;
6363
[[nodiscard]] size_t getNLayers() const { return layers.size(); }
6464
[[nodiscard]] bool isLayerInert(const int layer) const { return layers[layer].isInert(); }
@@ -127,6 +127,8 @@ class FastTracker
127127
[[nodiscard]] int getNIntercepts() const { return nIntercepts; }
128128
[[nodiscard]] int getNSiliconPoints() const { return nSiliconPoints; }
129129
[[nodiscard]] int getNGasPoints() const { return nGasPoints; }
130+
[[nodiscard]] float getTrackIU() const { return trackIU; }
131+
[[nodiscard]] float getTrackOU() const { return trackOU; }
130132
[[nodiscard]] float getGoodHitProb(int layer) const
131133
{
132134
return (layer >= 0 && static_cast<size_t>(layer) < goodHitProbability.size()) ? goodHitProbability[layer] : 0.0f;
@@ -172,6 +174,8 @@ class FastTracker
172174
int nIntercepts = 0; /// found in first outward propagation
173175
int nSiliconPoints = 0; /// silicon-based space points added to track
174176
int nGasPoints = 0; /// tpc-based space points added to track
177+
float trackIU = -1.f; /// innermost update: radius of the innermost active-layer hit added to track
178+
float trackOU = -1.f; /// outermost update: radius of the outermost active-layer hit added to track
175179
std::vector<float> goodHitProbability;
176180

177181
ClassDef(FastTracker, 1);

‎ALICE3/Core/FlatLutEntry.cxx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,23 @@ size_t FlatLutData::getEntryOffset(int nch_bin, int rad_bin, int eta_bin, int pt
140140
const lutEntry_t* FlatLutData::getEntryRef(int nch_bin, int rad_bin, int eta_bin, int pt_bin) const
141141
{
142142
size_t offset = getEntryOffset(nch_bin, rad_bin, eta_bin, pt_bin);
143-
return reinterpret_cast<const lutEntry_t*>(mDataRef.data() + offset);
143+
return reinterpret_cast<const lutEntry_t*>(mDataRef.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
144144
}
145145

146146
lutEntry_t* FlatLutData::getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_bin)
147147
{
148148
size_t offset = getEntryOffset(nch_bin, rad_bin, eta_bin, pt_bin);
149-
return reinterpret_cast<lutEntry_t*>(mData.data() + offset);
149+
return reinterpret_cast<lutEntry_t*>(mData.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
150150
}
151151

152152
const lutHeader_t& FlatLutData::getHeaderRef() const
153153
{
154-
return *static_cast<const lutHeader_t*>(static_cast<const void*>(mDataRef.data()));
154+
return *reinterpret_cast<const lutHeader_t*>(mDataRef.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
155155
}
156156

157157
lutHeader_t& FlatLutData::getHeader()
158158
{
159-
return *static_cast<lutHeader_t*>(static_cast<void*>(mData.data()));
159+
return *reinterpret_cast<lutHeader_t*>(mData.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
160160
}
161161

162162
void FlatLutData::updateRef()
@@ -216,7 +216,7 @@ lutHeader_t FlatLutData::previewHeader(const uint8_t* buffer, size_t size)
216216
if (size < sizeof(lutHeader_t)) {
217217
throw framework::runtime_error_f("Buffer too small for LUT header: expected at least %zu, got %zu", sizeof(lutHeader_t), size);
218218
}
219-
const auto* header = static_cast<const lutHeader_t*>(static_cast<const void*>(buffer));
219+
const auto* header = reinterpret_cast<const lutHeader_t*>(buffer); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
220220
if (!header->checkVersion()) {
221221
throw framework::runtime_error_f("LUT header version mismatch: expected %d, got %d", LUTCOVM_VERSION, header->version);
222222
}
@@ -246,7 +246,7 @@ FlatLutData FlatLutData::ViewFromBuffer(const uint8_t* buffer, size_t size)
246246

247247
FlatLutData FlatLutData::ViewFromBuffer(std::span<std::byte> const& span)
248248
{
249-
return ViewFromBuffer(reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes());
249+
return ViewFromBuffer(reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
250250
}
251251

252252
bool FlatLutData::isLoaded() const
@@ -257,7 +257,7 @@ bool FlatLutData::isLoaded() const
257257
lutHeader_t FlatLutData::previewHeader(std::ifstream& file, const char* filename)
258258
{
259259
lutHeader_t tempHeader;
260-
file.read(reinterpret_cast<char*>(&tempHeader), sizeof(lutHeader_t));
260+
file.read(reinterpret_cast<char*>(&tempHeader), sizeof(lutHeader_t)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
261261
if (file.gcount() != static_cast<std::streamsize>(sizeof(lutHeader_t))) {
262262
throw framework::runtime_error_f("Failed to read LUT header from %s", filename);
263263
}
@@ -282,7 +282,7 @@ FlatLutData FlatLutData::loadFromFile(std::ifstream& file, const char* filename)
282282
size_t numEntries = static_cast<size_t>(data.mNchBins) * data.mRadBins * data.mEtaBins * data.mPtBins;
283283
size_t entriesSize = numEntries * sizeof(lutEntry_t);
284284

285-
file.read(reinterpret_cast<char*>(data.data() + headerSize), entriesSize);
285+
file.read(reinterpret_cast<char*>(data.data() + headerSize), entriesSize); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
286286
if (file.gcount() != static_cast<std::streamsize>(entriesSize)) {
287287
throw framework::runtime_error_f("Failed to read LUT entries from %s: expected %zu bytes, got %zu", filename, entriesSize, static_cast<size_t>(file.gcount()));
288288
}

‎ALICE3/Core/FlatLutWriter.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void FlatLutWriter::lutWrite(const char* filename, int pdg, float field, size_t
266266
setMap(lutHeader.ptmap, mPtBinning);
267267

268268
// Write header to file
269-
lutFile.write(reinterpret_cast<char*>(&lutHeader), sizeof(lutHeader_t));
269+
lutFile.write(reinterpret_cast<char*>(&lutHeader), sizeof(lutHeader_t)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
270270
if (!lutFile.good()) {
271271
LOGF(error, "Failed to write LUT header to %s", filename);
272272
lutFile.close();
@@ -361,7 +361,7 @@ void FlatLutWriter::lutWrite(const char* filename, int pdg, float field, size_t
361361
diagonalise(lutEntry);
362362

363363
// Write entry to file
364-
lutFile.write(reinterpret_cast<char*>(&lutEntry), sizeof(lutEntry_t));
364+
lutFile.write(reinterpret_cast<char*>(&lutEntry), sizeof(lutEntry_t)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
365365
if (!lutFile.good()) {
366366
LOGF(error, "Failed to write LUT entry at index [%d,%d,%d,%d]", inch, irad, ieta, ipt);
367367
lutFile.close();

‎ALICE3/Core/FlatTrackSmearer.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ bool TrackSmearer::viewTable(int pdg, const uint8_t* buffer, size_t size, bool f
171171

172172
bool TrackSmearer::viewTable(int pdg, std::span<std::byte> const& span, bool forceReload)
173173
{
174-
return viewTable(pdg, reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes(), forceReload);
174+
return viewTable(pdg, reinterpret_cast<const uint8_t*>(span.data()), span.size_bytes(), forceReload); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
175175
}
176176

177177
bool TrackSmearer::hasTable(int pdg) const

‎ALICE3/Core/GeometryContainer.cxx‎

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

2020
#include "Common/Core/TableHelper.h"
2121

22-
#include <CCDB/BasicCCDBManager.h>
2322
#include <Framework/InitContext.h>
2423
#include <Framework/Logger.h>
2524

@@ -41,15 +40,15 @@ void GeometryContainer::init(o2::framework::InitContext& initContext)
4140
}
4241
LOG(info) << "Size of detector configuration: " << detectorConfiguration.size();
4342

44-
bool cleanLutWhenLoaded;
45-
const bool foundCleanLutWhenLoaded = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "cleanLutWhenLoaded", cleanLutWhenLoaded, false);
43+
bool cleanLut;
44+
const bool foundCleanLutWhenLoaded = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "cleanLutWhenLoaded", cleanLut, false);
4645
if (!foundCleanLutWhenLoaded) {
4746
LOG(fatal) << "Could not retrieve foundCleanLutWhenLoaded option from OnTheFlyDetectorGeometryProvider task.";
4847
return;
4948
}
50-
setLutCleanupSetting(cleanLutWhenLoaded);
49+
setLutCleanupSetting(cleanLut);
5150

52-
for (std::string& configFile : detectorConfiguration) {
51+
for (const std::string& configFile : detectorConfiguration) {
5352
LOG(info) << "Detector geometry configuration file used: " << configFile;
5453
addEntry(configFile);
5554
}

‎ALICE3/Core/GeometryContainer.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ struct GeometryEntry {
3636
// Default constructor
3737
GeometryEntry() = default;
3838
explicit GeometryEntry(const std::string& filename, o2::ccdb::BasicCCDBManager* ccdb = nullptr)
39+
: mFileName(ConfigurationParser::accessFile(filename, "./.ALICE3/Configuration/", ccdb))
3940
{
40-
mFileName = ConfigurationParser::accessFile(filename, "./.ALICE3/Configuration/", ccdb);
4141
mConfigurations = ConfigurationParser::parseTEnvConfiguration(mFileName, mLayerNames);
4242
LOG(info) << "Loaded geometry configuration from file: " << mFileName << " with " << mLayerNames.size() << " layers.";
4343
if (mLayerNames.empty()) {
4444
LOG(warning) << "No layers found in geometry configuration file: " << filename;
4545
}
4646
}
4747

48-
std::map<std::string, std::map<std::string, std::string>> getConfigurations() const { return mConfigurations; }
48+
const std::map<std::string, std::map<std::string, std::string>>& getConfigurations() const { return mConfigurations; }
4949
std::map<std::string, std::string> getConfiguration(const std::string& layerName) const;
50-
std::vector<std::string> getLayerNames() const { return mLayerNames; }
50+
const std::vector<std::string>& getLayerNames() const { return mLayerNames; }
5151
bool hasValue(const std::string& layerName, const std::string& key) const;
5252
std::string getValue(const std::string& layerName, const std::string& key, bool require = true) const;
5353
void setValue(const std::string& layerName, const std::string& key, const std::string& value) { mConfigurations[layerName][key] = value; }

‎ALICE3/DataModel/OTFMID.h‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 OTFMID.h
14+
/// \author David Dobrigkeit Chinellato
15+
/// \author Antonio Ortiz, UNAM
16+
/// \since 11/05/2023
17+
/// \brief Set of tables for the ALICE3 OTFMID information
18+
/// TODO: remove the columns that are not usefulf for me
19+
20+
#ifndef ALICE3_DATAMODEL_OTFMID_H_
21+
#define ALICE3_DATAMODEL_OTFMID_H_
22+
23+
#include <Framework/AnalysisDataModel.h>
24+
25+
#include <cstdlib>
26+
#include <vector>
27+
28+
namespace o2::aod
29+
{
30+
namespace upgrade_mid
31+
{
32+
DECLARE_SOA_COLUMN(MIDTrackTime, midTrackTime, float); //! Track time generated at the MID
33+
DECLARE_SOA_COLUMN(MIDTrackLength, midTrackLength, float); //! track length for calculation of MID (generated)
34+
35+
DECLARE_SOA_COLUMN(MIDEventTime, midEventTime, float); //! Event time reconstructed with the MID
36+
DECLARE_SOA_COLUMN(MIDEventTimeErr, midEventTimeErr, float); //! Uncertainty on the event time reconstructed with the MID
37+
DECLARE_SOA_COLUMN(MIDTrackPosReco, midTrackPosReco, std::vector<float>); //! Measured position in MID
38+
DECLARE_SOA_COLUMN(MIDTrackPos, midTrackPos, std::vector<float>); //! Expected position in MID
39+
DECLARE_SOA_COLUMN(MIDCandidate, midCandidate, bool); //! Muon candidate
40+
DECLARE_SOA_COLUMN(MIDTrackTimeReco, midTrackTimeReco, float); //! Track time measured at MID
41+
DECLARE_SOA_COLUMN(MIDTrackLengthReco, midTrackLengthReco, float); //! track length for calculation of MID (reconstructed)
42+
43+
} // namespace upgrade_mid
44+
45+
DECLARE_SOA_TABLE(UpgradeMidMCs, "AOD", "UPGRADEMIDMC",
46+
upgrade_mid::MIDTrackTime,
47+
upgrade_mid::MIDTrackLength);
48+
49+
DECLARE_SOA_TABLE(UpgradeMids, "AOD", "UPGRADEMID",
50+
upgrade_mid::MIDEventTime,
51+
upgrade_mid::MIDEventTimeErr,
52+
upgrade_mid::MIDTrackPosReco,
53+
upgrade_mid::MIDTrackTimeReco,
54+
upgrade_mid::MIDTrackLengthReco,
55+
upgrade_mid::MIDCandidate);
56+
57+
DECLARE_SOA_TABLE(UpgradeMidExpecteds, "AOD", "UPGRADEMIDEXPT",
58+
upgrade_mid::MIDTrackPos,
59+
upgrade_mid::MIDTrackTime,
60+
upgrade_mid::MIDTrackLength);
61+
62+
using UpgradeMidMC = UpgradeMidMCs::iterator;
63+
using UpgradeMid = UpgradeMids::iterator;
64+
using UpgradeMidExpected = UpgradeMidExpecteds::iterator;
65+
66+
} // namespace o2::aod
67+
68+
#endif // ALICE3_DATAMODEL_OTFMID_H_

0 commit comments

Comments
 (0)