Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ALICE3/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
o2physics_add_library(ALICE3Core
SOURCES TOFResoALICE3.cxx
DelphesO2TrackSmearer.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore)

o2physics_target_root_dictionary(ALICE3Core
HEADERS TOFResoALICE3.h
TrackUtilities.h
DelphesO2TrackSmearer.h
LINKDEF ALICE3CoreLinkDef.h)

o2physics_add_library(FastTracker
SOURCES FastTracker.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore)

o2physics_target_root_dictionary(FastTracker
HEADERS FastTracker.h
Expand Down
107 changes: 107 additions & 0 deletions ALICE3/Core/TrackUtilities.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///
/// \file TrackUtilities.h
///
/// \brief Set of utilities for the ALICE3 track handling
///
/// \since May 21, 2025
///

Check failure on line 17 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

#ifndef ALICE3_CORE_TRACKUTILITIES_H_
#define ALICE3_CORE_TRACKUTILITIES_H_

#include <vector>

#include "ReconstructionDataFormats/Track.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "Framework/AnalysisHelpers.h"
#include "TLorentzVector.h"

Check failure on line 27 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.

namespace o2::upgrade
{

/// Function to convert a TLorentzVector into a perfect Track
/// \param charge particle charge (integer)
/// \param particle the particle to convert (TLorentzVector)
/// \param productionVertex where the particle was produced
/// \param o2track the address of the resulting TrackParCov
void convertTLorentzVectorToO2Track(const int charge,

Check failure on line 37 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
const TLorentzVector particle,

Check failure on line 38 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
const std::vector<double> productionVertex,
o2::track::TrackParCov& o2track)
{
std::array<float, 5> params;
std::array<float, 15> covm = {0.};
float s, c, x;
o2::math_utils::sincos(static_cast<float>(particle.Phi()), s, c);
o2::math_utils::rotateZInv(static_cast<float>(productionVertex[0]), static_cast<float>(productionVertex[1]), x, params[0], s, c);
params[1] = static_cast<float>(productionVertex[2]);
params[2] = 0.; // since alpha = phi
const auto theta = 2. * std::atan(std::exp(-particle.PseudoRapidity()));
params[3] = 1. / std::tan(theta);
params[4] = charge / particle.Pt();

// Initialize TrackParCov in-place
new (&o2track)(o2::track::TrackParCov)(x, particle.Phi(), params, covm);
}

/// Function to convert a TLorentzVector into a perfect Track
/// \param pdgCode particle pdg
/// \param particle the particle to convert (TLorentzVector)
/// \param productionVertex where the particle was produced
/// \param o2track the address of the resulting TrackParCov
/// \param pdg the pdg service
void convertTLorentzVectorToO2Track(int pdgCode,

Check failure on line 63 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
TLorentzVector particle,

Check failure on line 64 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
std::vector<double> productionVertex,
o2::track::TrackParCov& o2track,
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
{
const auto pdgInfo = pdg->GetParticle(pdgCode);
int charge = 0;
if (pdgInfo != nullptr) {
charge = pdgInfo->Charge() / 3;
}
convertTLorentzVectorToO2Track(charge, particle, productionVertex, o2track);

Check failure on line 74 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
}

/// Function to convert a McParticle into a perfect Track
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
/// \param pdg the pdg service
template <typename McParticleType>
void convertMCParticleToO2Track(McParticleType& particle,
o2::track::TrackParCov& o2track,
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
{
static TLorentzVector tlv;

Check failure on line 86 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
tlv.SetPxPyPzE(particle.px(), particle.py(), particle.pz(), particle.e());
tlv.SetXYZT(particle.vx(), particle.vy(), particle.vz(), particle.vt());
convertTLorentzVectorToO2Track(particle.pdgCode(), tlv, {particle.vx(), particle.vy(), particle.vz()}, o2track, pdg);

Check failure on line 89 in ALICE3/Core/TrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
}

/// Function to convert a McParticle into a perfect Track
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
/// \param pdg the pdg service
template <typename McParticleType>
o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle,
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
{
o2::track::TrackParCov o2track;
convertMCParticleToO2Track(particle, o2track, pdg);
return o2track;
}

} // namespace o2::upgrade

#endif // ALICE3_CORE_TRACKUTILITIES_H_
31 changes: 2 additions & 29 deletions ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "Framework/ASoAHelpers.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/Core/trackUtilities.h"
#include "ALICE3/Core/TrackUtilities.h"
#include "ReconstructionDataFormats/DCA.h"
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
Expand Down Expand Up @@ -446,34 +447,6 @@ struct OnTheFlyRichPid {
updateProjectiveParameters();
}

/// Function to convert a McParticle into a perfect Track
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
template <typename McParticleType>
o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle)
{
// FIXME: this is a fundamentally important piece of code.
// It could be placed in a utility file instead of here.
auto pdgInfo = pdg->GetParticle(particle.pdgCode());
int charge = 0;
if (pdgInfo != nullptr) {
charge = pdgInfo->Charge() / 3;
}
std::array<float, 5> params;
std::array<float, 15> covm = {0.};
float s, c, x;
o2::math_utils::sincos(particle.phi(), s, c);
o2::math_utils::rotateZInv(particle.vx(), particle.vy(), x, params[0], s, c);
params[1] = particle.vz();
params[2] = 0.; // since alpha = phi
auto theta = 2. * std::atan(std::exp(-particle.eta()));
params[3] = 1. / std::tan(theta);
params[4] = charge / particle.pt();

// Return TrackParCov
return o2::track::TrackParCov(x, particle.phi(), params, covm);
}

/// check if particle reaches radiator
/// \param track the input track
/// \param radius the radius of the layer you're calculating the length to
Expand Down Expand Up @@ -778,7 +751,7 @@ struct OnTheFlyRichPid {
continue;

auto mcParticle = track.mcParticle();
o2::track::TrackParCov o2track = convertMCParticleToO2Track(mcParticle);
o2::track::TrackParCov o2track = o2::upgrade::convertMCParticleToO2Track(mcParticle, pdg);

// float xPv = error_value;
if (o2track.propagateToDCA(mcPvVtx, dBz)) {
Expand Down
31 changes: 2 additions & 29 deletions ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Framework/ASoAHelpers.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/Core/trackUtilities.h"
#include "ALICE3/Core/TrackUtilities.h"
#include "ReconstructionDataFormats/DCA.h"
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
Expand Down Expand Up @@ -252,34 +253,6 @@ struct OnTheFlyTofPid {
}
}

/// Function to convert a McParticle into a perfect Track
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
template <typename McParticleType>
o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle)
{
// FIXME: this is a fundamentally important piece of code.
// It could be placed in a utility file instead of here.
auto pdgInfo = pdg->GetParticle(particle.pdgCode());
int charge = 0;
if (pdgInfo != nullptr) {
charge = pdgInfo->Charge() / 3;
}
std::array<float, 5> params;
std::array<float, 15> covm = {0.};
float s, c, x;
o2::math_utils::sincos(particle.phi(), s, c);
o2::math_utils::rotateZInv(particle.vx(), particle.vy(), x, params[0], s, c);
params[1] = particle.vz();
params[2] = 0.; // since alpha = phi
auto theta = 2. * std::atan(std::exp(-particle.eta()));
params[3] = 1. / std::tan(theta);
params[4] = charge / particle.pt();

// Return TrackParCov
return o2::track::TrackParCov(x, particle.phi(), params, covm);
}

/// function to calculate track length of this track up to a certain radius
/// \param track the input track
/// \param radius the radius of the layer you're calculating the length to
Expand Down Expand Up @@ -519,7 +492,7 @@ struct OnTheFlyTofPid {
LOG(debug) << "Track without mcParticle found!";
}
const auto& mcParticle = track.mcParticle();
o2::track::TrackParCov o2track = convertMCParticleToO2Track(mcParticle);
o2::track::TrackParCov o2track = o2::upgrade::convertMCParticleToO2Track(mcParticle, pdg);

float xPv = -100.f;
static constexpr float kTrkXThreshold = -99.f; // Threshold to consider a good propagation of the track
Expand Down
66 changes: 7 additions & 59 deletions ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
#include "ALICE3/Core/FastTracker.h"
#include "ALICE3/Core/DetLayer.h"
#include "ALICE3/Core/TrackUtilities.h"
#include "ALICE3/DataModel/collisionAlice3.h"
#include "ALICE3/DataModel/tracksAlice3.h"
#include "ALICE3/DataModel/OTFStrangeness.h"
Expand Down Expand Up @@ -275,7 +276,7 @@ struct OnTheFlyTracker {
mapPdgLut.insert(std::make_pair(1000010030, lutTrChar));
mapPdgLut.insert(std::make_pair(1000020030, lutHe3Char));
}
for (auto e : mapPdgLut) {
for (const auto& e : mapPdgLut) {
if (!mSmearer.loadTable(e.first, e.second)) {
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
}
Expand Down Expand Up @@ -493,59 +494,6 @@ struct OnTheFlyTracker {
decayDaughters.push_back(*laDecay.GetDecay(1));
}

/// Function to convert a TLorentzVector into a perfect Track
/// \param pdgCode particle pdg
/// \param particle the particle to convert (TLorentzVector)
/// \param productionVertex where the particle was produced
/// \param o2track the address of the resulting TrackParCov
void convertTLorentzVectorToO2Track(int pdgCode, TLorentzVector particle, std::vector<double> productionVertex, o2::track::TrackParCov& o2track)
{
auto pdgInfo = pdgDB->GetParticle(pdgCode);
int charge = 0;
if (pdgInfo != nullptr) {
charge = pdgInfo->Charge() / 3;
}
std::array<float, 5> params;
std::array<float, 15> covm = {0.};
float s, c, x;
o2::math_utils::sincos(static_cast<float>(particle.Phi()), s, c);
o2::math_utils::rotateZInv(static_cast<float>(productionVertex[0]), static_cast<float>(productionVertex[1]), x, params[0], s, c);
params[1] = static_cast<float>(productionVertex[2]);
params[2] = 0;
auto theta = 2. * std::atan(std::exp(-particle.PseudoRapidity()));
params[3] = 1. / std::tan(theta);
params[4] = charge / particle.Pt();

// Initialize TrackParCov in-place
new (&o2track)(o2::track::TrackParCov)(x, particle.Phi(), params, covm);
}

/// Function to convert a McParticle into a perfect Track
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
template <typename McParticleType>
void convertMCParticleToO2Track(McParticleType& particle, o2::track::TrackParCov& o2track)
{
auto pdgInfo = pdgDB->GetParticle(particle.pdgCode());
int charge = 0;
if (pdgInfo != nullptr) {
charge = pdgInfo->Charge() / 3;
}
std::array<float, 5> params;
std::array<float, 15> covm = {0.};
float s, c, x;
o2::math_utils::sincos(particle.phi(), s, c);
o2::math_utils::rotateZInv(particle.vx(), particle.vy(), x, params[0], s, c);
params[1] = particle.vz();
params[2] = 0.; // since alpha = phi
auto theta = 2. * std::atan(std::exp(-particle.eta()));
params[3] = 1. / std::tan(theta);
params[4] = charge / particle.pt();

// Initialize TrackParCov in-place
new (&o2track)(o2::track::TrackParCov)(x, particle.phi(), params, covm);
}

float dNdEta = 0.f; // Charged particle multiplicity to use in the efficiency evaluation
void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles)
{
Expand Down Expand Up @@ -605,7 +553,7 @@ struct OnTheFlyTracker {
if (cascadeDecaySettings.decayXi) {
if (mcParticle.pdgCode() == 3312) {
o2::track::TrackParCov xiTrackParCov;
convertMCParticleToO2Track(mcParticle, xiTrackParCov);
o2::upgrade::convertMCParticleToO2Track(mcParticle, xiTrackParCov, pdgDB);
decayParticle(mcParticle, xiTrackParCov, decayProducts, xiDecayVertex, laDecayVertex);
xiDecayRadius2D = sqrt(xiDecayVertex[0] * xiDecayVertex[0] + xiDecayVertex[1] * xiDecayVertex[1]);
laDecayRadius2D = sqrt(laDecayVertex[0] * laDecayVertex[0] + laDecayVertex[1] * laDecayVertex[1]);
Expand Down Expand Up @@ -653,7 +601,7 @@ struct OnTheFlyTracker {
}

o2::track::TrackParCov trackParCov;
convertMCParticleToO2Track(mcParticle, trackParCov);
o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB);

bool isDecayDaughter = false;
if (mcParticle.getProcess() == 4)
Expand All @@ -674,9 +622,9 @@ struct OnTheFlyTracker {
continue;
}

convertTLorentzVectorToO2Track(-211, decayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0]);
convertTLorentzVectorToO2Track(-211, decayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1]);
convertTLorentzVectorToO2Track(2212, decayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2]);
o2::upgrade::convertTLorentzVectorToO2Track(-211, decayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB);
o2::upgrade::convertTLorentzVectorToO2Track(-211, decayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1], pdgDB);
o2::upgrade::convertTLorentzVectorToO2Track(2212, decayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2], pdgDB);

for (int i = 0; i < 3; i++) {
isReco[i] = false;
Expand Down
Loading