Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
genie::LocalFGM Class Reference

local Fermi gas model. Implements the NuclearModelI interface. More...

#include <LocalFGM.h>

Inheritance diagram for genie::LocalFGM:
genie::NuclearModelI genie::Algorithm

Public Member Functions

 LocalFGM ()
 
 LocalFGM (string config)
 
virtual ~LocalFGM ()
 
bool GenerateNucleon (const Target &t, double hitNucleonRadius) const
 
double Prob (double p, double w, const Target &t, double hitNucleonRadius) const
 
bool GenerateNucleon (const Target &t) const
 
double Prob (double p, double w, const Target &t) const
 
NuclearModel_t ModelType (const Target &) const
 
virtual double LocalFermiMomentum (const Target &t, int nucleon_pdg, double radius) const
 
void Configure (const Registry &config)
 
void Configure (string param_set)
 
- Public Member Functions inherited from genie::NuclearModelI
virtual ~NuclearModelI ()
 
virtual double FermiMomentum (const Target &, int nucleon_pdg) const
 
double RemovalEnergy (void) const
 
double Momentum (void) const
 
const TVector3 & Momentum3 (void) const
 
FermiMoverInteractionType_t GetFermiMoverInteractionType (void) const
 
void SetMomentum3 (const TVector3 &mom) const
 
void SetRemovalEnergy (double E) const
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Protected Member Functions

void LoadConfig (void)
 
- Protected Member Functions inherited from genie::NuclearModelI
 NuclearModelI ()
 
 NuclearModelI (std::string name)
 
 NuclearModelI (std::string name, std::string config)
 
const stringFermiMomentumTableName () const
 
const genie::FermiMomentumTableFermiMomentumTable () const
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 

Private Member Functions

TH1D * ProbDistro (const Target &t, double r) const
 

Private Attributes

map< int, double > fNucRmvE
 
double fPMax
 
double fSRC_Fraction
 
double fPCutOff
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
- Protected Attributes inherited from genie::NuclearModelI
double fCurrRemovalEnergy
 
TVector3 fCurrMomentum
 
FermiMoverInteractionType_t fFermiMoverInteractionType
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< boolfOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

local Fermi gas model. Implements the NuclearModelI interface.

Author
Joe Johnston, Steven Dytman

December 2015

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 34 of file LocalFGM.h.

Constructor & Destructor Documentation

LocalFGM::LocalFGM ( )

Definition at line 35 of file LocalFGM.cxx.

35  :
36 NuclearModelI("genie::LocalFGM")
37 {
38 
39 }
LocalFGM::LocalFGM ( string  config)

Definition at line 41 of file LocalFGM.cxx.

41  :
42 NuclearModelI("genie::LocalFGM", config)
43 {
44 
45 }
static Config * config
Definition: config.cpp:1054
LocalFGM::~LocalFGM ( )
virtual

Definition at line 47 of file LocalFGM.cxx.

48 {
49 
50 }

Member Function Documentation

void LocalFGM::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 200 of file LocalFGM.cxx.

