Skip to content

Commit b6831c7

Browse files
Merge branch 'master' into li4
2 parents d46dd75 + 0c230cb commit b6831c7

File tree

265 files changed

+29547
-18098
lines changed

Some content is hidden

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

265 files changed

+29547
-18098
lines changed

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
7676
mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1);
7777
// Add CCDB handling logic here if needed
7878
LOG(info) << " --- Now retrieving LUT file from CCDB to: " << filename;
79+
if (mCleanupDownloadedFile) { // Clean up the downloaded file if needed
80+
bool status = loadTable(pdg, filename, forceReload);
81+
if (std::remove(filename) != 0) {
82+
LOG(warn) << " --- Could not remove temporary LUT file: " << filename;
83+
} else {
84+
LOG(info) << " --- Removed temporary LUT file: " << filename;
85+
}
86+
return status;
87+
}
7988
} else { // File exists, proceed to load
8089
LOG(info) << " --- LUT file already exists: " << filename << ". Skipping download.";
8190
checkFile.close();
@@ -157,9 +166,9 @@ lutEntry_t* TrackSmearer::getLUTEntry(const int pdg, const float nch, const floa
157166
{
158167
const int ipdg = getIndexPDG(pdg);
159168
if (!mLUTHeader[ipdg]) {
160-
LOG(error) << " --- getLUTEntry: LUT header not loaded for pdg=" << pdg << ". Returning nullptr.";
161169
return nullptr;
162170
}
171+
163172
auto inch = mLUTHeader[ipdg]->nchmap.find(nch);
164173
auto irad = mLUTHeader[ipdg]->radmap.find(radius);
165174
auto ieta = mLUTHeader[ipdg]->etamap.find(eta);
@@ -281,7 +290,6 @@ bool TrackSmearer::smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float inte
281290

282291
bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch)
283292
{
284-
285293
auto pt = o2track.getPt();
286294
switch (pdg) {
287295
case o2::constants::physics::kHelium3:

ALICE3/Core/DelphesO2TrackSmearer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class TrackSmearer
250250
}
251251
void setdNdEta(float val) { mdNdEta = val; } //;
252252
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //;
253+
void setCleanupDownloadedFile(bool val) { mCleanupDownloadedFile = val; } //;
253254

254255
protected:
255256
static constexpr unsigned int nLUTs = 9; // Number of LUT available
@@ -263,6 +264,7 @@ class TrackSmearer
263264

264265
private:
265266
o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr;
267+
bool mCleanupDownloadedFile = true;
266268
};
267269

268270
} // namespace delphes

ALICE3/Core/DetLayer.cxx

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -28,63 +28,63 @@ namespace o2::fastsim
2828
{
2929

3030
// Parametric constructor
31-
DetLayer::DetLayer(const TString& name_,
32-
float r_,
33-
float z_,
34-
float x0_,
35-
float xrho_,
36-
float resRPhi_,
37-
float resZ_,
38-
float eff_,
39-
int type_)
40-
: name(name_),
41-
r(r_),
42-
z(z_),
43-
x0(x0_),
44-
xrho(xrho_),
45-
resRPhi(resRPhi_),
46-
resZ(resZ_),
47-
eff(eff_),
48-
type(type_)
31+
DetLayer::DetLayer(const TString& name,
32+
float r,
33+
float z,
34+
float x0,
35+
float xrho,
36+
float resRPhi,
37+
float resZ,
38+
float eff,
39+
int type)
40+
: mName(name),
41+
mR(r),
42+
mZ(z),
43+
mX0(x0),
44+
mXrho(xrho),
45+
mResRPhi(resRPhi),
46+
mResZ(resZ),
47+
mEff(eff),
48+
mType(type)
4949
{
5050
}
5151

5252
DetLayer::DetLayer(const DetLayer& other)
53-
: name(other.name), r(other.r), z(other.z), x0(other.x0), xrho(other.xrho), resRPhi(other.resRPhi), resZ(other.resZ), eff(other.eff), type(other.type)
53+
: mName(other.mName), mR(other.mR), mZ(other.mZ), mX0(other.mX0), mXrho(other.mXrho), mResRPhi(other.mResRPhi), mResZ(other.mResZ), mEff(other.mEff), mType(other.mType)
5454
{
5555
}
5656

5757
void DetLayer::addDeadPhiRegion(float phiStart, float phiEnd)
5858
{
59-
static constexpr float kDefaultValue = 2.f;
60-
static constexpr float kPhiTolerance = 1e-4f;
59+
static constexpr float DefaultValue = 2.f;
60+
static constexpr float PhiTolerance = 1e-4f;
6161
if (mDeadPhiRegions == nullptr) {
6262
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);
63+
mDeadPhiRegions->SetNameTitle(Form("deadPhiRegions_%s", mName.Data()), Form("Dead phi regions for layer %s", mName.Data()));
64+
mDeadPhiRegions->AddPoint(0, DefaultValue);
65+
mDeadPhiRegions->AddPoint(o2::constants::math::TwoPI, DefaultValue);
6666
}
6767
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;
68+
LOG(fatal) << "Cannot add dead phi region with invalid range [" << phiStart << ", " << phiEnd << "] to layer " << mName;
6969
return;
7070
}
71-
mDeadPhiRegions->AddPoint(phiStart, kDefaultValue);
72-
mDeadPhiRegions->AddPoint(phiEnd, kDefaultValue);
73-
mDeadPhiRegions->AddPoint(phiStart + kPhiTolerance, 0.f);
74-
mDeadPhiRegions->AddPoint(phiEnd - kPhiTolerance, 0.f);
71+
mDeadPhiRegions->AddPoint(phiStart, DefaultValue);
72+
mDeadPhiRegions->AddPoint(phiEnd, DefaultValue);
73+
mDeadPhiRegions->AddPoint(phiStart + PhiTolerance, 0.f);
74+
mDeadPhiRegions->AddPoint(phiEnd - PhiTolerance, 0.f);
7575
mDeadPhiRegions->Sort();
7676
}
7777

