MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
ProjectileDirectionRotator.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 // MARLEY includes
20 #include "marley/EventProcessor.hh"
21 #include "marley/RotationMatrix.hh"
22 
23 namespace marley {
24 
28 
29  using ThreeVector = std::array<double, 3>;
30 
31  public:
32 
35  ProjectileDirectionRotator( const ThreeVector& dir = {0., 0., 1.} );
36 
37  inline virtual ~ProjectileDirectionRotator() = default;
38 
42  virtual void process_event( marley::Event& ev,
43  marley::Generator& gen ) override;
44 
45  inline const ThreeVector& projectile_direction() const
46  { return dir_vec_; }
47 
48  inline void set_projectile_direction( const ThreeVector& dir ) {
49  dir_vec_ = marley::RotationMatrix::normalize( dir );
51  }
52 
53  ThreeVector sample_isotropic_direction( marley::Generator& gen ) const;
54 
55  void set_randomize_directions( bool do_sampling );
56 
57  protected:
58 
61  ThreeVector dir_vec_ = {{ 0., 0., 1. }};
62 
66  ThreeVector last_pdir_ = {{ 0., 0., 1. }};
67 
71 
74  void rotate_event( marley::Event& ev );
75 
80  };
81 
82 }
Container for ingoing and outgoing momentum 4-vectors from a reaction.
Definition: Event.hh:66
Abstract base class for entities that take a marley::Event as input and possibly modify it.
Definition: EventProcessor.hh:27
The MARLEY Event generator.
Definition: Generator.hh:42
If needed, rotates the coordinate system of an Event so that the projectile 3-momentum lies along a d...
Definition: ProjectileDirectionRotator.hh:27
ThreeVector last_pdir_
Stores the direction 3-vector for the last projectile that triggered a recalculation of the rotation ...
Definition: ProjectileDirectionRotator.hh:66
bool randomize_projectile_direction_
Flag that indicates whether the (rotated) projectile direction should be sampled isotropically for ea...
Definition: ProjectileDirectionRotator.hh:79
ThreeVector dir_vec_
3-vector that points in the desired direction of the projectile
Definition: ProjectileDirectionRotator.hh:61
ProjectileDirectionRotator(const ThreeVector &dir={0., 0., 1.})
Definition: ProjectileDirectionRotator.cc:23
marley::RotationMatrix rot_matrix_
RotationMatrix used to rotate the coordinate system of the input Event.
Definition: ProjectileDirectionRotator.hh:70
void rotate_event(marley::Event &ev)
Helper function that does the coordinate system rotation.
Definition: ProjectileDirectionRotator.cc:71
virtual void process_event(marley::Event &ev, marley::Generator &gen) override
Rotates all 3-momenta in the input event so that the projectile 3-momentum lies along dir_vec_ in the...
Definition: ProjectileDirectionRotator.cc:34
Simple rotation matrix implementation used to reorient Particle objects based on the incident neutrin...
Definition: RotationMatrix.hh:29