Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
gar::gar_pandora::RotationTransformation Class Reference

#include <RotationTransformation.h>

Public Member Functions

 RotationTransformation (int kAxis, float angle)
 
virtual ~RotationTransformation ()
 
const pandora::CartesianVector MakeRotation (const pandora::CartesianVector &initialVec) const
 

Static Public Attributes

static const int kAxisX = 0
 
static const int kAxisY = 1
 
static const int kAxisZ = 2
 

Private Member Functions

void SetRotationX ()
 
void SetRotationY ()
 
void SetRotationZ ()
 

Private Attributes

bool m_RotationSet
 
float m_RotationAngle
 
float fRotMatrix [9]
 

Detailed Description

Definition at line 11 of file RotationTransformation.h.

Constructor & Destructor Documentation

gar::gar_pandora::RotationTransformation::RotationTransformation ( int  kAxis,
float  angle 
)

Definition at line 18 of file RotationTransformation.cxx.

19  : m_RotationSet(false),
20  m_RotationAngle(angle * CLHEP::pi /180.)
21  {
22  switch (axis)
23  {
24  case kAxisX:
25  this->SetRotationX();
26  MF_LOG_INFO("RotationTransformation")
27  << "Rotation set around the x axis with angle " << m_RotationAngle << " rad";
28  m_RotationSet = true;
29  break;
30  case kAxisY:
31  this->SetRotationY();
32  MF_LOG_INFO("RotationTransformation")
33  << "Rotation set around the y axis with angle " << m_RotationAngle << " rad";
34  m_RotationSet = true;
35  break;
36  case kAxisZ:
37  this->SetRotationZ();
38  MF_LOG_INFO("RotationTransformation")
39  << "Rotation set around the z axis with angle " << m_RotationAngle << " rad";
40  m_RotationSet = true;
41  break;
42  default:
43  throw;
44  break;
45  }
46  }
#define MF_LOG_INFO(category)
float pi
Definition: units.py:11
gar::gar_pandora::RotationTransformation::~RotationTransformation ( )
virtual

Definition at line 50 of file RotationTransformation.cxx.

50 {}

Member Function Documentation

const pandora::CartesianVector gar::gar_pandora::RotationTransformation::MakeRotation ( const pandora::CartesianVector &  initialVec) const

Definition at line 54 of file RotationTransformation.cxx.

55  {
56  if(m_RotationSet) {
57  return pandora::CartesianVector( initialVec.GetX() * fRotMatrix[0] + initialVec.GetY() * fRotMatrix[3] + initialVec.GetZ() * fRotMatrix[6], initialVec.GetX() * fRotMatrix[1] + initialVec.GetY() * fRotMatrix[4] + initialVec.GetZ() * fRotMatrix[7], initialVec.GetX() * fRotMatrix[2] + initialVec.GetY() * fRotMatrix[5] + initialVec.GetZ() * fRotMatrix[8] );
58  } else {
59  MF_LOG_INFO("RotationTransformation")
60  << "No rotation axis was defined - operation aborted!";
61  return pandora::CartesianVector(initialVec.GetX(), initialVec.GetY(), initialVec.GetZ());
62  }
63  }
#define MF_LOG_INFO(category)
void gar::gar_pandora::RotationTransformation::SetRotationX ( )
private

Definition at line 67 of file RotationTransformation.cxx.

68  {
69  //col x
70  fRotMatrix[0] = 1.;
71  fRotMatrix[1] = 0.;
72  fRotMatrix[2] = 0.;
73 
74  //col y
75  fRotMatrix[3] = 0.;
76  fRotMatrix[4] = std::cos(m_RotationAngle);
77  fRotMatrix[5] = std::sin(m_RotationAngle);
78 
79  //col z
80  fRotMatrix[6] = 0.;
81  fRotMatrix[7] = -std::sin(m_RotationAngle);
82  fRotMatrix[8] = std::cos(m_RotationAngle);
83  }
void gar::gar_pandora::RotationTransformation::SetRotationY ( )
private

Definition at line 87 of file RotationTransformation.cxx.

88  {
89  //col x
90  fRotMatrix[0] = std::cos(m_RotationAngle);
91  fRotMatrix[1] = 0.;
92  fRotMatrix[2] = -std::sin(m_RotationAngle);
93 
94  //col y
95  fRotMatrix[3] = 0.;
96  fRotMatrix[4] = 1.;
97  fRotMatrix[5] = 0.;
98 
99  //col z
100  fRotMatrix[6] = std::sin(m_RotationAngle);
101  fRotMatrix[7] = 0.;
102  fRotMatrix[8] = std::cos(m_RotationAngle);
103  }
void gar::gar_pandora::RotationTransformation::SetRotationZ ( )
private

Definition at line 107 of file RotationTransformation.cxx.

108  {
109  //col x
110  fRotMatrix[0] = std::cos(m_RotationAngle);
111  fRotMatrix[1] = std::sin(m_RotationAngle);
112  fRotMatrix[2] = 0.;
113 
114  //col y
115  fRotMatrix[3] = -std::sin(m_RotationAngle);
116  fRotMatrix[4] = std::cos(m_RotationAngle);
117  fRotMatrix[5] = 0.;
118 
119  //col z
120  fRotMatrix[6] = 0.;
121  fRotMatrix[7] = 0.;
122  fRotMatrix[8] = 1.;
123  }

Member Data Documentation

float gar::gar_pandora::RotationTransformation::fRotMatrix[9]
private

Definition at line 30 of file RotationTransformation.h.

const int gar::gar_pandora::RotationTransformation::kAxisX = 0
static

Definition at line 20 of file RotationTransformation.h.

const int gar::gar_pandora::RotationTransformation::kAxisY = 1
static

Definition at line 21 of file RotationTransformation.h.

const int gar::gar_pandora::RotationTransformation::kAxisZ = 2
static

Definition at line 22 of file RotationTransformation.h.

float gar::gar_pandora::RotationTransformation::m_RotationAngle
private

Definition at line 29 of file RotationTransformation.h.

bool gar::gar_pandora::RotationTransformation::m_RotationSet
private

Definition at line 28 of file RotationTransformation.h.


The documentation for this class was generated from the following files: