ATLAS Offline Software
MassConstraint.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6  MassConstraint.cxx
7  maaike.limper@cern.ch
8  ***************************************************************************/
9 
11 
13  : m_mass(mass)
14 {}
15 
17 Trk::MassConstraint::vectorOfValues(std::vector<Amg::VectorX>& cart_coordList,
18  std::vector<int>& charges,
19  Amg::Vector3D refPoint,
20  double b_fieldTesla) const
21 {
22 
23  unsigned int ntrack = cart_coordList.size();
24 
25  Amg::VectorX vectorOfValues2(1, 0);
26 
27  const double bend_factor = -0.299792458 * b_fieldTesla;
28 
29  double Etot = 0.;
30  double Px = 0.;
31  double Py = 0.;
32  double Pz = 0.;
33 
34  for (unsigned int i = 0; i < ntrack; i++) {
35  const double E = cart_coordList[i][3];
36  const double px = cart_coordList[i][0];
37  const double py = cart_coordList[i][1];
38  const double pz = cart_coordList[i][2];
39 
40  const double deltaX = refPoint[0] - cart_coordList[i][4];
41  const double deltaY = refPoint[1] - cart_coordList[i][5];
42 
43  const double a = charges[i] * bend_factor;
44 
45  // sum of values of cartesian coordinates at given reference-point
46  Etot += E;
47  Px += (px - a * deltaY);
48  Py += (py + a * deltaX);
49  Pz += pz;
50  }
51 
52  vectorOfValues2[0] =
53  Etot * Etot - Px * Px - Py * Py - Pz * Pz -
54  m_mass * m_mass; // fill vector using sums made in track-loop
55 
56  return vectorOfValues2;
57 }
58 
61  std::vector<Amg::VectorX>& cart_coordList,
62  std::vector<int>& charges,
63  Amg::Vector3D refPoint,
64  double b_fieldTesla) const
65 {
66 
67  const unsigned int ntrack = cart_coordList.size();
68 
69  Amg::MatrixX matrixDeriv2(1, ntrack * 7);
70 
71  const double bend_factor = -0.299792458 * b_fieldTesla;
72 
73  for (unsigned int i = 0; i < ntrack; i++) {
74  const double E = cart_coordList[i][3];
75  const double px = cart_coordList[i][0];
76  const double py = cart_coordList[i][1];
77  const double pz = cart_coordList[i][2];
78 
79  const double deltaX = refPoint[0] - cart_coordList[i][4];
80  const double deltaY = refPoint[1] - cart_coordList[i][5];
81 
82  const double a = charges[i] * bend_factor;
83 
84  for (unsigned int jtrack = 0; jtrack < ntrack; jtrack++) {
85  const unsigned int joff = jtrack * 7;
86  matrixDeriv2(0, joff + 0) =
87  matrixDeriv2(0, joff + 0) - 2 * (px - a * deltaY);
88  matrixDeriv2(0, joff + 1) =
89  matrixDeriv2(0, joff + 1) - 2 * (py + a * deltaX);
90  matrixDeriv2(0, joff + 2) = matrixDeriv2(0, joff + 2) - 2 * pz;
91  matrixDeriv2(0, joff + 3) = matrixDeriv2(0, joff + 3) + 2 * E;
92 
93  // shouldn't this go to 0 when deltaX = 0 ?! no! when vertex moves px,py
94  // moves and vice-versa so derivative of vertex should depend on px,py
95  matrixDeriv2(0, joff + 4) =
96  matrixDeriv2(0, joff + 4) + 2 * a * (py + a * deltaX);
97  matrixDeriv2(0, joff + 5) =
98  matrixDeriv2(0, joff + 5) - 2 * a * (px - a * deltaY);
99  //(*p_matrixDeriv)[0][joff+6] = (*p_matrixDeriv)[0][joff+6] + 0.; // no
100  //dependence on z!
101  }
102  }
103 
104  return matrixDeriv2;
105 }
106 
Trk::py
@ py
Definition: ParamDefs.h:66
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:32
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
makeComparison.deltaY
int deltaY
Definition: makeComparison.py:44
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:67
Trk::MassConstraint::MassConstraint
MassConstraint()=default
empty constructor
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
MassConstraint.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::px
@ px
Definition: ParamDefs.h:65
compareGeometries.deltaX
float deltaX
Definition: compareGeometries.py:32
Py
Definition: PyDataStore.h:24
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::MassConstraint::matrixOfDerivatives
virtual Amg::MatrixX matrixOfDerivatives(std::vector< Amg::VectorX > &cart_coordList, std::vector< int > &charges, Amg::Vector3D refPoint, double b_fieldTesla) const override final
method returning the matrix of derivatives.
Definition: MassConstraint.cxx:60
Trk::MassConstraint::vectorOfValues
virtual Amg::VectorX vectorOfValues(std::vector< Amg::VectorX > &cart_coordList, std::vector< int > &charges, Amg::Vector3D refPoint, double b_fieldTesla) const override final
method returning the vector of parameters values.
Definition: MassConstraint.cxx:17