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
TargetAtom.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 <string>
22
23namespace marley {
24
26 class TargetAtom {
27
28 public:
29
32 explicit TargetAtom( int pdg );
33
38 explicit TargetAtom( int Z, int A );
39
41 inline explicit constexpr operator int() const { return pdg_; }
42
45 inline bool operator==(const marley::TargetAtom& ta) const
46 {
47 return pdg_ == ta.pdg_;
48 }
49
50 inline bool operator!=(const marley::TargetAtom& ta) const
51 {
52 return pdg_ != ta.pdg_;
53 }
54
57 inline bool operator<(const marley::TargetAtom& ta) const
58 {
59 return pdg_ < ta.pdg_;
60 }
61
64 std::string to_string() const;
65
67 int Z() const;
68
70 int A() const;
71
73 inline int pdg() const { return pdg_; }
74
75 protected:
76
82 void check_pdg_validity() const;
83
85 int pdg_;
86 };
87
88}
89
90inline std::ostream& operator<<(std::ostream& out, const marley::TargetAtom& ta)
91{
92 out << ta.to_string();
93 return out;
94}
An atomic target for a lepton scattering reaction.
Definition TargetAtom.hh:26
int A() const
Returns the mass number of the target atom.
Definition TargetAtom.cc:34
int pdg() const
Returns the nuclear PDG code of the target atom.
Definition TargetAtom.hh:73
int pdg_
PDG code for the nucleus of the target atom.
Definition TargetAtom.hh:85
bool operator<(const marley::TargetAtom &ta) const
Define the less-than operator so that TargetAtom objects can be used as the keys of a std::map.
Definition TargetAtom.hh:57
std::string to_string() const
Converts the PDG code to a string representation (e.g., "40Ar")
Definition TargetAtom.cc:38
void check_pdg_validity() const
Helper function for the constructors. Checks the atom's PDG code for validity.
Definition TargetAtom.cc:42
bool operator==(const marley::TargetAtom &ta) const
Two TargetAtom objects are considered equal if their nuclear PDG codes match.
Definition TargetAtom.hh:45
TargetAtom(int pdg)
Create a TargetAtom object from an integer PDG code.
Definition TargetAtom.cc:21
int Z() const
Returns the proton number of the target atom.
Definition TargetAtom.cc:30