Skip to content

Commit 7bb3cbe

Browse files
Merge branch 'AliceO2Group:master' into master
2 parents 343b8be + d3378cd commit 7bb3cbe

File tree

428 files changed

+40771
-16595
lines changed

Some content is hidden

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

428 files changed

+40771
-16595
lines changed

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- name: Label the PR
1818
id: labeler
19-
uses: actions/labeler@v5
19+
uses: actions/labeler@v6
2020
with:
2121
repo-token: ${{ secrets.GITHUB_TOKEN }}
2222
sync-labels: true

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

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
stale:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/stale@v9
16+
- uses: actions/stale@v10
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.'

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,18 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
105105
mLUTHeader[ipdg] = nullptr;
106106
return false;
107107
}
108-
if (mLUTHeader[ipdg]->pdg != pdg) {
108+
bool specialPdgCase = false;
109+
switch (pdg) { // Handle special cases
110+
case o2::constants::physics::kAlpha: // Special case: Allow Alpha particles to use He3 LUT
111+
specialPdgCase = (mLUTHeader[ipdg]->pdg == o2::constants::physics::kHelium3);
112+
if (specialPdgCase)
113+
LOG(info)
114+
<< " --- Alpha particles (PDG " << pdg << ") will use He3 LUT data (PDG " << mLUTHeader[ipdg]->pdg << ")" << std::endl;
115+
break;
116+
default:
117+
break;
118+
}
119+
if (mLUTHeader[ipdg]->pdg != pdg && !specialPdgCase) {
109120
LOG(info) << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl;
110121
delete mLUTHeader[ipdg];
111122
mLUTHeader[ipdg] = nullptr;

ALICE3/Core/DelphesO2TrackSmearer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <TRandom.h>
3131

32+
#include <cstdio>
3233
#include <fstream>
3334
#include <iostream>
3435
#include <map>
@@ -214,6 +215,8 @@ class TrackSmearer
214215
return 6; // Triton
215216
case 1000020030:
216217
return 7; // Helium3
218+
case 1000020040:
219+
return 8; // Alphas
217220
default:
218221
return 2; // Default: pion
219222
}
@@ -238,6 +241,8 @@ class TrackSmearer
238241
return "triton";
239242
case 1000020030:
240243
return "helium3";
244+
case 1000020040:
245+
return "alpha";
241246
default:
242247
return "pion"; // Default: pion
243248
}
@@ -246,7 +251,7 @@ class TrackSmearer
246251
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //;
247252

248253
protected:
249-
static constexpr unsigned int nLUTs = 8; // Number of LUT available
254+
static constexpr unsigned int nLUTs = 9; // Number of LUT available
250255
lutHeader_t* mLUTHeader[nLUTs] = {nullptr};
251256
lutEntry_t***** mLUTEntry[nLUTs] = {nullptr};
252257
bool mUseEfficiency = true;

ALICE3/Core/DetLayer.cxx

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
/// \brief Basic struct to hold information regarding a detector layer to be used in fast simulation
1717
///
1818

19-
#include <vector>
20-
#include <string>
21-
2219
#include "DetLayer.h"
2320

21+
#include <CommonConstants/MathConstants.h>
22+
#include <Framework/Logger.h>
23+
24+
#include <string>
25+
#include <vector>
26+
2427
namespace o2::fastsim
2528
{
2629

@@ -51,6 +54,62 @@ DetLayer::DetLayer(const DetLayer& other)
5154
{
5255
}
5356

57+
void DetLayer::addDeadPhiRegion(float phiStart, float phiEnd)
58+
{
59+
static constexpr float kDefaultValue = 2.f;
60+
static constexpr float kPhiTolerance = 1e-4f;
61+
if (mDeadPhiRegions == nullptr) {
62+
mDeadPhiRegions = new TGraph();
63+
mDeadPhiRegions->SetNameTitle(Form("deadPhiRegions_%s", name.Data()), Form("Dead phi regions for layer %s", name.Data()));
64+
mDeadPhiRegions->AddPoint(0, kDefaultValue);
65+
mDeadPhiRegions->AddPoint(o2::constants::math::TwoPI, kDefaultValue);
66+
}
67+
if (phiStart < 0 || phiStart >= o2::constants::math::TwoPI || phiEnd < 0 || phiEnd >= o2::constants::math::TwoPI) {
68+
LOG(fatal) << "Cannot add dead phi region with invalid range [" << phiStart << ", " << phiEnd << "] to layer " << name;
69+
return;
70+
}
71+
mDeadPhiRegions->AddPoint(phiStart, kDefaultValue);
72+
mDeadPhiRegions->AddPoint(phiEnd, kDefaultValue);
73+
mDeadPhiRegions->AddPoint(phiStart + kPhiTolerance, 0.f);
74+
mDeadPhiRegions->AddPoint(phiEnd - kPhiTolerance, 0.f);
75+
mDeadPhiRegions->Sort();
76+
}
77+
78+
void DetLayer::setDeadPhiRegions(TGraph* graph)
79+
{
80+
LOG(debug) << "Setting dead phi regions for layer " << name << " with graph " << (graph ? graph->GetName() : "nullptr");
81+
if (mDeadPhiRegions != nullptr) {
82+
LOG(warning) << "Overriding existing dead phi regions for layer " << name;
83+
delete mDeadPhiRegions;
84+
}
85+
mDeadPhiRegions = graph;
86+
if (mDeadPhiRegions->GetN() == 0) {
87+
LOG(warning) << "Dead phi regions graph for layer " << name << " is empty, clearing dead regions";
88+
mDeadPhiRegions = nullptr;
89+
return; // cleared the dead regions
90+
}
91+
// Check sanity of the graph
92+
if (mDeadPhiRegions != nullptr) {
93+
for (int i = 0; i < mDeadPhiRegions->GetN(); i++) {
94+
const float x = mDeadPhiRegions->GetX()[i];
95+
const float y = mDeadPhiRegions->GetY()[i];
96+
// First point has to be at 0, last point has to be at 2PI
97+
if ((i == 0 && x != 0.f) || (i == mDeadPhiRegions->GetN() - 1 && x != o2::constants::math::TwoPI)) {
98+
LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid x value " << x << " at point " << i << ", first point should be 0 and last point should be 2PI";
99+
}
100+
LOG(debug) << "Point " << i << ": (" << x << ", " << y << ")";
101+
if (x < 0 || x > o2::constants::math::TwoPI) {
102+
LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid x value " << x << " at point " << i;
103+
}
104+
if (y != 0.f && y != 2.f) {
105+
LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid y value " << y << " at point " << i << ", should be 0 or 2";
106+
}
107+
}
108+
} else {
109+
LOG(info) << "Cleared dead phi regions for layer " << name;
110+
}
111+
}
112+
54113
std::string DetLayer::toString() const
55114
{
56115
std::string out = "";

ALICE3/Core/DetLayer.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
#ifndef ALICE3_CORE_DETLAYER_H_
2020
#define ALICE3_CORE_DETLAYER_H_
2121

22-
#include <string>
22+
#include <TGraph.h>
23+
#include <TString.h>
2324

24-
#include "TString.h"
25+
#include <string>
2526

2627
namespace o2::fastsim
2728
{
@@ -47,6 +48,17 @@ struct DetLayer {
4748
void setEfficiency(float eff_) { eff = eff_; }
4849
void setType(int type_) { type = type_; }
4950

51+
// Dead areas
52+
53+
/// @brief Add a dead region in phi for this layer
54+
/// @param phiStart starting angle in radians of the dead region
55+
/// @param phiEnd ending angle in radians of the dead region
56+
void addDeadPhiRegion(float phiStart, float phiEnd);
57+
58+
/// @brief Set the dead regions in phi for this layer with a TGraph containing all regions. The graph should have y=2 for dead regions and y=0 for alive regions.
59+
/// @param graph graph of the dead regions. Can be nullptr to clear the dead regions.
60+
void setDeadPhiRegions(TGraph* graph);
61+
5062
// Getters
5163
float getRadius() const { return r; }
5264
float getZ() const { return z; }
@@ -57,6 +69,7 @@ struct DetLayer {
5769
float getEfficiency() const { return eff; }
5870
int getType() const { return type; }
5971
const TString& getName() const { return name; }
72+
const TGraph* getDeadPhiRegions() const { return mDeadPhiRegions; }
6073

6174
// Check layer type
6275
bool isInert() const { return type == layerInert; }
@@ -70,6 +83,15 @@ struct DetLayer {
7083
os << layer.toString();
7184
return os;
7285
}
86+
/// @brief Check if a given phi angle is in a dead region
87+
/// @param phi The phi angle to check
88+
/// @return True if the phi angle is in a dead region, false otherwise
89+
bool isInDeadPhiRegion(float phi) const
90+
{
91+
if (mDeadPhiRegions == nullptr)
92+
return false;
93+
return mDeadPhiRegions->Eval(phi) > 1.f;
94+
};
7395

7496
private:
7597
// TString for holding name
@@ -90,6 +112,9 @@ struct DetLayer {
90112
// efficiency
91113
float eff; // detection efficiency
92114

115+
// dead regions in phi (in radians)
116+
TGraph* mDeadPhiRegions = nullptr;
117+
93118
// layer type
94119
int type; // 0: undefined/inert, 1: silicon, 2: gas/tpc
95120
static constexpr int layerInert = 0; // inert/undefined layer

0 commit comments

Comments
 (0)