ATLAS Offline Software
TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef TRIGTOOLS_TRIG_VSI_COORD
5 #define TRIGTOOLS_TRIG_VSI_COORD
6 
19 
20 #include "TMath.h"
21 #include "TH3D.h"
22 #include "TVector3.h"
23 
24 #include <cmath>
25 
26 namespace TrigVSI{
27 
29 namespace Coordinate{
30 
34 class Cartesian {
35  public :
38  static inline TVector3 X123toXYZ( double x1, double x2, double x3) {
39  return TVector3(x1, x2, x3);
40  };
41 
42  static inline TVector3 X123toXYZ( const KDPoint<double,3>& p ) {
43  return TVector3(p.at(0),p.at(1),p.at(2));;
44  };
45 
46  static inline KDPoint<double,3> XYZtoX123( const TVector3& v ) {
47  return KDPoint<double,3>({v.x(), v.y(), v.z()});
48  };
50 
53  static inline KDPoint<double,3> Proj(const KDPoint<double,3>& p) {
54  return p;
55  };
57 
60  static inline KDPoint<int,3> ProjBin(const KDPoint<int,3>& ibin, const std::unique_ptr<TH3D>&) {
61  return ibin;
62  };
64 };
65 
66 
67 
71 class Pseudo {
72  public :
75  static inline TVector3 X123toXYZ( double x1, double x2, double x3) {
76  TVector3 tmp;
77  tmp.SetPtEtaPhi(x1,x2,x3);
78  return tmp;
79  };
80 
81  static inline TVector3 X123toXYZ( const KDPoint<double,3>& p ) {
82  TVector3 tmp;
83  tmp.SetPtEtaPhi(p.at(0),p.at(1),p.at(2));
84  return tmp;
85  };
86 
87  static inline KDPoint<double,3> XYZtoX123( const TVector3& v ) {
88  return KDPoint<double,3>({v.Perp(), v.Eta(), v.Phi()});
89  };
91 
94  static inline KDPoint<double,3> Proj(const KDPoint<double,3>& p) {
96  tmp[2] = std::fmod( p[2] + TMath::Pi(), 2. * TMath::Pi() ) - TMath::Pi();
97  return tmp;
98  };
100 
103  static inline KDPoint<int,3> ProjBin(const KDPoint<int,3>& ibin, const std::unique_ptr<TH3D>& map) {
104  KDPoint<int,3> tmp = ibin;
105  tmp[2] = (ibin[2] - 1) % (map->GetNbinsZ() - 1 + 1) + 1;
106  return tmp;
107  };
109 };
110 
111 
112 
116 template<typename T>
117 struct is_coord {
118  static auto check(...) -> std::false_type;
119 
120  template<typename _Coord>
121  static auto check(_Coord*) ->
122  decltype( static_cast<TVector3(*)(const KDPoint<double,3>&)>(&_Coord::X123toXYZ),
123  static_cast<KDPoint<double,3>(*)(const TVector3&)>(&_Coord::XYZtoX123),
124  static_cast<KDPoint<double,3>(*)(const KDPoint<double,3>&)>(&_Coord::Proj),
125  static_cast<KDPoint<int,3>(*)(const KDPoint<int,3>&, const std::unique_ptr<TH3D>&)>(&_Coord::ProjBin),
126  std::true_type() );
127 
128  static constexpr T* insPolicy = nullptr;
129  static constexpr bool value = decltype(check(insPolicy))::value;
130 };
131 
132 } // end of namespace Coordinate
133 
134 } // end of namespace TrigVSI
135 
136 #endif
TrigVSI::Coordinate::Pseudo::XYZtoX123
static KDPoint< double, 3 > XYZtoX123(const TVector3 &v)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:87
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TrigVSI::Coordinate::Pseudo::ProjBin
static KDPoint< int, 3 > ProjBin(const KDPoint< int, 3 > &ibin, const std::unique_ptr< TH3D > &map)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:103
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
TrigVSI::Coordinate::Pseudo::Proj
static KDPoint< double, 3 > Proj(const KDPoint< double, 3 > &p)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:94
TrigVSI::Coordinate::Pseudo
Cordinate policy for perp, eta, phi.
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:71
TrigVSI::Coordinate::is_coord::value
static constexpr bool value
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:129
TrigVSI::Coordinate::Cartesian::ProjBin
static KDPoint< int, 3 > ProjBin(const KDPoint< int, 3 > &ibin, const std::unique_ptr< TH3D > &)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:60
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigVSI::Coordinate::is_coord::check
static auto check(_Coord *) -> decltype(static_cast< TVector3(*)(const KDPoint< double, 3 > &)>(&_Coord::X123toXYZ), static_cast< KDPoint< double, 3 >(*)(const TVector3 &)>(&_Coord::XYZtoX123), static_cast< KDPoint< double, 3 >(*)(const KDPoint< double, 3 > &)>(&_Coord::Proj), static_cast< KDPoint< int, 3 >(*)(const KDPoint< int, 3 > &, const std::unique_ptr< TH3D > &)>(&_Coord::ProjBin), std::true_type())
TrigVSI::Coordinate::is_coord
===========================================================================
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:117
TrigVSI::Coordinate::Cartesian::XYZtoX123
static KDPoint< double, 3 > XYZtoX123(const TVector3 &v)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:46
TrigVSI::Coordinate::Cartesian
Cordinate policy for x, y, z.
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:34
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
TrigVSI::Coordinate::Cartesian::Proj
static KDPoint< double, 3 > Proj(const KDPoint< double, 3 > &p)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:53
TrigVSI::Coordinate::is_coord::check
static auto check(...) -> std::false_type
TrigVSI::Coordinate::Cartesian::X123toXYZ
static TVector3 X123toXYZ(const KDPoint< double, 3 > &p)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:42
TrigVSI::Coordinate::Pseudo::X123toXYZ
static TVector3 X123toXYZ(const KDPoint< double, 3 > &p)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:81
TrigVSI::Coordinate::Cartesian::X123toXYZ
static TVector3 X123toXYZ(double x1, double x2, double x3)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:38
TrigVSI::KDPoint< double, 3 >
TrigVSI::Coordinate::Pseudo::X123toXYZ
static TVector3 X123toXYZ(double x1, double x2, double x3)
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:75
KDPoint.h
point classes for clustering
python.PyAthena.v
v
Definition: PyAthena.py:154
TrigVSI::Coordinate::is_coord::insPolicy
static constexpr T * insPolicy
Definition: TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Coordinate.h:128
TrigVSI
Definition: TrigVrtSecInclusive.cxx:27