ATLAS Offline Software
Loading...
Searching...
No Matches
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
12namespace 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
int sign(int a)
constexpr int pow(int base, int exp) noexcept
Ensure that the ATLAS eigen extensions are properly loaded.
std::vector< T, boost::noinit_adaptor< std::allocator< T > > > noinit_vector
A variant on std::vector which leaves its contents uninitialized by default.
void cfdcopy(double *source, double *target, int n)
double cfddist3D(double *V1, double *V2)
@ v
Definition ParamDefs.h:78
double d_sign(double value, double sign)
double Dist3D(Vect3DF &v) const noexcept
void Set(double arr[3]) noexcept
Vect3DF() noexcept