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
Target.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// Standard library includes
20#include <ostream>
21#include <map>
22#include <vector>
23
24// MARLEY includes
25#include "TargetAtom.hh"
26
27namespace marley {
28
32 class Target {
33
34 public:
35
38 explicit Target( int pdg );
39
43 explicit Target( int Z, int A );
44
52 Target( const std::vector<TargetAtom>& nuclides,
53 const std::vector<double>& atom_fracs );
54
56 double atom_fraction( const marley::TargetAtom& atom ) const;
57
62 bool contains( const marley::TargetAtom& atom ) const;
63
66 inline bool has_single_nuclide() const
67 { return (atom_fractions_.size() == 1u); }
68
70 void print( std::ostream& out ) const;
71
73 inline const std::map< marley::TargetAtom, double >& atom_fraction_map()
74 const { return atom_fractions_; }
75
76 protected:
77
80 void initialize_single_nuclide( int pdg );
81
83 void initialize( const std::vector<TargetAtom>& nuclides,
84 const std::vector<double>& atom_fracs );
85
91 std::map< marley::TargetAtom, double > atom_fractions_;
92 };
93
94}
95
96inline std::ostream& operator<<(std::ostream& out, const marley::Target& t) {
97 t.print( out );
98 return out;
99}
An atomic target for a lepton scattering reaction.
Definition TargetAtom.hh:26
Description of a macroscopic target for scattering reactions.
Definition Target.hh:32
const std::map< marley::TargetAtom, double > & atom_fraction_map() const
Get read-only access to the map of atom fractions.
Definition Target.hh:73
std::map< marley::TargetAtom, double > atom_fractions_
Map storing the atom fraction for each nuclide in the target material.
Definition Target.hh:91
Target(int pdg)
Create a Target composed of a single nuclide.
Definition Target.cc:24
void initialize_single_nuclide(int pdg)
Helper function for the constructors that use a single nuclide.
Definition Target.cc:36
bool has_single_nuclide() const
Returns true if the target consists of a single kind of target atom, or false otherwise.
Definition Target.hh:66
bool contains(const marley::TargetAtom &atom) const
Return true if the target contains the requested atom, or false otherwise.
Definition Target.cc:108
void initialize(const std::vector< TargetAtom > &nuclides, const std::vector< double > &atom_fracs)
General helper function for the constructors.
Definition Target.cc:53
void print(std::ostream &out) const
Print a textual representation of the Target to a std::ostream.
Definition Target.cc:112
double atom_fraction(const marley::TargetAtom &atom) const
Returns the atom fraction for the requested nuclide.
Definition Target.cc:99