GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gtestElFormFactors.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \program gtestElFormFactors
5 
6 \brief Program used for testing / debugging the elastic form factors
7 
8 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9  University of Liverpool
10 
11 \created June 20, 2004
12 
13 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 
16 */
17 //____________________________________________________________________________
18 
19 #include <string>
20 
21 #include <TFile.h>
22 #include <TNtupleD.h>
23 
31 
32 using namespace genie;
33 using std::string;
34 
35 //__________________________________________________________________________
36 int main(int /*argc*/, char ** /*argv*/)
37 {
38  TNtupleD * elffnt = new TNtupleD("elffnt","","Q2:mod:Gep:Gmp:Gen:Gmn");
39 
41 
42  const ELFormFactorsModelI * dipole =
43  dynamic_cast<const ELFormFactorsModelI *> (
44  algf->GetAlgorithm("genie::DipoleELFormFactorsModel", "Default"));
45  const ELFormFactorsModelI * bba2003 =
46  dynamic_cast<const ELFormFactorsModelI *> (
47  algf->GetAlgorithm("genie::BBA03ELFormFactorsModel", "Default"));
48  const ELFormFactorsModelI * bba2005 =
49  dynamic_cast<const ELFormFactorsModelI *> (
50  algf->GetAlgorithm("genie::BBA05ELFormFactorsModel", "Default"));
51 
52  ELFormFactors elff;
53 
54  Interaction * interaction =
56 
57  for(int iq=0; iq<100; iq++) {
58 
59  double Q2 = iq*0.01 + 0.01;
60  interaction->KinePtr()->SetQ2(Q2);
61 
62  elff.SetModel(dipole);
63  elff.Calculate(interaction);
64  elffnt->Fill(Q2,0,elff.Gep(),elff.Gmp(),elff.Gen(),elff.Gmn());
65 
66  elff.SetModel(bba2003);
67  elff.Calculate(interaction);
68  elffnt->Fill(Q2,1,elff.Gep(),elff.Gmp(),elff.Gen(),elff.Gmn());
69 
70  elff.SetModel(bba2005);
71  elff.Calculate(interaction);
72  elffnt->Fill(Q2,2,elff.Gep(),elff.Gmp(),elff.Gen(),elff.Gmn());
73  }
74 
75  TFile f("./elff.root","recreate");
76  elffnt->Write();
77  f.Close();
78 
79  return 0;
80 }
81 //__________________________________________________________________________
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
void SetQ2(double Q2, bool selected=false)
Definition: Kinematics.cxx:255
Kinematics * KinePtr(void) const
Definition: Interaction.h:76
const int kPdgNuMu
Definition: PDGCodes.h:30
static Interaction * QELCC(int tgt, int nuc, int probe, double E=0)
double Gen(void) const
Get the computed form factor Gen.
Definition: ELFormFactors.h:56
int main(int argc, char **argv)
Definition: gAtmoEvGen.cxx:327
Summary information for an interaction.
Definition: Interaction.h:56
Pure abstract base class. Defines the ELFormFactorsModelI interface to be implemented by any algorith...
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
void Calculate(const Interaction *interaction)
Calculate the form factors for the input interaction using the attached algorithm.
A class holding the Elastic Form Factors Ge,Gm.
Definition: ELFormFactors.h:36
double Gmn(void) const
Get the computed form factor Gmn.
Definition: ELFormFactors.h:59
static AlgFactory * Instance()
Definition: AlgFactory.cxx:64
double Gmp(void) const
Get the computed form factor Gmp.
Definition: ELFormFactors.h:53
double Gep(void) const
Get the computed form factor Gep.
Definition: ELFormFactors.h:50
const int kPdgTgtFe56
Definition: PDGCodes.h:205
const int kPdgProton
Definition: PDGCodes.h:81
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
void SetModel(const ELFormFactorsModelI *model)
Attach an algorithm.
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...