MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
RotationMatrix.hh
1 //
5 // This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6 //
7 // MARLEY is free software: you can redistribute it and/or modify it under the
8 // terms of version 3 of the GNU General Public License as published by the
9 // Free Software Foundation.
10 //
11 // For the full text of the license please see COPYING or
12 // visit http://opensource.org/licenses/GPL-3.0
13 //
14 // Please respect the MCnet academic usage guidelines. See GUIDELINES
15 // or visit https://www.montecarlonet.org/GUIDELINES for details.
16 
17 #pragma once
18 
19 // Standard library includes
20 #include <array>
21 
22 // MARLEY includes
23 #include "marley/Particle.hh"
24 
25 namespace marley {
26 
30 
31  using ThreeVector = std::array<double, 3>;
32  using ThreeThreeMatrix = std::array<ThreeVector, 3>;
33 
34  public:
35 
38 
41  RotationMatrix(const ThreeVector& from_vec, const ThreeVector& to_vec);
42 
44  ThreeVector rotate_copy(const ThreeVector& v);
45 
46  // Returns a copy of the 3-vector v normalized to have unit magnitude
47  static ThreeVector normalize(const ThreeVector& v);
48 
50  void rotate_inplace(ThreeVector& v);
51 
54 
55  protected:
56 
58  ThreeThreeMatrix matrix_;
59  };
60 
61 }
Momentum four-vector for a simulated particle.
Definition: Particle.hh:32
Simple rotation matrix implementation used to reorient Particle objects based on the incident neutrin...
Definition: RotationMatrix.hh:29
void rotate_inplace(ThreeVector &v)
Rotate a 3-vector v in place.
Definition: RotationMatrix.cc:84
RotationMatrix()
Creates a 3×3 identity matrix.
Definition: RotationMatrix.cc:56
ThreeVector rotate_copy(const ThreeVector &v)
Create a rotated copy of the 3-vector v.
Definition: RotationMatrix.cc:76
ThreeThreeMatrix matrix_
3×3 rotation matrix
Definition: RotationMatrix.hh:58
void rotate_particle_inplace(marley::Particle &p)
Rotate the 3-momentum of a marley::Particle in place.
Definition: RotationMatrix.cc:92