Skip to content

Commit 98cc4b7

Browse files
committed
Merge branch 'master' into const-PWGCF
2 parents 5925580 + 886200a commit 98cc4b7

205 files changed

Lines changed: 7978 additions & 5457 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.

ALICE3/Core/Decayer.h

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@
3131
#include <TLorentzVector.h>
3232
#include <TRandom3.h>
3333

34+
#include <array>
3435
#include <cmath>
3536
#include <cstddef>
3637
#include <vector>
3738

38-
namespace o2
39-
{
40-
namespace upgrade
39+
namespace o2::upgrade
4140
{
4241

4342
class Decayer
@@ -47,44 +46,27 @@ class Decayer
4746
Decayer() = default;
4847

4948
template <typename TDatabase>
50-
std::vector<o2::upgrade::OTFParticle> decayParticle(const TDatabase& pdgDB, const OTFParticle& particle)
49+
std::vector<o2::upgrade::OTFParticle> decayParticle(const OTFParticle& particle, const TDatabase& pdgDB)
5150
{
52-
const auto& particleInfo = pdgDB->GetParticle(particle.pdgCode());
51+
auto particleInfo = pdgDB->GetParticle(particle.pdgCode());
5352
if (!particleInfo) {
5453
return {};
5554
}
5655

5756
const int charge = particleInfo->Charge() / 3;
5857
const double mass = particleInfo->Mass();
59-
60-
const double u = mRand3.Uniform(0.001, 0.999);
61-
const double ctau = o2::constants::physics::LightSpeedCm2S * particleInfo->Lifetime(); // cm
62-
const double betaGamma = particle.p() / mass;
63-
const double rxyz = -betaGamma * ctau * std::log(1 - u);
64-
double px, py, e;
58+
std::array<double, 3> decayVtx = generateDecayVertex<double>(particle, pdgDB);
59+
mVx = decayVtx[0];
60+
mVy = decayVtx[1];
61+
mVz = decayVtx[2];
62+
double px{}, py{}, e{};
6563

6664
if (!charge) {
67-
mVx = particle.vx() + rxyz * (particle.px() / particle.p());
68-
mVy = particle.vy() + rxyz * (particle.py() / particle.p());
69-
mVz = particle.vz() + rxyz * (particle.pz() / particle.p());
7065
px = particle.px();
7166
py = particle.py();
7267
} else {
73-
o2::track::TrackParCov track;
74-
o2::math_utils::CircleXYf_t circle;
75-
o2::upgrade::convertOTFParticleToO2Track(particle, track, pdgDB);
76-
77-
float sna{}, csa{};
78-
track.getCircleParams(mBz, circle, sna, csa);
79-
const double rxy = rxyz / std::sqrt(1. + track.getTgl() * track.getTgl());
80-
const double theta = rxy / circle.rC;
81-
82-
mVx = ((particle.vx() - circle.xC) * std::cos(theta) - (particle.vy() - circle.yC) * std::sin(theta)) + circle.xC;
83-
mVy = ((particle.vy() - circle.yC) * std::cos(theta) + (particle.vx() - circle.xC) * std::sin(theta)) + circle.yC;
84-
mVz = particle.vz() + rxyz * (particle.pz() / track.getP());
85-
86-
px = particle.px() * std::cos(theta) - particle.py() * std::sin(theta);
87-
py = particle.py() * std::cos(theta) + particle.px() * std::sin(theta);
68+
px = particle.px() * std::cos(mTheta) - particle.py() * std::sin(mTheta);
69+
py = particle.py() * std::cos(mTheta) + particle.px() * std::sin(mTheta);
8870
}
8971

9072
double brTotal = 0.;
@@ -133,6 +115,42 @@ class Decayer
133115
return decayProducts;
134116
}
135117

118+
template <typename T = float, typename TDatabase, typename TParticle>
119+
std::array<T, 3> generateDecayVertex(const TParticle& particle, const TDatabase& pdgDB)
120+
{
121+
std::array<T, 3> decayVertex{};
122+
auto particleInfo = pdgDB->GetParticle(particle.pdgCode());
123+
if (!particleInfo) {
124+
return {};
125+
}
126+
127+
const int charge = particleInfo->Charge() / 3;
128+
const double mass = particleInfo->Mass();
129+
const double u = mRand3.Uniform(0.001, 0.999);
130+
const double ctau = o2::constants::physics::LightSpeedCm2S * particleInfo->Lifetime(); // cm
131+
const double betaGamma = particle.p() / mass;
132+
const double rxyz = -betaGamma * ctau * std::log(1 - u);
133+
134+
if (!charge) {
135+
decayVertex[0] = particle.vx() + rxyz * (particle.px() / particle.p());
136+
decayVertex[1] = particle.vy() + rxyz * (particle.py() / particle.p());
137+
decayVertex[2] = particle.vz() + rxyz * (particle.pz() / particle.p());
138+
} else {
139+
o2::math_utils::CircleXYf_t circle;
140+
o2::track::TrackParCov track = o2::upgrade::convertMCParticleToO2Track(particle, pdgDB);
141+
142+
float sna{}, csa{};
143+
track.getCircleParams(mBz, circle, sna, csa);
144+
const double rxy = rxyz / std::sqrt(1. + track.getTgl() * track.getTgl());
145+
mTheta = rxy / circle.rC;
146+
147+
decayVertex[0] = ((particle.vx() - circle.xC) * std::cos(mTheta) - (particle.vy() - circle.yC) * std::sin(mTheta)) + circle.xC;
148+
decayVertex[1] = ((particle.vy() - circle.yC) * std::cos(mTheta) + (particle.vx() - circle.xC) * std::sin(mTheta)) + circle.yC;
149+
decayVertex[2] = particle.vz() + rxyz * (particle.pz() / track.getP());
150+
}
151+
return decayVertex;
152+
}
153+
136154
// Setters
137155
void setBField(const double b) { mBz = b; }
138156
void setSeed(const int seed)
@@ -142,18 +160,18 @@ class Decayer
142160
}
143161

144162
// Getters
145-
float getSecondaryVertexX() const { return static_cast<float>(mVx); }
146-
float getSecondaryVertexY() const { return static_cast<float>(mVy); }
147-
float getSecondaryVertexZ() const { return static_cast<float>(mVz); }
148-
float getDecayRadius() const { return static_cast<float>(std::hypot(mVx, mVy)); }
163+
[[nodiscard]] float getSecondaryVertexX() const { return static_cast<float>(mVx); }
164+
[[nodiscard]] float getSecondaryVertexY() const { return static_cast<float>(mVy); }
165+
[[nodiscard]] float getSecondaryVertexZ() const { return static_cast<float>(mVz); }
166+
[[nodiscard]] float getDecayRadius() const { return static_cast<float>(std::hypot(mVx, mVy)); }
149167

150168
private:
151169
double mBz{20.}; // kG
152170
double mVx{-1.}, mVy{-1.}, mVz{-1.};
153-
TRandom3 mRand3{};
171+
double mTheta{};
172+
TRandom3 mRand3;
154173
};
155174

