ATLAS Offline Software
Derivt.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef _TrkVKalVrtCore_Derivt_H
6 #define _TrkVKalVrtCore_Derivt_H
7 
8 #include <vector>
9 
11 #include "TrkVKalVrtCore/Derclc1.h"
12 #include "TrkVKalVrtCore/Derclc2.h"
16 namespace Trk {
17 
18 // Base class for any constraint
19 // Contains derivatines needed for application
20 //
21 
22 class VKVertex;
23 enum class VKContraintType { Mass, Phi, Theta, Point, Plane };
25  public:
26  VKConstraintBase(const int, int, VKContraintType, VKVertex*);
27  virtual ~VKConstraintBase();
28 
29  public:
30  const VKVertex* getOriginVertex() const { return m_originVertex; }
31  VKContraintType getType() const { return m_type; }
32  virtual VKConstraintBase* clone() const = 0;
33  virtual void applyConstraint() = 0;
34  int NCDim; // constraint dimension
35  int NTrk; // number of tracks
36  std::vector<double> aa; // Constraint values
37  std::vector<std::vector<Vect3DF> > f0t; // Constraint momentum derivatives
38  std::vector<Vect3DF> h0t; // Constraint space derivatives
39  protected:
42 };
43 //
44 // Mass constraint
45 //
46 class VKMassConstraint final : public VKConstraintBase {
47  public:
48  VKMassConstraint(int, double, VKVertex*);
49  VKMassConstraint(int, double, std::vector<int>, VKVertex*);
51  friend std::ostream& operator<<(std::ostream& out, const VKMassConstraint&);
52  virtual VKConstraintBase* clone() const override;
53 
54  public:
55  void setTargetMass(double M) { m_targetMass = M; };
56  virtual void applyConstraint() override;
57  double getTargetMass() const { return m_targetMass; };
58  const std::vector<int>& getUsedParticles() const { return m_usedParticles; };
59 
60  private:
61  std::vector<int> m_usedParticles;
62  double m_targetMass;
63 };
64 //
65 // Angular constraints
66 //
67 class VKPhiConstraint final : public VKConstraintBase {
68  public:
71  virtual VKConstraintBase* clone() const override;
72  virtual void applyConstraint() override;
73  friend std::ostream& operator<<(std::ostream& out, const VKPhiConstraint&);
74 };
76  public:
79  virtual VKConstraintBase* clone() const override;
80  virtual void applyConstraint() override;
81  friend std::ostream& operator<<(std::ostream& out, const VKThetaConstraint&);
82 };
83 
84 //
85 // Pointing constraints
86 //
87 class VKPointConstraint final : public VKConstraintBase {
88  public:
89  VKPointConstraint(int, const double[3], VKVertex*, bool);
91  friend std::ostream& operator<<(std::ostream& out, const VKPointConstraint&);
92  bool onlyZ() const { return m_onlyZ; };
93  void setTargetVertex(double VRT[3]) {
94  m_targetVertex[0] = VRT[0];
95  m_targetVertex[1] = VRT[1];
96  m_targetVertex[2] = VRT[2];
97  };
98  const double* getTargetVertex() const { return m_targetVertex; };
99  virtual VKConstraintBase* clone() const override;
100  virtual void applyConstraint() override;
101 
102  private:
103  bool m_onlyZ;
104  double m_targetVertex[3]{}; // Target vertex is in global reference system
105 };
106 //
107 // Vertex in plane constraint
108 //
109 class VKPlaneConstraint final : public VKConstraintBase {
110  public:
111  VKPlaneConstraint(int, double, double, double, double, VKVertex*);
113  friend std::ostream& operator<<(std::ostream& out, const VKPlaneConstraint&);
114  double getA() const { return m_A; }
115  double getB() const { return m_B; }
116  double getC() const { return m_C; }
117  double getD() const { return m_D; }
118  virtual void applyConstraint() override;
119  virtual VKConstraintBase* clone() const override;
120 
121  private:
122  double m_A, m_B, m_C, m_D;
123 };
124 
125 inline VKConstraintBase::VKConstraintBase(const int NC, int NTRK,
126  VKContraintType t, VKVertex* vrt)
127  : NCDim(NC),
128  NTrk(NTRK),
129  aa(NC, 0.),
130  f0t(NTRK, std::vector<Vect3DF>(NC, Vect3DF())),
131  h0t(NC, Vect3DF()),
132  m_originVertex(vrt),
133  m_type(t) {}
134 inline VKConstraintBase::~VKConstraintBase() = default;
135 // MASS constraint
136 inline VKMassConstraint::VKMassConstraint(int NTRK, double mass, VKVertex* vk)
137  : VKConstraintBase(1, NTRK, VKContraintType::Mass, vk),
138  m_usedParticles(NTRK, 0),
139  m_targetMass(mass) {
140  for (int i = 0; i < NTrk; i++)
141  m_usedParticles[i] = i;
142 }
143 
144 inline VKMassConstraint::VKMassConstraint(int NTRK, double mass,
145  std::vector<int> listTrk,
146  VKVertex* vk)
147  : VKConstraintBase(1, NTRK, VKContraintType::Mass, vk),
148  m_usedParticles(std::move(listTrk)),
149  m_targetMass(mass) {
150  m_originVertex = vk;
151 }
152 inline VKMassConstraint::~VKMassConstraint() = default;
153 
154 // Angular constraints
156  : VKConstraintBase(1, NTRK, VKContraintType::Phi, vk) {
157  m_originVertex = vk;
158 }
159 inline VKPhiConstraint::~VKPhiConstraint() = default;
160 
162  : VKConstraintBase(1, NTRK, VKContraintType::Theta, vk) {
163  m_originVertex = vk;
164 }
165 inline VKThetaConstraint::~VKThetaConstraint() = default;
166 
167 // Pointing constraint
168 inline VKPointConstraint::VKPointConstraint(int NTRK, const double vrt[3],
169  VKVertex* vk, bool onlyZ = false)
170  : VKConstraintBase(2, NTRK, VKContraintType::Point, vk), m_onlyZ(onlyZ) {
171  m_originVertex = vk;
172  m_targetVertex[0] = vrt[0];
173  m_targetVertex[1] = vrt[1];
174  m_targetVertex[2] = vrt[2];
175  // For Z only constraint
176 }
177 inline VKPointConstraint::~VKPointConstraint() = default;
178 
179 // Vertex in plane constraint
180 inline VKPlaneConstraint::VKPlaneConstraint(int NTRK, double a, double b,
181  double c, double d, VKVertex* vk)
182  : VKConstraintBase(1, NTRK, VKContraintType::Plane, vk),
183  m_A(a),
184  m_B(b),
185  m_C(c),
186  m_D(d) {}
187 
188 inline VKPlaneConstraint::~VKPlaneConstraint() = default;
189 
191  return new VKMassConstraint(*this);
192 }
194  return new VKPhiConstraint(*this);
195 }
197  return new VKThetaConstraint(*this);
198 }
200  return new VKPointConstraint(*this);
201 }
203  return new VKPlaneConstraint(*this);
204 }
205 
207  calcMassConstraint(this);
208 }
210  calcPhiConstraint(this);
211 }
213  calcThetaConstraint(this);
214 }
216  calcPointConstraint(this);
217 }
219  calcPlaneConstraint(this);
220 }
221 
222 } // namespace Trk
223 #endif
CommonPars.h
Trk::VKContraintType::Theta
@ Theta
Trk::VKPhiConstraint
Definition: Derivt.h:67
Trk::VKConstraintBase::applyConstraint
virtual void applyConstraint()=0
Trk::VKPointConstraint::onlyZ
bool onlyZ() const
Definition: Derivt.h:92
Trk::VKContraintType::Phi
@ Phi
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
Trk::VKPlaneConstraint::m_A
double m_A
Definition: Derivt.h:122
Trk::VKContraintType::Point
@ Point
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Trk::VKPlaneConstraint::getD
double getD() const
Definition: Derivt.h:117
Derclc2.h
Trk::VKMassConstraint::m_usedParticles
std::vector< int > m_usedParticles
Definition: Derivt.h:58
Trk::VKMassConstraint::m_targetMass
double m_targetMass
Definition: Derivt.h:62
Trk::VKPlaneConstraint::clone
virtual VKConstraintBase * clone() const override
Definition: Derivt.h:202
Trk::VKConstraintBase::VKConstraintBase
VKConstraintBase(const int, int, VKContraintType, VKVertex *)
Definition: Derivt.h:125
Trk::VKThetaConstraint::clone
virtual VKConstraintBase * clone() const override
Definition: Derivt.h:196
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TRT_PAI_gasdata::NC
const int NC
Number of levels for Carbon.
Definition: TRT_PAI_gasdata.h:237
Trk::VKConstraintBase::~VKConstraintBase
virtual ~VKConstraintBase()
Trk::VKConstraintBase::NCDim
int NCDim
Definition: Derivt.h:34
Trk::VKMassConstraint
Definition: Derivt.h:46
Derclc1.h
Trk::VKThetaConstraint::VKThetaConstraint
VKThetaConstraint(int, VKVertex *)
Definition: Derivt.h:161
Phi
@ Phi
Definition: RPCdef.h:8
Trk::VKContraintType
VKContraintType
Definition: Derivt.h:23
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::VKPhiConstraint::VKPhiConstraint
VKPhiConstraint(int, VKVertex *)
Definition: Derivt.h:155
Trk::VKPointConstraint::VKPointConstraint
VKPointConstraint(int, const double[3], VKVertex *, bool)
Definition: Derivt.h:168
Trk::VKConstraintBase
Definition: Derivt.h:24
Trk::VKPlaneConstraint::applyConstraint
virtual void applyConstraint() override
Definition: Derivt.h:218
Trk::VKPhiConstraint::~VKPhiConstraint
~VKPhiConstraint()
Trk::VKThetaConstraint::operator<<
friend std::ostream & operator<<(std::ostream &out, const VKThetaConstraint &)
Definition: Derivt.cxx:68
Trk::calcPlaneConstraint
void calcPlaneConstraint(VKPlaneConstraint *cnst)
Definition: DerclcAng.cxx:99
DerclcAng.h
TrkVKalVrtCoreBase.h
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
Trk::VKConstraintBase::NTrk
int NTrk
Definition: Derivt.h:35
Trk::VKContraintType::Mass
@ Mass
Trk::VKPointConstraint
Definition: Derivt.h:87
Trk::VKPointConstraint::m_targetVertex
double m_targetVertex[3]
Definition: Derivt.h:104
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::VKContraintType::Plane
@ Plane
vector
Definition: MultiHisto.h:13
Trk::VKPointConstraint::applyConstraint
virtual void applyConstraint() override
Definition: Derivt.h:215
Trk::VKMassConstraint::applyConstraint
virtual void applyConstraint() override
Definition: Derivt.h:206
Trk::VKThetaConstraint::applyConstraint
virtual void applyConstraint() override
Definition: Derivt.h:212
Trk::VKPlaneConstraint::getB
double getB() const
Definition: Derivt.h:115
Trk::VKPhiConstraint::clone
virtual VKConstraintBase * clone() const override
Definition: Derivt.h:193
Trk::VKThetaConstraint::~VKThetaConstraint
~VKThetaConstraint()
Trk::calcPointConstraint
void calcPointConstraint(VKPointConstraint *cnst)
Definition: Derclc2.cxx:20
Trk::VKMassConstraint::setTargetMass
void setTargetMass(double M)
Definition: Derivt.h:55
Trk::VKConstraintBase::f0t
std::vector< std::vector< Vect3DF > > f0t
Definition: Derivt.h:37
Trk::VKConstraintBase::m_originVertex
VKVertex * m_originVertex
Definition: Derivt.h:40
Trk::VKPointConstraint::~VKPointConstraint
~VKPointConstraint()
Trk::VKPhiConstraint::operator<<
friend std::ostream & operator<<(std::ostream &out, const VKPhiConstraint &)
Definition: Derivt.cxx:56
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VKPointConstraint::clone
virtual VKConstraintBase * clone() const override
Definition: Derivt.h:199
Trk::VKPhiConstraint::applyConstraint
virtual void applyConstraint() override
Definition: Derivt.h:209
Trk::VKPlaneConstraint::getA
double getA() const
Definition: Derivt.h:114
Trk::VKPointConstraint::m_onlyZ
bool m_onlyZ
Definition: Derivt.h:103
Trk::Vect3DF
Definition: TrkVKalUtils.h:14
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ChargedTracksWeightFilter::Spline::Point
Linear spline representation of a function used to calculate weights.
Definition: ChargedTracksWeightFilter.h:28
Trk::VKConstraintBase::aa
std::vector< double > aa
Definition: Derivt.h:36
Trk::VKConstraintBase::clone
virtual VKConstraintBase * clone() const =0
Trk::VKPlaneConstraint::m_B
double m_B
Definition: Derivt.h:122
Trk::VKMassConstraint::getTargetMass
double getTargetMass() const
Definition: Derivt.h:57
Trk::VKMassConstraint::getUsedParticles
const std::vector< int > & getUsedParticles() const
Definition: Derivt.h:58
Trk::VKConstraintBase::getType
VKContraintType getType() const
Definition: Derivt.h:31
Trk::VKMassConstraint::VKMassConstraint
VKMassConstraint(int, double, VKVertex *)
Definition: Derivt.h:136
Trk::VKMassConstraint::~VKMassConstraint
~VKMassConstraint()
Trk::VKPlaneConstraint::~VKPlaneConstraint
~VKPlaneConstraint()
Trk::VKPlaneConstraint::operator<<
friend std::ostream & operator<<(std::ostream &out, const VKPlaneConstraint &)
Definition: Derivt.cxx:100
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::VKConstraintBase::getOriginVertex
const VKVertex * getOriginVertex() const
Definition: Derivt.h:30
Trk::VKConstraintBase::h0t
std::vector< Vect3DF > h0t
Definition: Derivt.h:38
Trk::VKPlaneConstraint::m_C
double m_C
Definition: Derivt.h:122
Trk::VKPointConstraint::getTargetVertex
const double * getTargetVertex() const
Definition: Derivt.h:98
Trk::VKMassConstraint::clone
virtual VKConstraintBase * clone() const override
Definition: Derivt.h:190
Trk::VKPointConstraint::setTargetVertex
void setTargetVertex(double VRT[3])
Definition: Derivt.h:93
Trk::VKPlaneConstraint
Definition: Derivt.h:109
Trk::VKVertex
Definition: TrkVKalVrtCoreBase.h:128
Trk::calcPhiConstraint
void calcPhiConstraint(VKPhiConstraint *cnst)
Definition: DerclcAng.cxx:22
Trk::VKConstraintBase::m_type
const VKContraintType m_type
Definition: Derivt.h:41
Trk::VKPlaneConstraint::VKPlaneConstraint
VKPlaneConstraint(int, double, double, double, double, VKVertex *)
Definition: Derivt.h:180
Trk::VKMassConstraint::operator<<
friend std::ostream & operator<<(std::ostream &out, const VKMassConstraint &)
Definition: Derivt.cxx:33
Trk::VKPlaneConstraint::m_D
double m_D
Definition: Derivt.h:122
TrkVKalUtils.h
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
python.compressB64.c
def c
Definition: compressB64.py:93
Trk::VKPlaneConstraint::getC
double getC() const
Definition: Derivt.h:116
Trk::VKThetaConstraint
Definition: Derivt.h:75
Trk::calcMassConstraint
void calcMassConstraint(VKMassConstraint *cnst)
Definition: Derclc1.cxx:24
Trk::calcThetaConstraint
void calcThetaConstraint(VKThetaConstraint *cnst)
Definition: DerclcAng.cxx:61
Trk::VKPointConstraint::operator<<
friend std::ostream & operator<<(std::ostream &out, const VKPointConstraint &)
Definition: Derivt.cxx:80