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
hepmc3_utils.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// Nonstandard but widely-supported (see
18// http://en.wikipedia.org/wiki/Pragma_once) preprocessor directive that
19// prevents this file from being included multiple times. Another option is an
20// include guard (http://en.wikipedia.org/wiki/Include_guard).
21#pragma once
22
23// Standard library includes
24#include <iostream>
25#include <limits>
26#include <memory>
27#include <string>
28#include <vector>
29
30// MARLEY includes
31#include "marley/Reaction.hh"
32
33namespace marley {
34 class Generator;
35}
36
37namespace HepMC3 {
38 class FourVector;
39 class GenCrossSection;
40 class GenEvent;
41 class GenRunInfo;
42 class GenVertex;
43 class GenParticle;
44}
45
46namespace marley_hepmc3 {
47
48 // G.R.2
49 constexpr int NUHEPMC_MAJOR_VERSION = 1;
50 constexpr int NUHEPMC_MINOR_VERSION = 0;
51 constexpr int NUHEPMC_PATCH_VERSION = 0;
52
53 // G.R.8
54 void prepare_process_metadata( HepMC3::GenRunInfo& run_info );
55
56 // E.C.1
57 int get_nuhepmc_proc_id( const marley::Reaction::ProcessType pt );
58 marley::Reaction::ProcessType from_nuhepmc_proc_id( const int proc_id );
59
60 // G.R.9
61 void prepare_vertex_status_metadata( HepMC3::GenRunInfo& run_info );
62
63 // G.R.10
64 void prepare_particle_status_metadata( HepMC3::GenRunInfo& run_info );
65
66 // G.R.11
67 void prepare_non_standard_pdg_code_metadata( HepMC3::GenRunInfo& run_info );
68
69 // G.R.4, G.R.6, G.C.2, G.C.3
70 void apply_nuhepmc_runinfo_conventions( HepMC3::GenRunInfo& run_info,
71 const double flux_avg_xsec );
72
73 // V.R.1
74 // Vertex status codes for NuHepMC
75 constexpr int NUHEPMC_PRIMARY_VERTEX = 1;
76 constexpr int NUHEPMC_HF_DECAY_VERTEX = 22;
77 constexpr int NUHEPMC_GAMMA_DECAY_VERTEX = 23;
78
79 // P.R.1
80 // Particle status codes for NuHepMC
81 constexpr int NUHEPMC_FINAL_STATE_STATUS = 1;
82 constexpr int NUHEPMC_PROJECTILE_STATUS = 4;
83 constexpr int NUHEPMC_TARGET_STATUS = 20;
84 constexpr int NUHEPMC_UNDECAYED_RESIDUE_STATUS = 27;
85 constexpr int NUHEPMC_INTERMEDIATE_RESIDUE_STATUS = 28;
86
87 constexpr double DUMMY_PARTICLE_MASS
88 = std::numeric_limits< double >::lowest();
89
90 void set_particle_charge( HepMC3::GenParticle& particle, int charge );
91
92 int get_particle_charge( HepMC3::GenParticle& particle );
93
94 std::shared_ptr< HepMC3::GenParticle > make_particle(
95 const HepMC3::FourVector& mom4, int pdg, int status,
96 double mass = DUMMY_PARTICLE_MASS );
97
98 std::shared_ptr< HepMC3::GenParticle > make_particle(
99 int pdg, double px, double py, double pz, double E, int status,
100 double mass = DUMMY_PARTICLE_MASS );
101
102 std::shared_ptr< HepMC3::GenParticle > make_particle(
103 int pdg, double px, double py, double pz, int status,
104 double mass );
105
106 std::shared_ptr< HepMC3::GenParticle > make_particle(
107 int pdg, int status, double mass = DUMMY_PARTICLE_MASS );
108
109
110 std::vector< std::shared_ptr< HepMC3::GenVertex > >
111 get_vertices_with_status( int status, HepMC3::GenEvent& ev );
112
113 std::vector< std::shared_ptr< HepMC3::GenParticle > >
114 get_particles_with_status( int status, HepMC3::GenEvent& ev );
115
116 std::shared_ptr< HepMC3::GenParticle >
117 get_first_particle_with_status( int status, HepMC3::GenEvent& ev );
118
119 std::shared_ptr< HepMC3::GenParticle > get_projectile(
120 HepMC3::GenEvent& ev );
121
122 std::shared_ptr< HepMC3::GenParticle > get_target(
123 HepMC3::GenEvent& ev );
124
125 std::shared_ptr< HepMC3::GenParticle > get_ejectile(
126 HepMC3::GenEvent& ev );
127
128 std::shared_ptr< HepMC3::GenParticle > get_residue(
129 HepMC3::GenEvent& ev );
130
135 void store_decay_time( double partial_width, marley::Generator& gen,
136 std::shared_ptr< HepMC3::GenVertex >& decay_vtx,
137 const std::shared_ptr< HepMC3::GenParticle >& parent );
138
143 void print_event( const HepMC3::GenEvent& ev, std::ostream& os = std::cout );
144
150 std::string check_run_info_compatibility(
151 const HepMC3::GenRunInfo& ref,
152 const HepMC3::GenRunInfo& candidate );
153};
Generic 4-vector.
Definition FourVector.h:36
Stores additional information about cross-section.
Stores event-related information.
Definition GenEvent.h:47
Stores particle-related information.
Definition GenParticle.h:34
Stores run-related information.
Definition GenRunInfo.h:33
Stores vertex-related information.
Definition GenVertex.h:29
The MARLEY Event generator.
Definition Generator.hh:54
ProcessType
Enumerated type describing the kind of scattering process represented by a Reaction.
Definition Reaction.hh:58