Project
Loading...
Searching...
No Matches
TrackHMP.cxx
Go to the documentation of this file.
1// Copyright 2020-2022 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
18#include "Field/MagneticField.h"
19// #include "DetectorsBase/Propagator.h"
20
21// #include "Field/MagFieldFast.h"
22
23#include <TVector3.h>
24#include <TGeoGlobalMagField.h>
25
26#include <Math/Vector3D.h> //fields
27// #include "Math/Vector3D.h" //fields
28
29const Double_t kB2C = -0.299792458e-3;
30
32
33 using XYZVector = ROOT::Math::XYZVector;
34
35namespace o2
36{
37namespace dataformats
38{
39
40//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41TrackHMP::TrackHMP() = default;
42//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44{
45 // ass. op.
46
47 return *this;
48}
49//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50bool TrackHMP::intersect(Double_t pnt[3], Double_t norm[3], double bz) const
51{
52 //+++++++++++++++++++++++++++++++++++++++++
53 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
54 // Finds point of intersection (if exists) of the helix with the plane.
55 // Stores result in fX and fP.
56 // Arguments: planePoint,planeNorm - the plane defined by any plane's point
57 // and vector, normal to the plane
58 // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
59 //+++++++++++++++++++++++++++++++++++++++++
60
61 std::array<float, 3> x0;
62 getXYZGlo(x0); // get track position in MARS
63
64 // estimates initial helix length up to plane
65 Double_t s = (pnt[0] - x0[0]) * norm[0] + (pnt[1] - x0[1]) * norm[1] + (pnt[2] - x0[2]) * norm[2];
66
67 Double_t dist = 99999, distPrev = dist;
68 // Double_t p[3];
69
70 std::array<float, 3> x, p;
71
72 while (TMath::Abs(dist) > 0.00001) {
73
74 // calculates helix at the distance s from x0 ALONG the helix
75
76 propagate(s, x, p, bz);
77 // distance between current helix position and plane
78
79 dist = (x[0] - pnt[0]) * norm[0] + (x[1] - pnt[1]) * norm[1] + (x[2] - pnt[2]) * norm[2];
80 if (TMath::Abs(dist) >= TMath::Abs(distPrev)) { /*Printf("***********************dist > distPrev******************");*/
81 return kFALSE;
82 }
83 distPrev = dist;
84 s -= dist;
85 }
86 // on exit pnt is intersection point,norm is track vector at that point,
87 // all in MARS
88 for (Int_t i = 0; i < 3; i++) {
89 pnt[i] = x.at(i);
90 norm[i] = p.at(i);
91 }
92
93 return kTRUE;
94} // Intersect()
95//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96void TrackHMP::propagate(Double_t len, std::array<float, 3>& x, std::array<float, 3>& p, double bz) const
97{
98 //+++++++++++++++++++++++++++++++++++++++++
99 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
100 // Extrapolate track along simple helix in magnetic field
101 // Arguments: len -distance alogn helix, [cm]
102 // bz - mag field, [kGaus]
103 // Returns: x and p contain extrapolated positon and momentum
104 // The momentum returned for straight-line tracks is meaningless !
105 //+++++++++++++++++++++++++++++++++++++++++
106
107 std::array<float, 3> x0;
108 getXYZGlo(x0); // get track position in MARS
109
110 x.at(0) = x0.at(0);
111 x.at(1) = x0.at(1);
112 x.at(2) = x0.at(2);
113
114 if (getPtInv() < o2::constants::math::Almost0 || TMath::Abs(bz) < o2::constants::math::Almost0) { // straight-line tracks
115
116 TVector3 trackDirection(1., 1., 1.);
117 trackDirection.SetMag(1);
118 trackDirection.SetTheta(getTheta());
119 trackDirection.SetPhi(getPhi());
120
121 // Double_t unit[3]; GetDirection(unit);
122 x.at(0) += trackDirection.X() * len;
123 x.at(1) += trackDirection.Y() * len;
124 x.at(2) += trackDirection.Z() * len;
125
126 p.at(0) = trackDirection.X() / o2::constants::math::Almost0;
127 p.at(1) = trackDirection.Y() / o2::constants::math::Almost0;
128 p.at(2) = trackDirection.Z() / o2::constants::math::Almost0;
129 } else {
130
131 getPxPyPzGlo(p);
132 Double_t pp = getP();
133
134 Double_t a = -kB2C * bz * getSign();
135 Double_t rho = a / pp;
136 x.at(0) += p.at(0) * TMath::Sin(rho * len) / a - p.at(1) * (1 - TMath::Cos(rho * len)) / a;
137 x.at(1) += p.at(1) * TMath::Sin(rho * len) / a + p.at(0) * (1 - TMath::Cos(rho * len)) / a;
138 x.at(2) += p.at(2) * len / pp;
139 Double_t p0 = p.at(0);
140 p.at(0) = p0 * TMath::Cos(rho * len) - p.at(1) * TMath::Sin(rho * len);
141 p.at(1) = p.at(1) * TMath::Cos(rho * len) + p0 * TMath::Sin(rho * len);
142 }
143
144} // Propagate()
145} // namespace dataformats
146} // namespace o2
Base track model for the Barrel, params only, w/o covariance.
int32_t i
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of the MagF class.
const Double_t kB2C
Definition TrackHMP.cxx:29
ClassImp(o2::dataformats::TrackHMP) using XYZVector
Track Length and TOF integral.
void propagate(Double_t len, std::array< float, 3 > &x, std::array< float, 3 > &p, double bz) const
Definition TrackHMP.cxx:96
Bool_t intersect(Double_t pnt[3], Double_t norm[3], double bz) const
Definition TrackHMP.cxx:50
TrackHMP & operator=(const o2::track::TrackParCov &t)
Definition TrackHMP.cxx:43
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLfloat x0
Definition glcorearb.h:5034
GLenum GLenum GLsizei len
Definition glcorearb.h:4232
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
constexpr float Almost0
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...