GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gtestDISSF.cxx File Reference
#include <string>
#include <TFile.h>
#include <TTree.h>
#include "Framework/Algorithm/Algorithm.h"
#include "Framework/Algorithm/AlgFactory.h"
#include "Physics/DeepInelastic/XSection/DISStructureFunc.h"
#include "Physics/DeepInelastic/XSection/DISStructureFuncModelI.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/ParticleData/PDGCodes.h"
#include "Framework/Utils/CmdLnArgParser.h"
Include dependency graph for gtestDISSF.cxx:

Go to the source code of this file.

Functions

void GetCommandLineArgs (int argc, char **argv)
 
void PrintSyntax (void)
 
void BuildStdNtuple (void)
 
void VerticalSlice (void)
 
int main (int argc, char **argv)
 

Variables

int gMode = 1
 
double gX = 0
 
double gQ2 = 0
 
string gDISSFAlg = ""
 
string gDISSFConfig = ""
 

Function Documentation

void BuildStdNtuple ( void  )

Definition at line 71 of file gtestDISSF.cxx.

References genie::DISStructureFunc::Calculate(), genie::Interaction::DISCC(), genie::DISStructureFunc::F1(), genie::DISStructureFunc::F2(), genie::DISStructureFunc::F3(), genie::DISStructureFunc::F4(), genie::DISStructureFunc::F5(), gDISSFAlg, gDISSFConfig, genie::AlgFactory::GetAlgorithm(), genie::AlgFactory::Instance(), genie::Interaction::KinePtr(), genie::kPdgAntiNuE, genie::kPdgAntiNuMu, genie::kPdgAntiNuTau, genie::kPdgNeutron, genie::kPdgNuE, genie::kPdgNuMu, genie::kPdgNuTau, genie::kPdgProton, genie::kPdgTgtFe56, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, genie::utils::kinematics::Q2(), genie::DISStructureFunc::SetModel(), genie::Kinematics::SetQ2(), and genie::Kinematics::Setx().

Referenced by main().

