MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
ProjectileDirectionRotator.hh
1
4//
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
23namespace marley {
24
27 class ProjectileDirectionRotator : public EventProcessor {
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( HepMC3::GenEvent& 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
75
80 };
81
82}
Stores event-related information.
Definition GenEvent.h:47
The MARLEY Event generator.
Definition Generator.hh:54
ThreeVector last_pdir_
Stores the direction 3-vector for the last projectile that triggered a recalculation of the rotation ...
virtual void process_event(HepMC3::GenEvent &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...
bool randomize_projectile_direction_
Flag that indicates whether the (rotated) projectile direction should be sampled isotropically for ea...
ThreeVector dir_vec_
3-vector that points in the desired direction of the projectile
ProjectileDirectionRotator(const ThreeVector &dir={0., 0., 1.})
marley::RotationMatrix rot_matrix_
RotationMatrix used to rotate the coordinate system of the input GenEvent.
void rotate_event(HepMC3::GenEvent &ev)
Helper function that does the coordinate system rotation.
Simple rotation matrix implementation used to reorient Particle objects based on the incident neutrin...