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
1 change: 1 addition & 0 deletions ALICE3/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

o2physics_add_library(ALICE3Core
SOURCES TOFResoALICE3.cxx
TrackUtilities.cxx
DelphesO2TrackSmearer.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore)
Expand Down
40 changes: 40 additions & 0 deletions ALICE3/Core/TrackUtilities.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

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

View workflow job for this annotation

GitHub Actions / O2 linter

[name/file-cpp]

Use lowerCamelCase or UpperCamelCase for names of C++ files. See the O2 naming conventions for details.
// 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.cxx
/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT)
/// \brief Set of utilities for the ALICE3 track handling
/// \since May 21, 2025
///

#include "TrackUtilities.h"

#include <vector>

void o2::upgrade::convertTLorentzVectorToO2Track(const int charge,

Check failure on line 22 in ALICE3/Core/TrackUtilities.cxx

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 23 in ALICE3/Core/TrackUtilities.cxx

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);
}
42 changes: 13 additions & 29 deletions ALICE3/Core/TrackUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,21 @@
// 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
///
/// \file TrackUtilities.h
/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT)
/// \brief Set of utilities for the ALICE3 track handling
/// \since May 21, 2025
///

#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 23 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.

#include <vector>

namespace o2::upgrade
{

Expand All @@ -34,56 +32,42 @@
/// \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 35 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 36 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);
}
o2::track::TrackParCov& o2track);

/// 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
template <typename PdgService>
void convertTLorentzVectorToO2Track(int pdgCode,

Check failure on line 47 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 48 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 PdgService& 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 58 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>
template <typename McParticleType, typename PdgService>
void convertMCParticleToO2Track(McParticleType& particle,
o2::track::TrackParCov& o2track,
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
const PdgService& pdg)
{
static TLorentzVector tlv;

Check failure on line 70 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());
convertTLorentzVectorToO2Track(particle.pdgCode(), tlv, {particle.vx(), particle.vy(), particle.vz()}, o2track, pdg);
}
Expand All @@ -92,9 +76,9 @@
/// \param particle the particle to convert (mcParticle)
/// \param o2track the address of the resulting TrackParCov
/// \param pdg the pdg service
template <typename McParticleType>
template <typename McParticleType, typename PdgService>
o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle,
const o2::framework::Service<o2::framework::O2DatabasePDG>& pdg)
const PdgService& pdg)
{
o2::track::TrackParCov o2track;
convertMCParticleToO2Track(particle, o2track, pdg);
Expand Down
Loading