ATLAS Offline Software
TrkVKalUtils.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_TRKVKALUTILS_H
6 #define TRKVKALVRTCORE_TRKVKALUTILS_H
7 #include "boost/core/noinit_adaptor.hpp"
8 #include <math.h>
9 #include <algorithm>
10 #include <vector>
11 
12 namespace Trk {
13 
14  struct Vect3DF{
15  double X; double Y; double Z;
16  Vect3DF() noexcept { X=Y=Z=0.; }
17  void Set(double arr[3]) noexcept { X=arr[0]; Y=arr[1]; Z=arr[2]; }
18  double Dist3D( Vect3DF & v) const noexcept { return sqrt(pow(X-v.X,2)+pow(Y-v.Y,2)+pow(Z-v.Z,2)); }
19  };
20 
21  struct VectMOM { double Px; double Py; double Pz; double E; };
22 
23  inline void cfdcopy(double *source, double *target, int n)
24  { std::copy(source, source + n, target); }
25 
26  inline double cfddist3D(double *V1, double *V2)
27  { return sqrt( (V2[0]-V1[0])*(V2[0]-V1[0]) + (V2[1]-V1[1])*(V2[1]-V1[1]) + (V2[2]-V1[2])*(V2[2]-V1[2]) ); }
28 
29 
30 //
31 // Implementation of fortran function SIGN()
32 //------------------------------------------------
33  inline double d_sign(double value, double sign)
34  {
35  if( value >= 0){
36  if (sign >=0) return value;
37  if (sign < 0) return -value;
38  }
39  if( value < 0){
40  if (sign >=0) return -value;
41  if (sign < 0) return value;
42  }
43  return value;
44  }
45 
46 
49  template <class T>
50  using noinit_vector = std::vector<T, boost::noinit_adaptor<std::allocator<T> > >;
51 
52 
53 } /* End namespace */
54 #endif
Trk::Vect3DF::Dist3D
double Dist3D(Vect3DF &v) const noexcept
Definition: TrkVKalUtils.h:18
Trk::VectMOM::E
double E
Definition: TrkVKalUtils.h:21
Trk::cfdcopy
void cfdcopy(double *source, double *target, int n)
Definition: TrkVKalUtils.h:23
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Trk::cfddist3D
double cfddist3D(double *V1, double *V2)
Definition: TrkVKalUtils.h:26
Trk::Vect3DF::Y
double Y
Definition: TrkVKalUtils.h:15
athena.value
value
Definition: athena.py:124
Trk::Vect3DF::Z
double Z
Definition: TrkVKalUtils.h:15
Trk::d_sign
double d_sign(double value, double sign)
Definition: TrkVKalUtils.h:33
Trk::Vect3DF::Vect3DF
Vect3DF() noexcept
Definition: TrkVKalUtils.h:16
beamspotman.n
n
Definition: beamspotman.py:731
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
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VectMOM::Px
double Px
Definition: TrkVKalUtils.h:21
Trk::Vect3DF
Definition: TrkVKalUtils.h:14
Trk::Vect3DF::X
double X
Definition: TrkVKalUtils.h:15
Trk::VectMOM::Py
double Py
Definition: TrkVKalUtils.h:21
copySelective.target
string target
Definition: copySelective.py:37
Trk::Vect3DF::Set
void Set(double arr[3]) noexcept
Definition: TrkVKalUtils.h:17
Trk::VectMOM
Definition: TrkVKalUtils.h:21
copySelective.source
string source
Definition: copySelective.py:32
Trk::VectMOM::Pz
double Pz
Definition: TrkVKalUtils.h:21
calibdata.copy
bool copy
Definition: calibdata.py:27
Trk::v
@ v
Definition: ParamDefs.h:78