ATLAS Offline Software
cfMomentum.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <cmath>
10 #include <array>
11 #include <iostream>
12 
13 namespace Trk {
14 
15 void vkPerigeeToP( const double *perig3, double *pp, double BMAG)
16 {
17  double constB =BMAG * vkalMagCnvCst;
18  double phiv = perig3[1];
19  double pt = constB / std::abs(perig3[2]);
20  pp[0] = pt * cos(phiv);
21  pp[1] = pt * sin(phiv);
22  pp[2] = pt / tan(perig3[0]);
23 }
24 
25 std::array<double, 4> getFitParticleMom( const VKTrack * trk, const VKVertex *vk)
26 {
27  std::array<double, 4> p{};
28  double fieldPos[3];
29  fieldPos[0]=vk->refIterV[0]+vk->fitV[0];
30  fieldPos[1]=vk->refIterV[1]+vk->fitV[1];
31  fieldPos[2]=vk->refIterV[2]+vk->fitV[2];
32  double magConst =Trk::vkalMagFld::getMagFld(fieldPos,(vk->vk_fitterControl).get()) * Trk::vkalMagFld::getCnvCst();
33 
34  double cth = 1. / tan( trk->fitP[0]);
35  double phi = trk->fitP[1];
36  double pt = magConst/ std::abs( trk->fitP[2] );
37  double m = trk->getMass();
38  p[0] = pt * cos(phi);
39  p[1] = pt * sin(phi);
40  p[2] = pt * cth;
41  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
42  return p;
43 }
44 std::array<double, 4> getFitParticleMom(const VKTrack * trk, double BMAG)
45 {
46  std::array<double, 4> p{};
47  double magConst =BMAG * vkalMagCnvCst;
48 
49  double cth = 1. / tan( trk->fitP[0]);
50  double phi = trk->fitP[1];
51  double pt = magConst/ std::abs( trk->fitP[2] );
52  double m = trk->getMass();
53  p[0] = pt * cos(phi);
54  p[1] = pt * sin(phi);
55  p[2] = pt * cth;
56  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
57  return p;
58 }
59 
60 std::array<double, 4> getIniParticleMom( const VKTrack * trk, const VKVertex *vk)
61 {
62  std::array<double, 4> p{};
64 
65  double cth = 1. / tan( trk->iniP[0]);
66  double phi = trk->iniP[1];
67  double pt = magConst/ std::abs( trk->iniP[2] );
68  double m = trk->getMass();
69  p[0] = pt * cos(phi);
70  p[1] = pt * sin(phi);
71  p[2] = pt * cth;
72  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
73  return p;
74 }
75 std::array<double, 4> getIniParticleMom(const VKTrack * trk, double BMAG)
76 {
77  std::array<double, 4> p{};
78  double magConst =BMAG * vkalMagCnvCst;
79 
80  double cth = 1. / tan( trk->iniP[0]);
81  double phi = trk->iniP[1];
82  double pt = magConst/ std::abs( trk->iniP[2] );
83  double m = trk->getMass();
84  p[0] = pt * cos(phi);
85  p[1] = pt * sin(phi);
86  p[2] = pt * cth;
87  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
88  return p;
89 }
90 
91 
92 std::array<double, 4> getCnstParticleMom( const VKTrack * trk, const VKVertex *vk )
93 {
94  std::array<double, 4> p{};
95  double cnstPos[3];
96  cnstPos[0]=vk->refIterV[0]+vk->cnstV[0];
97  cnstPos[1]=vk->refIterV[1]+vk->cnstV[1];
98  cnstPos[2]=vk->refIterV[2]+vk->cnstV[2];
99  double magConst = Trk::vkalMagFld::getMagFld(cnstPos,(vk->vk_fitterControl).get()) * Trk::vkalMagFld::getCnvCst();
100 
101  double cth = 1. / tan( trk->cnstP[0]);
102  double phi = trk->cnstP[1];
103  double pt = magConst/ std::abs( trk->cnstP[2] );
104  double m = trk->getMass();
105  p[0] = pt * cos(phi);
106  p[1] = pt * sin(phi);
107  p[2] = pt * cth;
108  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
109  return p;
110 }
111 std::array<double, 4> getCnstParticleMom(const VKTrack * trk, double BMAG )
112 {
113  std::array<double, 4> p{};
114  double magConst =BMAG * vkalMagCnvCst;
115 
116  double cth = 1. / tan( trk->cnstP[0]);
117  double phi = trk->cnstP[1];
118  double pt = magConst/ std::abs( trk->cnstP[2] );
119  double m = trk->getMass();
120  p[0] = pt * cos(phi);
121  p[1] = pt * sin(phi);
122  p[2] = pt * cth;
123  p[3] = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2] + m*m );
124  return p;
125 }
126 
127 }
Trk::VKTrack::cnstP
double cnstP[3]
Definition: TrkVKalVrtCoreBase.h:80
CommonPars.h
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::vkalMagFld::getMagFld
static void getMagFld(const double, const double, const double, double &, double &, double &, VKalVrtControlBase *)
Definition: VKalVrtBMag.cxx:24
test_pyathena.pt
pt
Definition: test_pyathena.py:11
Trk::VKVertex::refIterV
double refIterV[3]
Definition: TrkVKalVrtCoreBase.h:146
Trk::VKTrack
Definition: TrkVKalVrtCoreBase.h:64
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::getCnstParticleMom
std::array< double, 4 > getCnstParticleMom(const VKTrack *trk, const VKVertex *vk)
Definition: cfMomentum.cxx:92
VKalVrtBMag.h
Trk::VKTrack::fitP
double fitP[3]
Definition: TrkVKalVrtCoreBase.h:76
TrkVKalVrtCoreBase.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::vkalMagFld::getCnvCst
static double getCnvCst()
Definition: VKalVrtBMag.h:49
Trk::VKVertex::fitV
double fitV[3]
Definition: TrkVKalVrtCoreBase.h:140
vkalMagCnvCst
#define vkalMagCnvCst
Definition: CommonPars.h:23
Trk::getIniParticleMom
std::array< double, 4 > getIniParticleMom(const VKTrack *trk, const VKVertex *vk)
Definition: cfMomentum.cxx:60
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VKVertex::vk_fitterControl
std::unique_ptr< VKalVrtControl > vk_fitterControl
Definition: TrkVKalVrtCoreBase.h:194
Trk::getFitParticleMom
std::array< double, 4 > getFitParticleMom(const VKTrack *trk, const VKVertex *vk)
Definition: cfMomentum.cxx:25
Trk::VKVertex::cnstV
double cnstV[3]
Definition: TrkVKalVrtCoreBase.h:143
Trk::vkPerigeeToP
void vkPerigeeToP(const double *perig3, double *pp, double BMAG)
Definition: cfMomentum.cxx:15
Trk::VKVertex
Definition: TrkVKalVrtCoreBase.h:128
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::VKTrack::iniP
double iniP[3]
Definition: TrkVKalVrtCoreBase.h:83
Trk::VKTrack::getMass
double getMass() const
Definition: TrkVKalVrtCoreBase.h:100
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
cfMomentum.h