QELFormFactors.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE 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 
14 */
15 //____________________________________________________________________________
16 
17 #include <string>
18 
22 
23 using namespace genie;
24 using namespace genie::utils;
25 
26 using std::endl;
27 using std::string;
28 
29 //____________________________________________________________________________
30 namespace genie
31 {
32  ostream & operator << (ostream & stream, const QELFormFactors & ff)
33  {
34  ff.Print(stream);
35  return stream;
36  }
37 }
38 //____________________________________________________________________________
40 {
41  this->Reset();
42 }
43 //____________________________________________________________________________
45 {
46  this->Copy(form_factors);
47 }
48 //____________________________________________________________________________
50 {
51  this->Reset();
52  this->fModel = model;
53 }
54 //____________________________________________________________________________
55 void QELFormFactors::Calculate(const Interaction * interaction)
56 {
57  if(!this->fModel) {
58  LOG("QELFF",pERROR)
59  << "No QELFormFactorsModelI attached. Can not calculate FF's";
60  this->Reset("D");
61  return;
62  }
63 
64  this -> fF1V = fModel -> F1V (interaction);
65  this -> fxiF2V = fModel -> xiF2V (interaction);
66  this -> fFA = fModel -> FA (interaction);
67  this -> fFp = fModel -> Fp (interaction);
68 }
69 //____________________________________________________________________________
70 void QELFormFactors::Reset(Option_t * opt)
71 {
72 // Reset the QELFormFactors object (data & attached model). If the input
73 // option = D it resets the data only and not the attached model.
74 
75  this->fF1V = 0;
76  this->fxiF2V = 0;
77  this->fFA = 0;
78  this->fFp = 0;
79 
80  string option(opt);
81  if(option.find("D") == string::npos) {this->fModel = 0;}
82 }
83 //____________________________________________________________________________
85 {
86  this->fModel = ff.fModel;
87 
88  this->fF1V = ff.fF1V;
89  this->fxiF2V = ff.fxiF2V;
90  this->fFA = ff.fFA;
91  this->fFp = ff.fFp;
92 }
93 //____________________________________________________________________________
95 {
96  bool equal =
97  math::AreEqual(this->fF1V, ff.fF1V) &&
98  math::AreEqual(this->fxiF2V, ff.fxiF2V) &&
99  math::AreEqual(this->fFA, ff.fFA) &&
100  math::AreEqual(this->fFp, ff.fFp);
101  return equal;
102 }
103 //____________________________________________________________________________
104 void QELFormFactors::Print(ostream & stream) const
105 {
106  stream << endl;
107  stream << "F1V = " << this->fF1V << endl;
108  stream << "xi*F2V = " << this->fxiF2V << endl;
109  stream << "FA = " << this->fFA << endl;
110  stream << "Fp = " << this->fFp << endl;
111 }
112 //____________________________________________________________________________
114 {
115  return this->Compare(ff);
116 }
117 //___________________________________________________________________________
119 {
120  this->Copy(ff);
121  return (*this);
122 }
123 //___________________________________________________________________________
124 
125 
const QELFormFactorsModelI * fModel
A class holding Quasi Elastic (QEL) Form Factors.
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
#define pERROR
Definition: Messenger.h:60
void Reset(Option_t *opt="")
bool AreEqual(double x1, double x2)
Definition: MathUtils.cxx:243
void SetModel(const QELFormFactorsModelI *model)
Attach an algorithm.
bool equal(T *first, T *second)
void Compare(const std::vector< TH1 * > &hs)
ostream & operator<<(ostream &stream, const T2KEvGenMetaData &md)
Summary information for an interaction.
Definition: Interaction.h:56
void Copy(const QELFormFactors &ff)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Pure abstract base class. Defines the QELFormFactorsModelI interface to be implemented by any algorit...
static keras::KerasModel * fModel
void Reset()
void Calculate(const Interaction *interaction)
Compute the form factors for the input interaction using the attached model.
QELFormFactors & operator=(const QELFormFactors &ff)
bool Compare(const QELFormFactors &ff) const
void Print(ostream &stream) const
TFile ff[ntarg]
Definition: Style.C:26
bool operator==(const QELFormFactors &ff) const
const XML_Char XML_Content * model
Definition: expat.h:151
Root of GENIE utility namespaces.
enum BeamMode string