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
TabulatedXSec.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 <map>
21
22// MARLEY includes
23#include "marley/CoulombCorrector.hh"
24#include "marley/ChebyshevInterpolatingFunction.hh"
25#include "marley/LeptonFactors.hh"
26#include "marley/Parity.hh"
27#include "marley/Reaction.hh"
28#include "marley/ResponseTable.hh"
29
30using ProcType = marley::Reaction::ProcessType;
31
32namespace marley {
33
36 class TabulatedXSec {
37
38 public:
39
40 explicit TabulatedXSec( int target_pdg,
43
44 void add_table( const std::string& file_name );
45
47 double delta_ias() const;
48
51 inline bool is_cc() const {
52 bool is_cc = ( proc_type_ == ProcType::NeutrinoCC_Discrete
53 || proc_type_ == ProcType::AntiNeutrinoCC_Discrete
54 || proc_type_ == ProcType::NeutrinoCC_Continuum
55 || proc_type_ == ProcType::AntiNeutrinoCC_Continuum );
56 return is_cc;
57 }
58
60 struct MultipoleLabel {
61 MultipoleLabel( unsigned J, marley::Parity Pi ) : J_( J ), Pi_( Pi ) {}
62 unsigned J_;
64
67 inline bool operator<( const MultipoleLabel& ml ) const {
68 if ( this->J_ != ml.J_ ) {
69 return ( this->J_ < ml.J_ );
70 }
71 int p1 = static_cast<int>( this->Pi_ );
72 int p2 = static_cast<int>( ml.Pi_ );
73 return p1 < p2;
74 }
75 };
76
77 double diff_xsec( int pdg_a, double KE_a, double omega, double cos_theta,
78 const MultipoleLabel& ml ) const;
79
80 void add_table( unsigned J, marley::Parity Pi,
81 const std::string& file_name );
82
83 inline const ResponseTable& get_table( const MultipoleLabel& ml ) const
84 { return responses_.at( ml ); }
85
86 inline const std::map< MultipoleLabel, ResponseTable >& get_table_map()
87 const { return responses_; }
88
89 double integral( int pdg_a, double KEa, const MultipoleLabel& ml,
90 double& diff_max ) const;
91
92 double integral( int pdg_a, double KEa ) const;
93
94 void optimize( int pdg_a, double max_KEa );
95
96 inline void unoptimize() { optimization_map_.clear(); }
97
102 struct IntegralTerm {
103 IntegralTerm( double w, double ctl, double val ) : omega_( w ),
104 cos_theta_( ctl ), value_( val ) {}
105
106 double omega_;
107 double cos_theta_;
110 double value_;
111 };
112
119 double compute_integral( int pdg_a, double KEa, const MultipoleLabel& ml,
120 double& diff_max,
121 std::vector< IntegralTerm >* integral_terms = nullptr ) const;
122
123 protected:
124
125 struct OptimizationMapKey {
126 OptimizationMapKey( int pdg_a, MultipoleLabel ml )
127 : pdg_a_( pdg_a ), ml_( ml ) {}
128
131 inline bool operator<( const OptimizationMapKey& omk ) const {
132 if ( this->pdg_a_ != omk.pdg_a_ ) {
133 return ( this->pdg_a_ < omk.pdg_a_ );
134 }
135 return this->ml_ < omk.ml_;
136 }
137
138 int pdg_a_;
139 MultipoleLabel ml_;
140 };
141
142 struct OptimizationMapValue {
143 OptimizationMapValue( ChebyshevInterpolatingFunction tot_xsec,
144 ChebyshevInterpolatingFunction max_diff_xsec )
145 : tot_xsec_( tot_xsec ), max_diff_xsec_( max_diff_xsec ) {}
146
148 ChebyshevInterpolatingFunction max_diff_xsec_;
149 };
150
153
156
159
163
165 std::map< MultipoleLabel, ResponseTable > responses_;
166
169 std::map< OptimizationMapKey, OptimizationMapValue > optimization_map_;
170
175 };
176
177}
Approximates a 1D function using Chebyshev points.
CoulombMode
Enumerated type used to set the method for handling Coulomb corrections for CC nuclear reactions.
Type-safe representation of a parity value (either +1 or -1)
Definition Parity.hh:25
ProcessType
Enumerated type describing the kind of scattering process represented by a Reaction.
Definition Reaction.hh:58
A table of nuclear responses for computing inclusive cross sections.
marley::Reaction::ProcessType proc_type_
Kind of process for which the cross section will be computed.
marley::CoulombCorrector::CoulombMode coulomb_mode_
Method to use for computing Coulomb corrections to the cross section.
TargetAtom ta_
Nuclide represented by this table of nuclear responses.
double delta_ias() const
Get the shift used to compute the effective energy transfer.
std::map< OptimizationMapKey, OptimizationMapValue > optimization_map_
std::map< MultipoleLabel, ResponseTable > responses_
Tables of nuclear responses organized by multipole.
double compute_integral(int pdg_a, double KEa, const MultipoleLabel &ml, double &diff_max, std::vector< IntegralTerm > *integral_terms=nullptr) const
Helper function for integral that does the actual integration.
bool is_cc() const
Returns true if this cross section represents a CC process or false otherwise.
An atomic target for a lepton scattering reaction.
Definition TargetAtom.hh:26
double cos_theta_
Energy transfer (MeV)
Simple struct representing a given multipole order, e.g., 2+.
bool operator<(const MultipoleLabel &ml) const
bool operator<(const OptimizationMapKey &omk) const