7878
void DetLayer::setDeadPhiRegions(TGraph* graph)
7979
{
80-
LOG(debug) << "Setting dead phi regions for layer " << name << " with graph " << (graph ? graph->GetName() : "nullptr");
80+
LOG(debug) << "Setting dead phi regions for layer " << mName << " with graph " << (graph ? graph->GetName() : "nullptr");
8181
if (mDeadPhiRegions != nullptr) {
82-
LOG(warning) << "Overriding existing dead phi regions for layer " << name;
82+
LOG(warning) << "Overriding existing dead phi regions for layer " << mName;
8383
delete mDeadPhiRegions;
8484
}
8585
mDeadPhiRegions = graph;
8686
if (mDeadPhiRegions->GetN() == 0) {
87-
LOG(warning) << "Dead phi regions graph for layer " << name << " is empty, clearing dead regions";
87+
LOG(warning) << "Dead phi regions graph for layer " << mName << " is empty, clearing dead regions";
8888
mDeadPhiRegions = nullptr;
8989
return; // cleared the dead regions
9090
}
@@ -95,51 +95,59 @@ void DetLayer::setDeadPhiRegions(TGraph* graph)
9595
const float y = mDeadPhiRegions->GetY()[i];
9696
// First point has to be at 0, last point has to be at 2PI
9797
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";
98+
LOG(fatal) << "Dead phi regions graph for layer " << mName << " has invalid x value " << x << " at point " << i << ", first point should be 0 and last point should be 2PI";
9999
}
100100
LOG(debug) << "Point " << i << ": (" << x << ", " << y << ")";
101101
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;
102+
LOG(fatal) << "Dead phi regions graph for layer " << mName << " has invalid x value " << x << " at point " << i;
103103
}
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";
104+
static constexpr float EffValidLowValue = 0.f;
105+
static constexpr float EffValidHighValue = 2.f;
106+
if (y != EffValidLowValue && y != EffValidHighValue) {
107+
LOG(fatal) << "Dead phi regions graph for layer " << mName << " has invalid y value " << y << " at point " << i << ", should be 0 or 2";
106108
}
107109
}
108110
} else {
109-
LOG(info) << "Cleared dead phi regions for layer " << name;
111+
LOG(info) << "Cleared dead phi regions for layer " << mName;
110112
}
111113
}
112114

