Skip to content

Commit 3308a22

Browse files
authored
Add cxx
1 parent 2bd9671 commit 3308a22

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

ALICE3/Core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
o2physics_add_library(ALICE3Core
1313
SOURCES TOFResoALICE3.cxx
14+
TrackUtilities.cxx
1415
DelphesO2TrackSmearer.cxx
1516
PUBLIC_LINK_LIBRARIES O2::Framework
1617
O2Physics::AnalysisCore)

ALICE3/Core/TrackUtilities.cxx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \file TrackUtilities.cxx
13+
///
14+
/// \brief Set of utilities for the ALICE3 track handling
15+
///
16+
/// \since May 21, 2025
17+
///
18+
19+
#include "TrackUtilities.h"
20+
21+
#include <vector>
22+
23+
void o2::upgrade::convertTLorentzVectorToO2Track(const int charge,
24+
const TLorentzVector particle,
25+
const std::vector<double> productionVertex,
26+
o2::track::TrackParCov& o2track)
27+
{
28+
std::array<float, 5> params;
29+
std::array<float, 15> covm = {0.};
30+
float s, c, x;
31+
o2::math_utils::sincos(static_cast<float>(particle.Phi()), s, c);
32+
o2::math_utils::rotateZInv(static_cast<float>(productionVertex[0]), static_cast<float>(productionVertex[1]), x, params[0], s, c);
33+
params[1] = static_cast<float>(productionVertex[2]);
34+
params[2] = 0.; // since alpha = phi
35+
const auto theta = 2. * std::atan(std::exp(-particle.PseudoRapidity()));
36+
params[3] = 1. / std::tan(theta);
37+
params[4] = charge / particle.Pt();
38+
39+
// Initialize TrackParCov in-place
40+
new (&o2track)(o2::track::TrackParCov)(x, particle.Phi(), params, covm);
41+
}

0 commit comments

Comments
 (0)