72 {
73  // -- define initial states & x,Q2 values to compute the DIS SFs
74  const int kNNu = 6;
75  const int kNNuc = 2;
76  const int kNTgt = 3;
77  const int kNX = 12;
78  const int kNQ2 = 60;
79 
80  int neutrino [kNNu] = { kPdgNuE, kPdgAntiNuE, kPdgNuMu, kPdgAntiNuMu, kPdgNuTau, kPdgAntiNuTau };
81  int hit_nucleon [kNNuc] = { kPdgProton, kPdgNeutron };
82  int target [kNTgt] = { kPdgTgtFreeP, kPdgTgtFreeN, kPdgTgtFe56 };
83 
84  double xbj[kNX] = {
85  0.0150, 0.0450, 0.0800, 0.1250, 0.1750, 0.2250,
86  0.2750, 0.3500, 0.4500, 0.5500, 0.6500, 0.7500
87  };
88  double Q2[kNQ2] = {
89  0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0,
90  3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
91  13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0,
92  23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 42.0,
93  33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 52.0,
94  43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 62.0
95  };
96 
97  // -- request the specified DIS SF model
98  AlgFactory * algf = AlgFactory::Instance();
99  const DISStructureFuncModelI * dissf_model =
100  dynamic_cast<const DISStructureFuncModelI *> (
102  assert(dissf_model);
103 
104  // -- create a structure functions objects and attach the specified model
105  DISStructureFunc dissf;
106  dissf.SetModel(dissf_model);
107 
108  // -- define the outout TTree
109  TTree * dissf_nt = new TTree("dissf_nt","DIS SF");
110  int brNu; // event number
111  int brNuc; // hit nucleon PDG code
112  int brTgt; // neutrino PDG code
113  double brXbj; //
114  double brQ2; //
115  double brF1; //
116  double brF2; //
117  double brF3; //
118  double brF4; //
119  double brF5; //
120  dissf_nt->Branch("nu", &brNu, "nu/I");
121  dissf_nt->Branch("nuc", &brNuc, "nuc/I");
122  dissf_nt->Branch("tgt", &brTgt, "tgt/I");
123  dissf_nt->Branch("x", &brXbj, "x/D");
124  dissf_nt->Branch("Q2", &brQ2, "Q2/D");
125  dissf_nt->Branch("F1", &brF1, "F1/D");
126  dissf_nt->Branch("F2", &brF2, "F2/D");
127  dissf_nt->Branch("F3", &brF3, "F3/D");
128  dissf_nt->Branch("F4", &brF4, "F4/D");
129  dissf_nt->Branch("F5", &brF5, "F5/D");
130 
131  // -- loop over the initial states
132  for(int inu=0; inu<kNNu; inu++) {
133  for(int inuc=0; inuc<kNNuc; inuc++) {
134  for(int itgt=0; itgt<kNTgt; itgt++) {
135 
136  // -- get a DIS interaction object & access its kinematics
137  Interaction * interaction = Interaction::DISCC(
138  target[itgt],hit_nucleon[inuc],neutrino[inu]);
139  Kinematics * kine = interaction->KinePtr();
140 
141  // -- loop over x,Q2
142  for(int ix=0; ix<kNX; ix++) {
143  for(int iq=0; iq<kNQ2; iq++) {
144 
145  // update the interaction kinematics
146  kine->Setx(xbj[ix]);
147  kine->SetQ2(Q2[iq]);
148 
149  // calculate the structure functions for the input interaction
150  dissf.Calculate(interaction);
151 
152  // update all tree branches & save
153  brNu = neutrino[inu];
154  brNuc = hit_nucleon[inuc];
155  brTgt = target[itgt];
156  brXbj = xbj[ix];
157  brQ2 = Q2[iq];
158  brF1 = dissf.F1();
159  brF2 = dissf.F2();
160  brF3 = dissf.F3();
161  brF4 = dissf.F4();
162  brF5 = dissf.F5();
163  dissf_nt->Fill();
164  }//Q2
165  }//x
166 
167  delete interaction;
168 
169  }//tgt
170  }//nuc
171  }//nu
172 
173  TFile f("./dissf.root","recreate");
174  dissf_nt->Write();
175  f.Close();
176 }
void SetModel(const DISStructureFuncModelI *model)
Attach an algorithm.
Pure Abstract Base Class. Defines the DISStructureFuncModelI interface to be implemented by any algor...
string gDISSFAlg
Definition: gtestDISSF.cxx:56
const int kPdgNuE
Definition: PDGCodes.h:28
double F2(void) const
Get the computed structure function F2.
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 kPdgAntiNuE
Definition: PDGCodes.h:29
const int kPdgNuMu
Definition: PDGCodes.h:30
Generated/set kinematical variables for an event.
Definition: Kinematics.h:39
double F4(void) const
Get the computed structure function F4.
string gDISSFConfig
Definition: gtestDISSF.cxx:57
Summary information for an interaction.
Definition: Interaction.h:56
double F1(void) const
Get the computed structure function F1.
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
const int kPdgTgtFreeN
Definition: PDGCodes.h:200
const int kPdgTgtFreeP
Definition: PDGCodes.h:199
const int kPdgAntiNuTau
Definition: PDGCodes.h:33
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
double F5(void) const
Get the computed structure function F5.
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:231
A class holding Deep Inelastic Scattering (DIS) Form Factors (invariant structure funstions) ...
double F3(void) const
Get the computed structure function F3.
const int kPdgNuTau
Definition: PDGCodes.h:32
const int kPdgTgtFe56
Definition: PDGCodes.h:205
void Calculate(const Interaction *interaction)
Calculate the S/F&#39;s for the input interaction using the attached algorithm.
const int kPdgProton
Definition: PDGCodes.h:81
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
const int kPdgNeutron
Definition: PDGCodes.h:83
void GetCommandLineArgs ( int  argc,
char **  argv 
)
int main ( int  argc,
char **  argv 
)

Definition at line 60 of file gtestDISSF.cxx.

References BuildStdNtuple(), GetCommandLineArgs(), gMode, and VerticalSlice().

61 {
62  // -- parse the command line arguments (model choice,...)
63  GetCommandLineArgs(argc,argv);
64 
65  if(gMode==1) BuildStdNtuple();
66  if(gMode==2) VerticalSlice ();
67 
68  return 0;
69 }
void VerticalSlice(void)
Definition: gtestDISSF.cxx:178
void BuildStdNtuple(void)
Definition: gtestDISSF.cxx:71
void GetCommandLineArgs(int argc, char **argv)
Definition: gAtmoEvGen.cxx:563
int gMode
Definition: gtestDISSF.cxx:53
void PrintSyntax ( void  )
void VerticalSlice ( void  )

Definition at line 178 of file gtestDISSF.cxx.

References genie::DISStructureFunc::Calculate(), genie::Interaction::DISCC(), gDISSFAlg, gDISSFConfig, genie::AlgFactory::GetAlgorithm(), gQ2, gX, genie::AlgFactory::Instance(), genie::Messenger::Instance(), genie::Interaction::KinePtr(), genie::kPdgAntiNuMu, genie::kPdgNeutron, genie::kPdgNuMu, genie::kPdgProton, genie::kPdgTgtFe56, LOG, pDEBUG, pNOTICE, genie::DISStructureFunc::SetModel(), genie::Messenger::SetPriorityLevel(), genie::Kinematics::SetQ2(), and genie::Kinematics::Setx().

Referenced by main().

179 {
180  // manual override of Registry mesg level for more verbose output
181  Messenger * msg = Messenger::Instance();
182  msg->SetPriorityLevel("DISSF", pDEBUG);
183  msg->SetPriorityLevel("BodekYang", pDEBUG);
184  msg->SetPriorityLevel("LHAPDF5", pDEBUG);
185 
186  // -- request the specified DIS SF model
187  AlgFactory * algf = AlgFactory::Instance();
188  const DISStructureFuncModelI * dissf_model =
189  dynamic_cast<const DISStructureFuncModelI *> (
191  assert(dissf_model);
192 
193  // -- create a structure functions objects and attach the specified model
194  DISStructureFunc dissf;
195  dissf.SetModel(dissf_model);
196 
197  const int kNNu = 2;
198  const int kNNuc = 2;
199  const int kNTgt = 1;
200 
201  int neutrino [kNNu] = { kPdgNuMu, kPdgAntiNuMu };
202  int hit_nucleon [kNNuc] = { kPdgProton, kPdgNeutron };
203  int target [kNTgt] = { kPdgTgtFe56 };
204 
205  for(int inu=0; inu<kNNu; inu++) {
206  for(int inuc=0; inuc<kNNuc; inuc++) {
207  for(int itgt=0; itgt<kNTgt; itgt++) {
208 
209  // -- get a DIS interaction object & access its kinematics
210  Interaction * interaction = Interaction::DISCC(
211  target[itgt],hit_nucleon[inuc],neutrino[inu]);
212  Kinematics * kine = interaction->KinePtr();
213  kine->Setx(gX);
214  kine->SetQ2(gQ2);
215 
216  LOG("test", pNOTICE) << "*** Vertical SF slice for: ";
217  LOG("test", pNOTICE) << *interaction;
218 
219  // calculate the structure functions for the input interaction
220  dissf.Calculate(interaction);
221 
222  LOG("test", pNOTICE) << dissf;
223 
224  delete interaction;
225  }
226  }
227  }
228 
229  // print algorithms & heir configurations
230  LOG("test", pNOTICE) << *algf;
231 }
void SetModel(const DISStructureFuncModelI *model)
Attach an algorithm.
Pure Abstract Base Class. Defines the DISStructureFuncModelI interface to be implemented by any algor...
string gDISSFAlg
Definition: gtestDISSF.cxx:56
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
Generated/set kinematical variables for an event.
Definition: Kinematics.h:39
string gDISSFConfig
Definition: gtestDISSF.cxx:57
Summary information for an interaction.
Definition: Interaction.h:56
double gX
Definition: gtestDISSF.cxx:54
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
A more convenient interface to the log4cpp Message Service.
Definition: Messenger.h:258
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:231
A class holding Deep Inelastic Scattering (DIS) Form Factors (invariant structure funstions) ...
void SetPriorityLevel(const char *stream, log4cpp::Priority::Value p)
Definition: Messenger.cxx:88
double gQ2
Definition: gtestDISSF.cxx:55
const int kPdgTgtFe56
Definition: PDGCodes.h:205
void Calculate(const Interaction *interaction)
Calculate the S/F&#39;s for the input interaction using the attached algorithm.
const int kPdgProton
Definition: PDGCodes.h:81
#define pNOTICE
Definition: Messenger.h:61
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
const int kPdgNeutron
Definition: PDGCodes.h:83
#define pDEBUG
Definition: Messenger.h:63

Variable Documentation

string gDISSFAlg = ""

Definition at line 56 of file gtestDISSF.cxx.

Referenced by BuildStdNtuple(), and VerticalSlice().

string gDISSFConfig = ""

Definition at line 57 of file gtestDISSF.cxx.

Referenced by BuildStdNtuple(), and VerticalSlice().

int gMode = 1

Definition at line 53 of file gtestDISSF.cxx.

Referenced by main().

double gQ2 = 0
double gX = 0

Definition at line 54 of file gtestDISSF.cxx.

Referenced by VerticalSlice().