156-
} // namespace upgrade
157-
} // namespace o2
175+
} // namespace o2::upgrade
158176

159177
#endif // ALICE3_CORE_DECAYER_H_

ALICE3/Core/DelphesO2LutWriter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void DelphesO2LutWriter::diagonalise(lutEntry_t& lutEntry)
376376
// m.Print();
377377
TMatrixDSymEigen eigen(m);
378378
// eigenvalues vector
379-
TVectorD eigenVal = eigen.GetEigenValues();
379+
const TVectorD& eigenVal = eigen.GetEigenValues();
380380
for (int i = 0; i < kEig; ++i)
381381
lutEntry.eigval[i] = eigenVal[i];
382382
// eigenvectors matrix

ALICE3/Core/FastTracker.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace fastsim
5151

5252
// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+
5353

54-
DetLayer* FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
54+
DetLayer* FastTracker::AddLayer(const TString& name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
5555
{
5656
LOG(debug) << "Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type;
5757
DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type);
@@ -154,7 +154,7 @@ void FastTracker::AddTPC(float phiResMean, float zResMean)
154154
}
155155
}
156156

157-
void FastTracker::AddGenericDetector(o2::fastsim::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager)
157+
void FastTracker::AddGenericDetector(const o2::fastsim::GeometryEntry& configMap, o2::ccdb::BasicCCDBManager* ccdbManager)
158158
{
159159
// Layers
160160
for (const auto& layer : configMap.getLayerNames()) {
@@ -586,7 +586,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
586586
m.SetMatrixArray(reinterpret_cast<double*>(fcovm));
587587
TMatrixDSymEigen eigen(m);
588588
TMatrixD eigVec = eigen.GetEigenVectors();
589-
TVectorD eigVal = eigen.GetEigenValues();
589+
const TVectorD& eigVal = eigen.GetEigenValues();
590590
bool negEigVal = false;
591591
for (int ii = 0; ii < 5; ii++) {
592592
if (eigVal[ii] < 0.0f)

ALICE3/Core/FastTracker.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class FastTracker
4646
virtual ~FastTracker() {}
4747

4848
// Layer and layer configuration
49-
DetLayer* 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);
49+
DetLayer* AddLayer(const 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);
5050

5151
/// Add a dead region in phi for a specific layer
5252
/// \param layerName Name of the layer to modify
@@ -59,11 +59,11 @@ class FastTracker
5959
size_t GetNLayers() const { return layers.size(); }
6060
bool IsLayerInert(const int layer) const { return layers[layer].isInert(); }
6161
void ClearLayers() { layers.clear(); }
62-
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); }
63-
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); }
64-
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); }
65-
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].setResolutionZ(resZ); }
66-
void SetResolution(const std::string layerName, float resRPhi, float resZ)
62+
void SetRadiationLength(const std::string& layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); }
63+
void SetRadius(const std::string& layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); }
64+
void SetResolutionRPhi(const std::string& layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); }
65+
void SetResolutionZ(const std::string& layerName, float resZ) { layers[GetLayerIndex(layerName)].setResolutionZ(resZ); }
66+
void SetResolution(const std::string& layerName, float resRPhi, float resZ)
6767
{
6868
SetResolutionRPhi(layerName, resRPhi);
6969
SetResolutionZ(layerName, resZ);
@@ -80,7 +80,7 @@ class FastTracker
8080
*
8181
* @param configMap Configuration map describing the detector.
8282
*/
83-
void AddGenericDetector(o2::fastsim::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);
83+
void AddGenericDetector(const o2::fastsim::GeometryEntry& configMap, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);
8484

8585
void Print();
8686

ALICE3/Core/FlatLutWriter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ void FlatLutWriter::diagonalise(lutEntry_t& lutEntry)
392392
TMatrixDSymEigen eigen(m);
393393

394394
// Eigenvalues
395-
TVectorD eigenVal = eigen.GetEigenValues();
395+
const TVectorD& eigenVal = eigen.GetEigenValues();
396396
for (int i = 0; i < kEig; ++i)
397397
lutEntry.eigval[i] = eigenVal[i];
398398

ALICE3/Core/GeometryContainer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void GeometryEntry::replaceValue(const std::string& layerName, const std::string
159159
setValue(layerName, key, value);
160160
}
161161

162-
std::string GeometryEntry::accessFile(const std::string& path, const std::string downloadPath, o2::ccdb::BasicCCDBManager* ccdb, int timeoutSeconds)
162+
std::string GeometryEntry::accessFile(const std::string& path, const std::string& downloadPath, o2::ccdb::BasicCCDBManager* ccdb, int timeoutSeconds)
163163
{
164164

165165
if (path.rfind("ccdb:", 0) == 0) {

ALICE3/Core/GeometryContainer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace o2::fastsim
3333
struct GeometryEntry {
3434
// Default constructor
3535
GeometryEntry() = default;
36-
explicit GeometryEntry(std::string filename, o2::ccdb::BasicCCDBManager* ccdb = nullptr)
36+
explicit GeometryEntry(const std::string& filename, o2::ccdb::BasicCCDBManager* ccdb = nullptr)
3737
{
3838
mFileName = accessFile(filename, "./.ALICE3/Configuration/", ccdb);
3939
mConfigurations = GeometryEntry::parseTEnvConfiguration(mFileName, mLayerNames);
@@ -59,7 +59,7 @@ struct GeometryEntry {
5959
* @param timeoutSeconds If positive, then this function will wait for these seconds after download before removing the downloaded file.
6060
* @return The local path to the file, either the original local path or the path to the retrieved file from ccdb
6161
*/
62-
static std::string accessFile(const std::string& path, const std::string downloadPath = "/tmp/GeometryContainer/", o2::ccdb::BasicCCDBManager* ccdb = nullptr, int timeoutSeconds = 0);
62+
static std::string accessFile(const std::string& path, const std::string& downloadPath = "/tmp/GeometryContainer/", o2::ccdb::BasicCCDBManager* ccdb = nullptr, int timeoutSeconds = 0);
6363

6464
std::map<std::string, std::map<std::string, std::string>> getConfigurations() const { return mConfigurations; }
6565
std::map<std::string, std::string> getConfiguration(const std::string& layerName) const;

ALICE3/DataModel/OTFTOF.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,26 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaOuterTOF, nSigmaOuterTOF, //! General function
150150
}
151151
});
152152

153+
DECLARE_SOA_COLUMN(NSigmaSplusInnerTOF, nSigmaSplusInnerTOF, float); //! NSigma Sigma plus InnerTOF
154+
DECLARE_SOA_COLUMN(NSigmaSminusInnerTOF, nSigmaSminusInnerTOF, float); //! NSigma Sigma minus InnerTOF
155+
DECLARE_SOA_COLUMN(NSigmaXiInnerTOF, nSigmaXiInnerTOF, float); //! NSigma Xi InnerTOF
156+
DECLARE_SOA_COLUMN(NSigmaOmegaInnerTOF, nSigmaOmegaInnerTOF, float); //! NSigma Omega InnerTOF
157+
158+
DECLARE_SOA_COLUMN(NSigmaSplusOuterTOF, nSigmaSplusOuterTOF, float); //! NSigma Sigma plus OuterTOF
159+
DECLARE_SOA_COLUMN(NSigmaSminusOuterTOF, nSigmaSminusOuterTOF, float); //! NSigma Sigma minus OuterTOF
160+
DECLARE_SOA_COLUMN(NSigmaXiOuterTOF, nSigmaXiOuterTOF, float); //! NSigma Xi OuterTOF
161+
DECLARE_SOA_COLUMN(NSigmaOmegaOuterTOF, nSigmaOmegaOuterTOF, float); //! NSigma Omega OuterTOF
162+
163+
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeSp, innerTOFExpectedTimeSp, float); //! Reconstructed expected time at the InnerTOF for the Sigma plus mass hypotheses
164+
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeSm, innerTOFExpectedTimeSm, float); //! Reconstructed expected time at the InnerTOF for the Sigma minus mass hypotheses
165+
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeXi, innerTOFExpectedTimeXi, float); //! Reconstructed expected time at the InnerTOF for the Xi mass hypotheses
166+
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeOm, innerTOFExpectedTimeOm, float); //! Reconstructed expected time at the InnerTOF for the Omega mass hypotheses
167+
168+
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeSp, outerTOFExpectedTimeSp, float); //! Reconstructed expected time at the OuterTOF for the Sigma plus mass hypotheses
169+
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeSm, outerTOFExpectedTimeSm, float); //! Reconstructed expected time at the OuterTOF for the Sigma minus mass hypotheses
170+
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeXi, outerTOFExpectedTimeXi, float); //! Reconstructed expected time at the OuterTOF for the Xi mass hypotheses
171+
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeOm, outerTOFExpectedTimeOm, float); //! Reconstructed expected time at the OuterTOF for the Omega mass hypotheses
172+
153173
} // namespace upgrade_tof
154174

