diff --git a/ALICE3/Core/CMakeLists.txt b/ALICE3/Core/CMakeLists.txt index 285c1624853..6d44d580c45 100644 --- a/ALICE3/Core/CMakeLists.txt +++ b/ALICE3/Core/CMakeLists.txt @@ -11,6 +11,7 @@ o2physics_add_library(ALICE3Core SOURCES TOFResoALICE3.cxx + TrackUtilities.cxx DelphesO2TrackSmearer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore) diff --git a/ALICE3/Core/TrackUtilities.cxx b/ALICE3/Core/TrackUtilities.cxx new file mode 100644 index 00000000000..c07fe145ccf --- /dev/null +++ b/ALICE3/Core/TrackUtilities.cxx @@ -0,0 +1,40 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// 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 + +void o2::upgrade::convertTLorentzVectorToO2Track(const int charge, + const TLorentzVector particle, + const std::vector productionVertex, + o2::track::TrackParCov& o2track) +{ + std::array params; + std::array covm = {0.}; + float s, c, x; + o2::math_utils::sincos(static_cast(particle.Phi()), s, c); + o2::math_utils::rotateZInv(static_cast(productionVertex[0]), static_cast(productionVertex[1]), x, params[0], s, c); + params[1] = static_cast(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); +} diff --git a/ALICE3/Core/TrackUtilities.h b/ALICE3/Core/TrackUtilities.h index 3650d500aaf..9bbc00c8f09 100644 --- a/ALICE3/Core/TrackUtilities.h +++ b/ALICE3/Core/TrackUtilities.h @@ -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 - #include "ReconstructionDataFormats/Track.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/AnalysisHelpers.h" + #include "TLorentzVector.h" +#include + namespace o2::upgrade { @@ -37,22 +35,7 @@ namespace o2::upgrade void convertTLorentzVectorToO2Track(const int charge, const TLorentzVector particle, const std::vector productionVertex, - o2::track::TrackParCov& o2track) -{ - std::array params; - std::array covm = {0.}; - float s, c, x; - o2::math_utils::sincos(static_cast(particle.Phi()), s, c); - o2::math_utils::rotateZInv(static_cast(productionVertex[0]), static_cast(productionVertex[1]), x, params[0], s, c); - params[1] = static_cast(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 @@ -60,11 +43,12 @@ void convertTLorentzVectorToO2Track(const int charge, /// \param productionVertex where the particle was produced /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service +template void convertTLorentzVectorToO2Track(int pdgCode, TLorentzVector particle, std::vector productionVertex, o2::track::TrackParCov& o2track, - const o2::framework::Service& pdg) + const PdgService& pdg) { const auto pdgInfo = pdg->GetParticle(pdgCode); int charge = 0; @@ -78,10 +62,10 @@ void convertTLorentzVectorToO2Track(int pdgCode, /// \param particle the particle to convert (mcParticle) /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service -template +template void convertMCParticleToO2Track(McParticleType& particle, o2::track::TrackParCov& o2track, - const o2::framework::Service& pdg) + const PdgService& pdg) { static TLorentzVector tlv; tlv.SetPxPyPzE(particle.px(), particle.py(), particle.pz(), particle.e()); @@ -92,9 +76,9 @@ void convertMCParticleToO2Track(McParticleType& particle, /// \param particle the particle to convert (mcParticle) /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service -template +template o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle, - const o2::framework::Service& pdg) + const PdgService& pdg) { o2::track::TrackParCov o2track; convertMCParticleToO2Track(particle, o2track, pdg);