201 {
202  Algorithm::Configure(config);
203  this->LoadConfig();
204 }
void LoadConfig(void)
Definition: LocalFGM.cxx:212
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void LocalFGM::Configure ( string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 206 of file LocalFGM.cxx.

207 {
208  Algorithm::Configure(param_set);
209  this->LoadConfig();
210 }
void LoadConfig(void)
Definition: LocalFGM.cxx:212
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
bool LocalFGM::GenerateNucleon ( const Target t,
double  hitNucleonRadius 
) const
virtual

Reimplemented from genie::NuclearModelI.

Definition at line 52 of file LocalFGM.cxx.

54 {
55  assert(target.HitNucIsSet());
56 
58  fCurrMomentum.SetXYZ(0,0,0);
59 
60  //-- set fermi momentum vector
61  //
62  TH1D * prob = this->ProbDistro(target,hitNucleonRadius);
63  if(!prob) {
64  LOG("LocalFGM", pNOTICE)
65  << "Null nucleon momentum probability distribution";
66  exit(1);
67  }
68  double p = prob->GetRandom();
69  delete prob;
70  LOG("LocalFGM", pINFO) << "|p,nucleon| = " << p;
71 
73 
74  double costheta = -1. + 2. * rnd->RndGen().Rndm();
75  double sintheta = TMath::Sqrt(1.-costheta*costheta);
76  double fi = 2 * kPi * rnd->RndGen().Rndm();
77  double cosfi = TMath::Cos(fi);
78  double sinfi = TMath::Sin(fi);
79 
80  double px = p*sintheta*cosfi;
81  double py = p*sintheta*sinfi;
82  double pz = p*costheta;
83 
84  fCurrMomentum.SetXYZ(px,py,pz);
85 
86  //-- set removal energy
87  //
88  int Z = target.Z();
90  if(it != fNucRmvE.end()) fCurrRemovalEnergy = it->second;
91  else fCurrRemovalEnergy = nuclear::BindEnergyPerNucleon(target);
92 
93  return true;
94 }
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
intermediate_table::const_iterator const_iterator
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
double BindEnergyPerNucleon(const Target &target)
map< int, double > fNucRmvE
Definition: LocalFGM.h:75
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
#define pINFO
Definition: Messenger.h:62
TH1D * ProbDistro(const Target &t, double r) const
Definition: LocalFGM.cxx:112
TRandom3 & RndGen(void) const
rnd number generator for generic usage
Definition: RandomGen.h:80
#define pNOTICE
Definition: Messenger.h:61
static const double kPi
Definition: Constants.h:37
bool genie::LocalFGM::GenerateNucleon ( const Target t) const
inlinevirtual

Implements genie::NuclearModelI.

Definition at line 50 of file LocalFGM.h.

50  {
51  return GenerateNucleon(t,0.0);
52  }
bool GenerateNucleon(const Target &t, double hitNucleonRadius) const
Definition: LocalFGM.cxx:52
void LocalFGM::LoadConfig ( void  )
protectedvirtual

Reimplemented from genie::NuclearModelI.

Definition at line 212 of file LocalFGM.cxx.

213 {
214 
216 
217  this->GetParamDef("LFG-MomentumMax", fPMax, 1.0);
218  assert(fPMax > 0);
219 
220  this->GetParamDef("SRC-Fraction", fSRC_Fraction, 0.0);
221  this->GetParam("LFG-MomentumCutOff", fPCutOff);
222 
223  if (fPCutOff > fPMax) {
224  LOG("LocalFGM", pFATAL) << "Momentum CutOff greater than Momentum Max";
225  exit(78);
226  }
227 
228 
229  // Load removal energy for specific nuclei from either the algorithm's
230  // configuration file or the UserPhysicsOptions file.
231  // If none is used use Wapstra's semi-empirical formula.
232  //
233 
234  for(int Z=1; Z<140; Z++) {
235  for(int A=Z; A<3*Z; A++) {
236  ostringstream key ;
237  int pdgc = pdg::IonPdgCode(A,Z);
238  key << "RFG-NucRemovalE@Pdg=" << pdgc;
239  RgKey rgkey = key.str();
240  double eb ;
241  if ( GetParam( rgkey, eb, false ) ) {
242  eb = TMath::Max(eb, 0.);
243  LOG("LocalFGM", pINFO) << "Nucleus: " << pdgc << " -> using Eb = " << eb << " GeV";
244  fNucRmvE.insert(map<int,double>::value_type(Z,eb));
245  }
246  }
247  }
248 }
#define pFATAL
Definition: Messenger.h:56
map< int, double > fNucRmvE
Definition: LocalFGM.h:75
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
double fSRC_Fraction
Definition: LocalFGM.h:80
double fPCutOff
Definition: LocalFGM.h:81
#define pINFO
Definition: Messenger.h:62
double fPMax
Definition: LocalFGM.h:77
virtual void LoadConfig()
string RgKey
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:68
#define A
Definition: memgrp.cpp:38
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
double LocalFGM::LocalFermiMomentum ( const Target t,
int  nucleon_pdg,
double  radius 
) const
virtual

Reimplemented from genie::NuclearModelI.

Definition at line 184 of file LocalFGM.cxx.

184  {
185 
186  assert(pdg::IsProton(nucleon_pdg) || pdg::IsNeutron(nucleon_pdg)) ;
187 
188  bool is_p = pdg::IsProton(nucleon_pdg);
189  double numNuc = (double) ( (is_p) ? t.Z() : t.N() );
190 
191  // double hbarc = kLightSpeed*kPlankConstant/genie::units::fermi;
192 
193  double kF = TMath::Power( 3*kPi2*numNuc*genie::utils::nuclear::Density( radius, t.A() ),
194  1.0/3.0 )
196 
197  return kF ;
198 }
double Density(double r, int A, double ring=0.)
int A(void) const
Definition: Target.h:70
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:338
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:333
int Z(void) const
Definition: Target.h:68
int N(void) const
Definition: Target.h:69
static constexpr double fermi
Definition: Units.h:55
static const double kPi2
Definition: Constants.h:38
NuclearModel_t genie::LocalFGM::ModelType ( const Target ) const
inlinevirtual

Implements genie::NuclearModelI.

Definition at line 56 of file LocalFGM.h.

57  {
58  return kNucmLocalFermiGas;
59  }
double LocalFGM::Prob ( double  p,
double  w,
const Target t,
double  hitNucleonRadius 
) const
virtual

Reimplemented from genie::NuclearModelI.

Definition at line 96 of file LocalFGM.cxx.

98 {
99  if(w<0) {
100  TH1D * prob = this->ProbDistro(target, hitNucleonRadius);
101  int bin = prob->FindBin(p);
102  double y = prob->GetBinContent(bin);
103  double dx = prob->GetBinWidth(bin);
104  double pr = y*dx;
105  delete prob;
106  return pr;
107  }
108  return 1;
109 }
p
Definition: test.py:223
TH1D * ProbDistro(const Target &t, double r) const
Definition: LocalFGM.cxx:112
QTextStream & bin(QTextStream &s)
double genie::LocalFGM::Prob ( double  p,
double  w,
const Target t 
) const
inlinevirtual

Implements genie::NuclearModelI.

Definition at line 53 of file LocalFGM.h.

53  {
54  return Prob(p,w,t,0.0);
55  }
double Prob(double p, double w, const Target &t, double hitNucleonRadius) const
Definition: LocalFGM.cxx:96
p
Definition: test.py:223
TH1D * LocalFGM::ProbDistro ( const Target t,
double  r 
) const
private

Definition at line 112 of file LocalFGM.cxx.

113 {
114  LOG("LocalFGM", pNOTICE)
115  << "Computing P = f(p_nucleon) for: " << target.AsString()
116  << ", Nucleon Radius = " << r;
117  LOG("LocalFGM", pNOTICE)
118  << ", P(max) = " << fPMax;
119 
120  assert(target.HitNucIsSet());
121 
122  //-- get information for the nuclear target
123  int nucleon_pdgc = target.HitNucPdg();
124  assert(pdg::IsProton(nucleon_pdgc) || pdg::IsNeutron(nucleon_pdgc));
125 
126  // bool is_p = pdg::IsProton(nucleon_pdgc);
127  // double numNuc = (is_p) ? (double)target.Z():(double)target.N();
128 
129  // Calculate Fermi Momentum using Local FG equations
130  double KF = LocalFermiMomentum( target, nucleon_pdgc, r ) ;
131 
132  LOG("LocalFGM",pNOTICE) << "KF = " << KF;
133 
134  double a = 2.0;
135  double C = 4. * kPi * TMath::Power(KF,3) / 3.;
136 
137  // Do not include nucleon correlation tail
138  //double R = 1. / (1.- KF/4.);
139 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
140  LOG("LocalFGM", pDEBUG) << "a = " << a;
141  LOG("LocalFGM", pDEBUG) << "C = " << C;
142  //LOG("LocalFGM", pDEBUG) << "R = " << R;
143 #endif
144 
145  //-- create the probability distribution
146 
147  int npbins = (int) (1000*fPMax);
148  TH1D * prob = new TH1D("", "", npbins, 0, fPMax);
149  prob->SetDirectory(0);
150 
151  double dp = fPMax / (npbins-1);
152 // double iC = (C>0) ? 1./C : 0.; // unused variables
153 // double kfa_pi_2 = TMath::Power(KF*a/kPi,2); // unused variables
154 
155  for(int i = 0; i < npbins; i++) {
156  double p = i * dp;
157  double p2 = TMath::Power(p,2);
158 
159  // use expression with fSRC_Fraction to allow the possibility of
160  // using the Correlated Fermi Gas Model with a high momentum tail
161 
162  // calculate |phi(p)|^2
163  double phi2 = 0;
164  if (p <= KF){
165  phi2 = (1./(4*kPi)) * (3/TMath::Power(KF,3.)) * ( 1 - fSRC_Fraction );
166  }else if( p > KF && p < fPCutOff ){
167  phi2 = (1./(4*kPi)) * ( fSRC_Fraction / (1./KF - 1./fPCutOff) ) / TMath::Power(p,4.);
168  }
169 
170  // calculate probability density : dProbability/dp
171  double dP_dp = 4*kPi * p2 * phi2;
172 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
173  LOG("LocalFGM", pDEBUG) << "p = " << p << ", dP/dp = " << dP_dp;
174 #endif
175  prob->Fill(p, dP_dp);
176  }
177 
178  //-- normalize the probability distribution
179  prob->Scale( 1.0 / prob->Integral("width") );
180 
181  return prob;
182 }
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:338
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:333
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
const double a
double fSRC_Fraction
Definition: LocalFGM.h:80
double fPCutOff
Definition: LocalFGM.h:81
p
Definition: test.py:223
double fPMax
Definition: LocalFGM.h:77
virtual double LocalFermiMomentum(const Target &t, int nucleon_pdg, double radius) const
Definition: LocalFGM.cxx:184
#define pNOTICE
Definition: Messenger.h:61
static const double kPi
Definition: Constants.h:37
#define pDEBUG
Definition: Messenger.h:63

Member Data Documentation

map<int, double> genie::LocalFGM::fNucRmvE
private

Definition at line 75 of file LocalFGM.h.

double genie::LocalFGM::fPCutOff
private

Definition at line 81 of file LocalFGM.h.

double genie::LocalFGM::fPMax
private

Definition at line 77 of file LocalFGM.h.

double genie::LocalFGM::fSRC_Fraction
private

Definition at line 80 of file LocalFGM.h.


The documentation for this class was generated from the following files: