GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QELFormFactors.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <c.andreopoulos \at cern.ch>
7  University of Liverpool
8 */
9 //____________________________________________________________________________
10 
11 #include <string>
12 
16 
17 using namespace genie;
18 using namespace genie::utils;
19 
20 using std::endl;
21 using std::string;
22 
23 //____________________________________________________________________________
24 namespace genie
25 {
26  ostream & operator << (ostream & stream, const QELFormFactors & ff)
27  {
28  ff.Print(stream);
29  return stream;
30  }
31 }
32 //____________________________________________________________________________
34 {
35  this->Reset();
36 }
37 //____________________________________________________________________________
39 {
40  this->Copy(form_factors);
41 }
42 //____________________________________________________________________________
44 {
45  this->Reset();
46  this->fModel = model;
47 }
48 //____________________________________________________________________________
49 void QELFormFactors::Calculate(const Interaction * interaction)
50 {
51  if(!this->fModel) {
52  LOG("QELFF",pERROR)
53  << "No QELFormFactorsModelI attached. Can not calculate FF's";
54  this->Reset("D");
55  return;
56  }
57 
58  this -> fF1V = fModel -> F1V (interaction);
59  this -> fxiF2V = fModel -> xiF2V (interaction);
60  this -> fFA = fModel -> FA (interaction);
61  this -> fFp = fModel -> Fp (interaction);
62 }
63 //____________________________________________________________________________
64 void QELFormFactors::Reset(Option_t * opt)
65 {
66 // Reset the QELFormFactors object (data & attached model). If the input
67 // option = D it resets the data only and not the attached model.
68 
69  this->fF1V = 0;
70  this->fxiF2V = 0;
71  this->fFA = 0;
72  this->fFp = 0;
73 
74  string option(opt);
75  if(option.find("D") == string::npos) {this->fModel = 0;}
76 }
77 //____________________________________________________________________________
79 {
80  this->fModel = ff.fModel;
81 
82  this->fF1V = ff.fF1V;
83  this->fxiF2V = ff.fxiF2V;
84  this->fFA = ff.fFA;
85  this->fFp = ff.fFp;
86 }
87 //____________________________________________________________________________
89 {
90  bool equal =
91  math::AreEqual(this->fF1V, ff.fF1V) &&
92  math::AreEqual(this->fxiF2V, ff.fxiF2V) &&
93  math::AreEqual(this->fFA, ff.fFA) &&
94  math::AreEqual(this->fFp, ff.fFp);
95  return equal;
96 }
97 //____________________________________________________________________________
98 void QELFormFactors::Print(ostream & stream) const
99 {
100  stream << endl;
101  stream << "F1V = " << this->fF1V << endl;
102  stream << "xi*F2V = " << this->fxiF2V << endl;
103  stream << "FA = " << this->fFA << endl;
104  stream << "Fp = " << this->fFp << endl;
105 }
106 //____________________________________________________________________________
108 {
109  return this->Compare(ff);
110 }
111 //___________________________________________________________________________
113 {
114  this->Copy(ff);
115  return (*this);
116 }
117 //___________________________________________________________________________
const QELFormFactorsModelI * fModel
A class holding Quasi Elastic (QEL) Form Factors.
#define pERROR
Definition: Messenger.h:59
void Reset(Option_t *opt="")
bool AreEqual(double x1, double x2)
Definition: MathUtils.cxx:236
void SetModel(const QELFormFactorsModelI *model)
Attach an algorithm.
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:96
Pure abstract base class. Defines the QELFormFactorsModelI interface to be implemented by any algorit...
void Calculate(const Interaction *interaction)
Compute the form factors for the input interaction using the attached model.
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
QELFormFactors & operator=(const QELFormFactors &ff)
bool Compare(const QELFormFactors &ff) const
void Print(ostream &stream) const
bool operator==(const QELFormFactors &ff) const