GiBUURESPXSec.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ June 03, 2009 - CA
14  Was first added in v2.5.1
15 
16 */
17 //____________________________________________________________________________
18 
19 #include <TMath.h>
20 #include <TSystem.h>
21 
22 #include "Algorithm/AlgFactory.h"
24 #include "Base/XSecIntegratorI.h"
27 #include "Conventions/GBuild.h"
28 #include "Conventions/Constants.h"
29 #include "Conventions/RefFrame.h"
30 #include "Conventions/KineVar.h"
31 #include "Conventions/Units.h"
32 #include "Messenger/Messenger.h"
33 #include "Numerical/Spline.h"
34 #include "PDG/PDGCodes.h"
35 #include "PDG/PDGUtils.h"
36 #include "GiBUU/GiBUURESPXSec.h"
37 #include "GiBUU/GiBUUData.h"
38 #include "Utils/KineUtils.h"
39 #include "Utils/MathUtils.h"
40 #include "Utils/Range1.h"
41 
42 using namespace genie;
43 using namespace genie::constants;
44 
45 //____________________________________________________________________________
47 XSecAlgorithmI("genie::GiBUURESPXSec")
48 {
49 
50 }
51 //____________________________________________________________________________
53 XSecAlgorithmI("genie::GiBUURESPXSec", config)
54 {
55 
56 }
57 //____________________________________________________________________________
59 {
60 
61 }
62 //____________________________________________________________________________
64  const Interaction * interaction, KinePhaseSpace_t /*kps*/) const
65 {
66  if(! this -> ValidProcess (interaction) ) return 0.;
67  if(! this -> ValidKinematics (interaction) ) return 0.;
68 
69  double xsec = 0;
70 
71 /*
72  // Get kinematical parameters
73  const Kinematics & kinematics = interaction -> Kine();
74  double W = kinematics.W();
75  double Q2 = kinematics.Q2();
76 
77  // Under the DIS/RES joining scheme, xsec(RES)=0 for W>=Wcut
78  if(fUsingDisResJoin) {
79  if(W>=fWcut) {
80 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
81  LOG("GiBUURes", pDEBUG)
82  << "RES/DIS Join Scheme: XSec[RES, W=" << W
83  << " >= Wcut=" << fWcut << "] = 0";
84 #endif
85  return 0;
86  }
87  }
88 
89  // Get info about the initial state, and procces type
90  const InitialState & init_state = interaction -> InitState();
91  const ProcessInfo & proc_info = interaction -> ProcInfo();
92  const Target & target = init_state.Tgt();
93 
94  double E = init_state.ProbeE(kRfHitNucRest);
95  double Mnuc = target.HitNucMass();
96  int nucpdgc = target.HitNucPdg();
97  int nupdgc = init_state.ProbePdg();
98  bool is_nu = pdg::IsNeutrino (nupdgc);
99  bool is_nubar = pdg::IsAntiNeutrino (nupdgc);
100  bool is_p = pdg::IsProton (nucpdgc);
101  InteractionType_t itype = proc_info.InteractionTypeId();
102 
103  // Get the input baryon resonance
104  Resonance_t resonance = interaction->ExclTag().Resonance();
105  string resname = utils::res::AsString(resonance);
106  bool is_delta = utils::res::IsDelta (resonance);
107 
108 // bool is_CC = proc_info.IsWeakCC();
109 // if(is_CC && !is_delta) {
110 // if((is_nu && is_p) || (is_nubar && is_n)) return 0;
111 // }
112 
113 
114  // Get baryon resonance parameters
115 // fBRP.RetrieveData(resonance);
116 // double Mres = fBRP.Mass();
117 // double Gres = fBRP.Width();
118 // int Nres = fBRP.ResonanceIndex();
119 
120  // Get the GiBUU form factor data
121  GiBUUData * gibuu_data = GiBUUData::Instance();
122 
123  // Calculate the double differential cross section d2sigma/dWdQ2
124 
125  const GiBUUData::FormFactors & ff = gibuu_data->FF();
126  if(is_delta) {
127  //
128  // Delta resonances
129  //
130  double F1V = ff.F1V(Q2, resonance, nucpdgc, itype);
131  double F2V = ff.F2V(Q2, resonance, nucpdgc, itype);
132  double FA = ff.FA (Q2, resonance, nucpdgc, itype);
133  double FP = ff.FP (Q2, resonance, nucpdgc, itype);
134 
135 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
136  LOG("GiBUURes", pINFO)
137  << "\n F1V = " << F1V << ", F2V = " << F2V
138  << ", FA = " << FA << ", FP = " << FP;
139 #endif
140 
141  }
142  else {
143  //
144  // N resonances
145  //
146  double C3V = ff.C3V(Q2, resonance, nucpdgc, itype);
147  double C4V = ff.C4V(Q2, resonance, nucpdgc, itype);
148  double C5V = ff.C5V(Q2, resonance, nucpdgc, itype);
149  double C6V = ff.C6V(Q2, resonance, nucpdgc, itype);
150  double C3A = ff.C3A(Q2, resonance, nucpdgc, itype);
151  double C4A = ff.C4A(Q2, resonance, nucpdgc, itype);
152  double C5A = ff.C5A(Q2, resonance, nucpdgc, itype);
153  double C6A = ff.C6A(Q2, resonance, nucpdgc, itype);
154 
155 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
156  LOG("GiBUURes", pINFO)
157  << "\n C3V = " << C3V << ", C4V = " << C4V
158  << ", C5V = " << C5V << ", C6V = " << C6V
159  << "\n C3A = " << C3A << ", C4A = " << C4A
160  << ", C5A = " << C5A << ", C6A = " << C6A;
161 #endif
162 
163  } // Delta or N
164 
165 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
166  LOG("GiBUURes", pINFO)
167  << "\n d2xsec/dQ2dW" << "[" << interaction->AsString()
168  << "](W=" << W << ", Q2=" << Q2 << ", E=" << E << ") = " << xsec;
169 #endif
170 
171  // The algorithm computes d^2xsec/dWdQ2
172  // Check whether variable tranformation is needed
173  if(kps!=kPSWQ2fE) {
174  double J = utils::kinematics::Jacobian(interaction,kPSWQ2fE,kps);
175  xsec *= J;
176  }
177 
178  // If requested return the free nucleon xsec even for input nuclear tgt
179  if( interaction->TestBit(kIAssumeFreeNucleon) ) return xsec;
180 
181  // Number of scattering centers in the target
182  int NNucl = (is_p) ? target.Z() : target.N();
183  xsec*=NNucl; // nuclear xsec (no nuclear suppression factor)
184 */
185 
186  return xsec;
187 }
188 //____________________________________________________________________________
189 double GiBUURESPXSec::Integral(const Interaction * interaction) const
190 {
191  double xsec = fXSecIntegrator->Integrate(this,interaction);
192  return xsec;
193 }
194 //____________________________________________________________________________
195 bool GiBUURESPXSec::ValidProcess(const Interaction * interaction) const
196 {
197  if(interaction->TestBit(kISkipProcessChk)) return true;
198 
199  const InitialState & init_state = interaction->InitState();
200  const ProcessInfo & proc_info = interaction->ProcInfo();
201  const XclsTag & xcls = interaction->ExclTag();
202 
203  if(!proc_info.IsResonant()) return false;
204  if(!proc_info.IsWeak()) return false;
205 
206  int nuc = init_state.Tgt().HitNucPdg();
207  int nu = init_state.ProbePdg();
208 
209  if (!pdg::IsProton(nuc) && !pdg::IsNeutron(nuc)) return false;
210  if (!pdg::IsNeutrino(nu) && !pdg::IsAntiNeutrino(nu)) return false;
211 
212  if(!xcls.KnownResonance()) return false;
213 
214  return true;
215 }
216 //____________________________________________________________________________
218 {
219  Algorithm::Configure(config);
220  this->LoadConfig();
221 }
222 //____________________________________________________________________________
224 {
225  Algorithm::Configure(config);
226  this->LoadConfig();
227 }
228 //____________________________________________________________________________
230 {
232  const Registry * gc = confp->GlobalParameterList();
233 
234  // Load all configuration data or set defaults
235 
236  double ma = fConfig->GetDoubleDef( "Ma", gc->GetDouble("RES-Ma") );
237  double mv = fConfig->GetDoubleDef( "Mv", gc->GetDouble("RES-Mv") );
238 
239  fMa2 = TMath::Power(ma,2);
240  fMv2 = TMath::Power(mv,2);
241 
242  //-- Use algorithm within a DIS/RES join scheme. If yes get Wcut
244  "UseDRJoinScheme", gc->GetBool("UseDRJoinScheme"));
245  fWcut = 999999;
246  if(fUsingDisResJoin) {
247  fWcut = fConfig->GetDoubleDef("Wcut",gc->GetDouble("Wcut"));
248  }
249 
250  //-- load the differential cross section integrator
252  dynamic_cast<const XSecIntegratorI *> (this->SubAlg("XSec-Integrator"));
253  assert(fXSecIntegrator);
254 }
255 //____________________________________________________________________________
256 
double XSec(const Interaction *i, KinePhaseSpace_t k) const
Compute the cross section for the input interaction.
bool IsResonant(void) const
Cross Section Calculation Interface.
RgDbl GetDoubleDef(RgKey key, RgDbl def_opt, bool set_def=true)
Definition: Registry.cxx:549
Basic constants.
bool IsWeak(void) const
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:121
#include "Numerical/GSFunc.h"
Definition: AlgCmp.h:26
Cross Section Integrator Interface.
int HitNucPdg(void) const
Definition: Target.cxx:311
bool KnownResonance(void) const
Definition: XclsTag.h:61
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Definition: AlgConfigPool.h:41
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:488
enum genie::EKinePhaseSpace KinePhaseSpace_t
bool fUsingDisResJoin
use a DIS/RES joining scheme?
Definition: GiBUURESPXSec.h:58
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:37
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:311
Summary information for an interaction.
Definition: Interaction.h:53
virtual bool ValidKinematics(const Interaction *i) const
Is the input kinematical point a physically allowed one?
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:306
double fMa2
(axial mass)^2
Definition: GiBUURESPXSec.h:56
double Integral(const Interaction *i) const
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:41
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:129
virtual void Configure(const Registry &config)
Configure the algorithm.
Definition: Algorithm.cxx:70
int ProbePdg(void) const
Definition: InitialState.h:54
Registry * GlobalParameterList(void) const
const XSecIntegratorI * fXSecIntegrator
Definition: GiBUURESPXSec.h:61
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
const XclsTag & ExclTag(void) const
Definition: Interaction.h:69
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:474
virtual double Integrate(const XSecAlgorithmI *model, const Interaction *interaction) const =0
Registry * fConfig
config. (either owned or pointing to config pool)
Definition: Algorithm.h:122
const InitialState & InitState(void) const
Definition: Interaction.h:66
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:67
bool ValidProcess(const Interaction *i) const
Can this cross section algorithm handle the input process?
const Target & Tgt(void) const
Definition: InitialState.h:56
double fWcut
apply DIS/RES joining scheme < Wcut
Definition: GiBUURESPXSec.h:59
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
RgBool GetBoolDef(RgKey key, RgBool def_opt, bool set_def=true)
Definition: Registry.cxx:539
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:44
static AlgConfigPool * Instance()
double fMv2
(vector mass)^2
Definition: GiBUURESPXSec.h:57
void Configure(const Registry &config)
Configure the algorithm.
Initial State information.
Definition: InitialState.h:42
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:230