99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111// /
12- // / \file TrackUtilities.h
13- // /
14- // / \brief Set of utilities for the ALICE3 track handling
15- // /
12+ // / \file TrackUtilities.h
13+ // / \author Nicolò Jacazio, Universita del Piemonte Orientale (IT)
14+ // / \brief Set of utilities for the ALICE3 track handling
1615// / \since May 21, 2025
1716// /
1817
1918#ifndef ALICE3_CORE_TRACKUTILITIES_H_
2019#define ALICE3_CORE_TRACKUTILITIES_H_
2120
22- #include < vector>
23-
2421#include " ReconstructionDataFormats/Track.h"
25- #include " Framework/O2DatabasePDGPlugin.h"
26- #include " Framework/AnalysisHelpers.h"
22+
2723#include " TLorentzVector.h"
2824
25+ #include < vector>
26+
2927namespace o2 ::upgrade
3028{
3129
@@ -37,34 +35,20 @@ namespace o2::upgrade
3735void convertTLorentzVectorToO2Track (const int charge,
3836 const TLorentzVector particle,
3937 const std::vector<double > productionVertex,
40- o2::track::TrackParCov& o2track)
41- {
42- std::array<float , 5 > params;
43- std::array<float , 15 > covm = {0 .};
44- float s, c, x;
45- o2::math_utils::sincos (static_cast <float >(particle.Phi ()), s, c);
46- o2::math_utils::rotateZInv (static_cast <float >(productionVertex[0 ]), static_cast <float >(productionVertex[1 ]), x, params[0 ], s, c);
47- params[1 ] = static_cast <float >(productionVertex[2 ]);
48- params[2 ] = 0 .; // since alpha = phi
49- const auto theta = 2 . * std::atan (std::exp (-particle.PseudoRapidity ()));
50- params[3 ] = 1 . / std::tan (theta);
51- params[4 ] = charge / particle.Pt ();
52-
53- // Initialize TrackParCov in-place
54- new (&o2track)(o2::track::TrackParCov)(x, particle.Phi (), params, covm);
55- }
38+ o2::track::TrackParCov& o2track);
5639
5740// / Function to convert a TLorentzVector into a perfect Track
5841// / \param pdgCode particle pdg
5942// / \param particle the particle to convert (TLorentzVector)
6043// / \param productionVertex where the particle was produced
6144// / \param o2track the address of the resulting TrackParCov
6245// / \param pdg the pdg service
46+ template <typename PdgService>
6347void convertTLorentzVectorToO2Track (int pdgCode,
6448 TLorentzVector particle,
6549 std::vector<double > productionVertex,
6650 o2::track::TrackParCov& o2track,
67- const o2::framework::Service<o2::framework::O2DatabasePDG> & pdg)
51+ const PdgService & pdg)
6852{
6953 const auto pdgInfo = pdg->GetParticle (pdgCode);
7054 int charge = 0 ;
@@ -78,10 +62,10 @@ void convertTLorentzVectorToO2Track(int pdgCode,
7862// / \param particle the particle to convert (mcParticle)
7963// / \param o2track the address of the resulting TrackParCov
8064// / \param pdg the pdg service
81- template <typename McParticleType>
65+ template <typename McParticleType, typename PdgService >
8266void convertMCParticleToO2Track (McParticleType& particle,
8367 o2::track::TrackParCov& o2track,
84- const o2::framework::Service<o2::framework::O2DatabasePDG> & pdg)
68+ const PdgService & pdg)
8569{
8670 static TLorentzVector tlv;
8771 tlv.SetPxPyPzE (particle.px (), particle.py (), particle.pz (), particle.e ());
@@ -92,9 +76,9 @@ void convertMCParticleToO2Track(McParticleType& particle,
9276// / \param particle the particle to convert (mcParticle)
9377// / \param o2track the address of the resulting TrackParCov
9478// / \param pdg the pdg service
95- template <typename McParticleType>
79+ template <typename McParticleType, typename PdgService >
9680o2::track::TrackParCov convertMCParticleToO2Track (McParticleType& particle,
97- const o2::framework::Service<o2::framework::O2DatabasePDG> & pdg)
81+ const PdgService & pdg)
9882{
9983 o2::track::TrackParCov o2track;
10084 convertMCParticleToO2Track (particle, o2track, pdg);
0 commit comments