113115
std::string DetLayer::toString() const
114116
{
115117
std::string out = "";
116118
out.append("DetLayer: ");
117-
out.append(name.Data());
119+
out.append(mName.Data());
118120
out.append(" | r: ");
119-
out.append(std::to_string(r));
121+
out.append(std::to_string(mR));
120122
out.append(" cm | z: ");
121-
out.append(std::to_string(z));
123+
out.append(std::to_string(mZ));
122124
out.append(" cm | x0: ");
123-
out.append(std::to_string(x0));
125+
out.append(std::to_string(mX0));
124126
out.append(" cm | xrho: ");
125-
out.append(std::to_string(xrho));
127+
out.append(std::to_string(mXrho));
126128
out.append(" g/cm^3 | resRPhi: ");
127-
out.append(std::to_string(resRPhi));
129+
out.append(std::to_string(mResRPhi));
128130
out.append(" cm | resZ: ");
129-
out.append(std::to_string(resZ));
131+
out.append(std::to_string(mResZ));
130132
out.append(" cm | eff: ");
131-
out.append(std::to_string(eff));
133+
out.append(std::to_string(mEff));
132134
out.append(" | type: ");
133-
switch (type) {
134-
case layerInert:
135+
switch (mType) {
136+
case kLayerInert:
135137
out.append("Inert");
136138
break;
137-
case layerSilicon:
139+
case kLayerSilicon:
138140
out.append("Silicon");
139141
break;
140-
case layerGas:
142+
case kLayerGas:
141143
out.append("Gas/TPC");
142144
break;
145+
case kLayerTOF:
146+
out.append("TOF");
147+
break;
148+
case kLayerVertex:
149+
out.append("Vertex");
150+
break;
143151
default:
144152
out.append("Unknown");
145153
break;

ALICE3/Core/DetLayer.h

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ struct DetLayer {
3232
// Default constructor
3333
DetLayer() = default;
3434
// Parametric constructor
35-
DetLayer(const TString& name_, float r_, float z_, float x0_, float xrho_,
36-
float resRPhi_ = 0.0f, float resZ_ = 0.0f, float eff_ = 0.0f, int type_ = layerInert);
35+
DetLayer(const TString& name, float r, float z, float x0, float xrho,
36+
float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = kLayerInert);
3737
// Copy constructor
3838
DetLayer(const DetLayer& other);
3939

4040
// Setters
41-
void setName(const TString& name_) { name = name_; }
42-
void setRadius(float r_) { r = r_; }
43-
void setZ(float z_) { z = z_; }
44-
void setRadiationLength(float x0_) { x0 = x0_; }
45-
void setDensity(float xrho_) { xrho = xrho_; }
46-
void setResolutionRPhi(float resRPhi_) { resRPhi = resRPhi_; }
47-
void setResolutionZ(float resZ_) { resZ = resZ_; }
48-
void setEfficiency(float eff_) { eff = eff_; }
49-
void setType(int type_) { type = type_; }
41+
void setName(const TString& name) { mName = name; }
42+
void setRadius(float r) { mR = r; }
43+
void setZ(float z) { mZ = z; }
44+
void setRadiationLength(float x0) { mX0 = x0; }
45+
void setDensity(float xrho) { mXrho = xrho; }
46+
void setResolutionRPhi(float resRPhi) { mResRPhi = resRPhi; }
47+
void setResolutionZ(float resZ) { mResZ = resZ; }
48+
void setEfficiency(float eff) { mEff = eff; }
49+
void setType(int type) { mType = type; }
5050

5151
// Dead areas
5252

@@ -60,21 +60,24 @@ struct DetLayer {
6060
void setDeadPhiRegions(TGraph* graph);
6161

6262
// Getters
63-
float getRadius() const { return r; }
64-
float getZ() const { return z; }
65-
float getRadiationLength() const { return x0; }
66-
float getDensity() const { return xrho; }
67-
float getResolutionRPhi() const { return resRPhi; }
68-
float getResolutionZ() const { return resZ; }
69-
float getEfficiency() const { return eff; }
70-
int getType() const { return type; }
71-
const TString& getName() const { return name; }
63+
float getRadius() const { return mR; }
64+
float getZ() const { return mZ; }
65+
float getRadiationLength() const { return mX0; }
66+
float getDensity() const { return mXrho; }
67+
float getResolutionRPhi() const { return mResRPhi; }
68+
float getResolutionZ() const { return mResZ; }
69+
float getEfficiency() const { return mEff; }
70+
int getType() const { return mType; }
71+
const TString& getName() const { return mName; }
7272
const TGraph* getDeadPhiRegions() const { return mDeadPhiRegions; }
7373

74-
// Check layer type
75-
bool isInert() const { return type == layerInert; }
76-
bool isSilicon() const { return type == layerSilicon; }
77-
bool isGas() const { return type == layerGas; }
74+
// Check layer mType
75+
bool isInert() const { return mType == kLayerInert; }
76+
bool isSilicon() const { return mType == kLayerSilicon; }
77+
bool isGas() const { return mType == kLayerGas; }
78+
bool isTOF() const { return mType == kLayerTOF; }
79+
bool isVertex() const { return mType == kLayerVertex; }
80+
bool isActive() const { return mType != kLayerInert; } // active layers are not inert
7881

7982
// Utilities
8083
std::string toString() const;
@@ -93,33 +96,36 @@ struct DetLayer {
9396
return mDeadPhiRegions->Eval(phi) > 1.f;
9497
};
9598

99+
static constexpr int kLayerVertex = -1; // vertex layer type (not used in tracking)
100+
static constexpr int kLayerInert = 0; // inert/undefined layer
101+
static constexpr int kLayerSilicon = 1; // silicon layer
102+
static constexpr int kLayerGas = 2; // gas/tpc layer
103+
static constexpr int kLayerTOF = 3; // TOF layer type (not used in tracking)
104+
96105
private:
97106
// TString for holding name
98-
TString name;
107+
TString mName;
99108

100109
// position variables
101-
float r; // radius in centimeters
102-
float z; // z dimension in centimeters
110+
float mR; // radius in centimeters
111+
float mZ; // mZ dimension in centimeters
103112

104113
// material variables
105-
float x0; // radiation length
106-
float xrho; // density
114+
float mX0; // radiation length
115+
float mXrho; // density
107116

108117
// resolution variables for active layers
109-
float resRPhi; // RPhi resolution in centimeters
110-
float resZ; // Z resolution in centimeters
118+
float mResRPhi; // RPhi resolution in centimeters
119+
float mResZ; // Z resolution in centimeters
111120

112121
// efficiency
113-
float eff; // detection efficiency
122+
float mEff; // detection efficiency
114123

115124
// dead regions in phi (in radians)
116125
TGraph* mDeadPhiRegions = nullptr;
117126

118127
// layer type
119-
int type; // 0: undefined/inert, 1: silicon, 2: gas/tpc
120-
static constexpr int layerInert = 0; // inert/undefined layer
121-
static constexpr int layerSilicon = 1; // silicon layer
122-
static constexpr int layerGas = 2; // gas/tpc layer
128+
int mType; // 0: undefined/inert, 1: silicon, 2: gas/tpc
123129
};
124130

125131
} // namespace o2::fastsim

0 commit comments

Comments
 (0)