ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkVertexFitter
TrkVKalVrtCore
src
Derclc1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkVKalVrtCore/Derclc1.h
"
6
#include "
TrkVKalVrtCore/cfMomentum.h
"
7
#include "
TrkVKalVrtCore/CommonPars.h
"
8
#include "
TrkVKalVrtCore/Derivt.h
"
9
#include "
TrkVKalVrtCore/TrkVKalVrtCoreBase.h
"
10
#include "
TrkVKalVrtCore/TrkVKalUtils.h
"
11
#include <array>
12
#include <algorithm>
13
#include <cmath>
14
#include <iostream>
15
#include <cassert>
16
17
namespace
Trk
{
18
19
20
//
21
// Mass constraint calculation in new data model.
22
//
23
// cnstV and cnstP values are used!!!
24
//-----------------------------------------------
25
void
calcMassConstraint
(
VKMassConstraint
* cnst )
26
{
27
int
it,itc;
28
double
ptot[4]={0.,0.,0.,0.};
29
double
cth, invR, pp2, pt;
30
VKConstraintBase
* base_cnst =
static_cast<
VKConstraintBase
*
>
(cnst);
31
const
VKVertex
* vk=cnst->
getOriginVertex
();
32
const
std::vector<int> &usedParticles=cnst->
getUsedParticles
();
33
int
usedNTRK = usedParticles.size();
34
VKTrack
* trk;
35
noinit_vector< std::array<double, 4>
> pp(usedNTRK);
36
for
( itc=0; itc<usedNTRK; itc++){
37
it = usedParticles[itc];
38
assert(vk->
TrackList
.at(it).get());
39
trk = vk->
TrackList
[it].get();
40
pp[itc]=
getCnstParticleMom
( trk , vk);
41
ptot[0] += pp[itc][0];
42
ptot[1] += pp[itc][1];
43
ptot[2] += pp[itc][2];
44
ptot[3] += pp[itc][3];
45
}
46
47
double
temp
= 1.e-10;
48
int
ip=0;
if
( std::abs(ptot[1]) > std::abs(ptot[ip]) )ip=1;
if
( std::abs(ptot[2]) > std::abs(ptot[ip]) )ip=2;
49
int
im=0;
if
( std::abs(ptot[1]) < std::abs(ptot[im]) )im=1;
if
( std::abs(ptot[2]) < std::abs(ptot[im]) )im=2;
50
int
id
=4;
for
(
int
i=0;i<3;i++)
if
(i!=ip && i!=im)
id
=i;
51
if
(
id
==4){
52
std::cout<<
"ERROR in mass constraint!!!"
<<
'\n'
;
53
temp
=ptot[3]*ptot[3]-ptot[0]*ptot[0]-ptot[1]*ptot[1]-ptot[2]*ptot[2];
54
}
else
{
55
temp
= sqrt( (ptot[3]-ptot[ip])*(ptot[3]+ptot[ip]) );
56
temp
= sqrt( (
temp
-ptot[
id
])*(
temp
+ptot[
id
]) );
57
temp
= (
temp
-ptot[im])*(
temp
+ptot[im]);
58
}
59
if
(
temp
<1.e-10)
temp
=1.e-10;
//protection
60
temp
=sqrt(
temp
);
//system mass
61
//
62
//
63
int
numCNST=0;
//constraint number. Single constraint in this case
64
//
65
//Difference
66
base_cnst->
aa
[numCNST] = (
temp
- cnst->
getTargetMass
() ) * (
temp
+ cnst->
getTargetMass
() );
67
/* -- Relative normalisation. Now it is target mass (squared?) to make performance uniform */
68
double
Scale
=0.025/(2.*cnst->
getTargetMass
()+1.);
//28.03.2011 wrong idea for cascade. VK 06.05.2011 actually correct!
69
//Scale=0.01;
70
//
71
//Derivatives Here pp[][3] - particle energy, pp[][4] - squared particle mom
72
for
( itc=0; itc<usedNTRK; itc++){
73
it = usedParticles[itc];
74
assert(vk->
TrackList
.at(it).get());
75
trk = vk->
TrackList
[it].get();
76
invR = trk->
cnstP
[2];
77
cth = 1. / tan( trk->
cnstP
[0] );
78
pt = sqrt(pp[itc][0]*pp[itc][0] + pp[itc][1]*pp[itc][1]);
79
pp2 = pp[itc][0]*pp[itc][0] + pp[itc][1]*pp[itc][1] + pp[itc][2]*pp[itc][2];
80
base_cnst->
f0t
[it][numCNST].X = ptot[3] * (-pp2* cth / pp[itc][3])
81
- ptot[2] * (-pt * (cth*cth + 1.));
82
base_cnst->
f0t
[it][numCNST].Y = -ptot[0] * (-pp[itc][1])
83
- ptot[1] * pp[itc][0];
84
base_cnst->
f0t
[it][numCNST].Z = ptot[3] * (-pp2/ (invR * pp[itc][3]))
85
- ptot[0] * (-pp[itc][0] / invR)
86
- ptot[1] * (-pp[itc][1] / invR)
87
- ptot[2] * (-pp[itc][2] / invR);
88
89
}
90
base_cnst->
h0t
[numCNST].X = 0.;
91
base_cnst->
h0t
[numCNST].Y = 0.;
92
base_cnst->
h0t
[numCNST].Z = 0.;
93
for
(it = 0; it < (int)vk->
TrackList
.size(); ++it) {
94
base_cnst->
f0t
[it][numCNST].X *=
Scale
* 2;
95
base_cnst->
f0t
[it][numCNST].Y *=
Scale
* 2;
96
base_cnst->
f0t
[it][numCNST].Z *=
Scale
* 2;
97
}
98
base_cnst->
aa
[numCNST] *=
Scale
;
99
//std::cout.precision(11);
100
//std::cout<<" mass="<<temp<<", "<<cnst->getTargetMass()<<", "<<base_cnst->aa[numCNST]<<'\n';
101
//std::cout<<base_cnst->f0t[0][numCNST].X<<", "<<base_cnst->f0t[0][numCNST].Y<<", "
102
// <<base_cnst->f0t[0][numCNST].Z<<'\n';
103
//std::cout<<base_cnst->f0t[1][numCNST].X<<", "<<base_cnst->f0t[1][numCNST].Y<<", "
104
// <<base_cnst->f0t[1][numCNST].Z<<'\n';
105
}
106
107
108
109
110
}
/* End of namespace */
CommonPars.h
Derclc1.h
Derivt.h
TrkVKalUtils.h
TrkVKalVrtCoreBase.h
cfMomentum.h
Trk::VKConstraintBase
Definition
Derivt.h:26
Trk::VKConstraintBase::f0t
std::vector< std::vector< Vect3DF > > f0t
Definition
Derivt.h:39
Trk::VKConstraintBase::getOriginVertex
const VKVertex * getOriginVertex() const
Definition
Derivt.h:32
Trk::VKConstraintBase::h0t
std::vector< Vect3DF > h0t
Definition
Derivt.h:40
Trk::VKConstraintBase::aa
std::vector< double > aa
Definition
Derivt.h:38
Trk::VKMassConstraint
Definition
Derivt.h:48
Trk::VKMassConstraint::getUsedParticles
const std::vector< int > & getUsedParticles() const
Definition
Derivt.h:60
Trk::VKMassConstraint::getTargetMass
double getTargetMass() const
Definition
Derivt.h:59
Trk::VKTrack
Definition
TrkVKalVrtCoreBase.h:63
Trk::VKTrack::cnstP
double cnstP[3]
Definition
TrkVKalVrtCoreBase.h:79
Trk::VKVertex
Definition
TrkVKalVrtCoreBase.h:127
Trk::VKVertex::TrackList
std::vector< std::unique_ptr< VKTrack > > TrackList
Definition
TrkVKalVrtCoreBase.h:166
Trk::temp
Definition
V0VertexDict.h:23
Scale
void Scale(TH1 *h, double d=1)
Definition
comparitor.cxx:79
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::noinit_vector
std::vector< T, boost::noinit_adaptor< std::allocator< T > > > noinit_vector
A variant on std::vector which leaves its contents uninitialized by default.
Definition
TrkVKalUtils.h:50
Trk::calcMassConstraint
void calcMassConstraint(VKMassConstraint *cnst)
Definition
Derclc1.cxx:25
Trk::getCnstParticleMom
std::array< double, 4 > getCnstParticleMom(const VKTrack *trk, const VKVertex *vk)
Definition
cfMomentum.cxx:96
Generated on
for ATLAS Offline Software by
1.17.0