GENIEGenerator
Loading...
Searching...
No Matches
IBDXSecMap.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Corey Reed <cjreed \at nikhef.nl>
7 Nikhef
8*/
9//____________________________________________________________________________
10
11#include "IBDXSecMap.h"
12
17
18#include <sstream>
19
20using namespace genie;
21
23
24//____________________________________________________________________________
26 XSecAlgorithmI("genie::IBDXSecMap"),
27 fDefaultModel(0)
28{
29
30}
31//____________________________________________________________________________
32IBDXSecMap::IBDXSecMap(string config) :
33 XSecAlgorithmI("genie::IBDXSecMap", config),
35{
36
37}
38//____________________________________________________________________________
43
44//____________________________________________________________________________
45void IBDXSecMap::Configure(const Registry & config)
46{
48 this->LoadConfig();
49}
50//____________________________________________________________________________
51void IBDXSecMap::Configure(string config)
52{
54 this->LoadConfig();
55}
56//____________________________________________________________________________
58{
59 // build the default xsec model according to the options contained
60 // in IBDXSecMap.xml and/or UserPhysicsOptions.xml
61
62 // load default global model (should work for all nuclei)
63 RgAlg dgmodel ;
64 GetParam( "IBDNucXSecModel", dgmodel ) ;
65 LOG("IBD", pINFO)
66 << "Default IBD cross section model: " << dgmodel;
67
69 dynamic_cast<const XSecAlgorithmI*>( this -> SubAlg("IBDNucXSecModel") );
70 assert(fDefaultModel!=0);
71
72 // check whether to map according to specific isotopes
73 GetParam("IsotopesUseSameModel", fIsotopesUseSameModel ) ;
74
75 // load refined models for specific nuclei
76 for(int Z=1; Z<140; Z++) {
77 for(int A=Z; A<3*Z; A++) {
78 std::ostringstream key;
79 const int nucpdg = pdg::IonPdgCode(A,Z);
80 key << "IBDNucXSecModel@Pdg=" << nucpdg;
81 RgKey rgkey = key.str();
82 if ( GetConfig().Exists(rgkey) ) {
83 RgAlg rgmodel = GetConfig().GetAlg(rgkey);
84 LOG("IBD", pNOTICE)
85 << "Nucleus =" << nucpdg
86 << " -> refined nuclear model: " << rgmodel;
87 const XSecAlgorithmI* model =
88 dynamic_cast<const XSecAlgorithmI*>(this->SubAlg(rgkey));
89 assert(model);
90 const int mapkeyval = (fIsotopesUseSameModel) ? Z : nucpdg;
92 insert(map<int,const XSecAlgorithmI*>::value_type(mapkeyval,
93 model));
94 }
95 }
96 }
97}
98//____________________________________________________________________________
100{
101 // search the map for the PDG code of the target
102 // if a refined model is found, return it
103 // otherwise return the default xsec model
104
105 map<int,const XSecAlgorithmI*>::const_iterator it = fRefinedModels.find(t.Pdg());
106
107 if(it != fRefinedModels.end()) return it->second;
108 else return fDefaultModel;
109}
110//____________________________________________________________________________
112{
113 const XSecAlgorithmI* xs = this->SelectModel(i->InitState().Tgt());
114 if (xs!=0) {
115 return xs->XSec(i, k);
116 } else {
117 LOG("IBD", pERROR) << "No IBD XSec model found for target "
118 << i->InitState().TgtPdg();
119 return 0;
120 }
121}
122//____________________________________________________________________________
123double IBDXSecMap::Integral(const Interaction * i) const
124{
125 const XSecAlgorithmI* xs = this->SelectModel(i->InitState().Tgt());
126 if (xs!=0) {
127 return xs->Integral(i);
128 } else {
129 LOG("IBD", pERROR) << "No IBD XSec model found for target "
130 << i->InitState().TgtPdg();
131 return 0;
132 }
133}
134//____________________________________________________________________________
136{
137 const XSecAlgorithmI* xs = this->SelectModel(i->InitState().Tgt());
138 if (xs!=0) {
139 return xs->ValidProcess(i);
140 } else {
141 LOG("IBD", pERROR) << "No IBD XSec model found for target "
142 << i->InitState().TgtPdg();
143 return 0;
144 }
145}
146//____________________________________________________________________________
148{
149 const XSecAlgorithmI* xs = this->SelectModel(i->InitState().Tgt());
150 if (xs!=0) {
151 return xs->ValidKinematics(i);
152 } else {
153 LOG("IBD", pERROR) << "No IBD XSec model found for target "
154 << i->InitState().TgtPdg();
155 return 0;
156 }
157}
ClassImp(IBDXSecMap) IBDXSecMap
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define pERROR
Definition Messenger.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
string RgKey
virtual const Registry & GetConfig(void) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
const Algorithm * SubAlg(const RgKey &registry_key) const
Maps specific nuclei to appropriate cross section models.
Definition IBDXSecMap.h:25
double XSec(const Interaction *i, KinePhaseSpace_t k) const
Compute the cross section for the input interaction.
bool ValidKinematics(const Interaction *i) const
Is the input kinematical point a physically allowed one?
bool fIsotopesUseSameModel
Definition IBDXSecMap.h:49
const XSecAlgorithmI * fDefaultModel
Definition IBDXSecMap.h:50
void Configure(const Registry &config)
void LoadConfig(void)
const XSecAlgorithmI * SelectModel(const Target &t) const
double Integral(const Interaction *i) const
virtual ~IBDXSecMap()
std::map< int, const XSecAlgorithmI * > fRefinedModels
Definition IBDXSecMap.h:51
bool ValidProcess(const Interaction *i) const
Can this cross section algorithm handle the input process?
int TgtPdg(void) const
const Target & Tgt(void) const
Summary information for an interaction.
Definition Interaction.h:56
const InitialState & InitState(void) const
Definition Interaction.h:69
A registry. Provides the container for algorithm configuration parameters.
Definition Registry.h:65
RgAlg GetAlg(RgKey key) const
Definition Registry.cxx:488
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition Target.h:40
int Pdg(void) const
Definition Target.h:71
Cross Section Calculation Interface.
virtual bool ValidKinematics(const Interaction *i) const
Is the input kinematical point a physically allowed one?
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
virtual double Integral(const Interaction *i) const =0
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
int IonPdgCode(int A, int Z)
Definition PDGUtils.cxx:71
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
enum genie::EKinePhaseSpace KinePhaseSpace_t