Skip to content

Commit 2bd9671

Browse files
authored
Update TrackUtilities.h
1 parent 04cbec3 commit 2bd9671

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

ALICE3/Core/TrackUtilities.h

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
#ifndef ALICE3_CORE_TRACKUTILITIES_H_
2020
#define ALICE3_CORE_TRACKUTILITIES_H_
2121

22-
#include <vector>
23-
2422
#include "ReconstructionDataFormats/Track.h"
25-
#include "Framework/O2DatabasePDGPlugin.h"
26-
#include "Framework/AnalysisHelpers.h"
23+
24+
#include <vector>
2725
#include "TLorentzVector.h"
2826

2927
namespace o2::upgrade
@@ -37,34 +35,20 @@ namespace o2::upgrade
3735
void 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>
6347
void 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>
8266
void 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>
9680
o2::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

Comments
 (0)