155175
DECLARE_SOA_TABLE(UpgradeTofMCs, "AOD", "UPGRADETOFMC",
@@ -222,9 +242,28 @@ DECLARE_SOA_TABLE(UpgradeTofExpectedTimes, "AOD", "UPGRADETOFEXPT",
222242
upgrade_tof::OuterTOFExpectedTimeHe3,
223243
upgrade_tof::OuterTOFExpectedTimeAl);
224244

245+
DECLARE_SOA_TABLE(UpgradeTofShortLiveds, "AOD", "UPGRTOFSHRTLVD",
246+
upgrade_tof::NSigmaSplusInnerTOF,
247+
upgrade_tof::NSigmaSminusInnerTOF,
248+
upgrade_tof::NSigmaXiInnerTOF,
249+
upgrade_tof::NSigmaOmegaInnerTOF,
250+
upgrade_tof::NSigmaSplusOuterTOF,
251+
upgrade_tof::NSigmaSminusOuterTOF,
252+
upgrade_tof::NSigmaXiOuterTOF,
253+
upgrade_tof::NSigmaOmegaOuterTOF,
254+
upgrade_tof::InnerTOFExpectedTimeSp,
255+
upgrade_tof::InnerTOFExpectedTimeSm,
256+
upgrade_tof::InnerTOFExpectedTimeXi,
257+
upgrade_tof::InnerTOFExpectedTimeOm,
258+
upgrade_tof::OuterTOFExpectedTimeSp,
259+
upgrade_tof::OuterTOFExpectedTimeSm,
260+
upgrade_tof::OuterTOFExpectedTimeXi,
261+
upgrade_tof::OuterTOFExpectedTimeOm);
262+
225263
using UpgradeTofMC = UpgradeTofMCs::iterator;
226264
using UpgradeTof = UpgradeTofs::iterator;
227265
using UpgradeTofExpectedTime = UpgradeTofExpectedTimes::iterator;
266+
using UpgradeTofShortLived = UpgradeTofShortLiveds::iterator;
228267

229268
} // namespace o2::aod
230269

0 commit comments

Comments
 (0)