GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AxialFormFactor.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  Aaron Meyer <asmeyer2012 \at uchicago.edu>
7 
8  based off AxialFormFactor by
9  Costas Andreopoulos <c.andreopoulos \at cern.ch>
10  University of Liverpool
11 */
12 //____________________________________________________________________________
13 
14 #include <string>
15 
20 
21 using std::endl;
22 using std::string;
23 
24 using namespace genie;
25 using namespace genie::utils;
26 
27 //____________________________________________________________________________
28 namespace genie
29 {
30  ostream & operator << (ostream & stream, const AxialFormFactor & ff)
31  {
32  ff.Print(stream);
33  return stream;
34  }
35 }
36 //____________________________________________________________________________
38 {
39  this->Reset();
40 }
41 //____________________________________________________________________________
43 {
44  this->Copy(ff);
45 }
46 //____________________________________________________________________________
48 {
49  this->Reset();
50  this->fModel = model;
51 }
52 //____________________________________________________________________________
53 void AxialFormFactor::Calculate(const Interaction * interaction)
54 {
55  if(!this->fModel)
56  {
57  LOG("AxialFormFactor", pERROR)
58  << "No AxialFormFactorModelI algorithm was defined!";
59  this->Reset("D");
60  }
61  else {
62  this->fFA = this->fModel->FA(interaction);
63  }
64 }
65 //____________________________________________________________________________
66 void AxialFormFactor::Reset(Option_t * opt)
67 {
68 // Reset the AxialFormFactor object (data & attached model). If the input
69 // option = D it resets the data only and not the attached model.
70 
71  this->fFA = 0.;
72 
73  string option(opt);
74  if(option.find("D") == string::npos) {this->fModel = 0;}
75 }
76 //____________________________________________________________________________
78 {
79  this->fModel = ff.fModel;
80  this->fFA = ff.fFA;
81 }
82 //____________________________________________________________________________
84 {
85  return math::AreEqual(this->fFA, ff.fFA);
86 }
87 //____________________________________________________________________________
88 void AxialFormFactor::Print(ostream & stream) const
89 {
90  stream<< endl;
91  stream<< "(FA = " << this->fFA << ") "<< endl;
92 }
93 //____________________________________________________________________________
95 {
96  return this->Compare(ff);
97 }
98 //___________________________________________________________________________
100 {
101  this->Copy(ff);
102  return (*this);
103 }
104 //___________________________________________________________________________
#define pERROR
Definition: Messenger.h:59
bool AreEqual(double x1, double x2)
Definition: MathUtils.cxx:236
Pure abstract base class. Defines the AxialFormFactorModelI interface to be implemented by LlewellynS...
AxialFormFactor & operator=(const AxialFormFactor &ff)
const AxialFormFactorModelI * fModel
void Calculate(const Interaction *interaction)
Calculate the form factors for the input interaction using the attached algorithm.
void SetModel(const AxialFormFactorModelI *model)
Attach an algorithm.
A class holding the Axial Form Factor.
Summary information for an interaction.
Definition: Interaction.h:56
void Print(ostream &stream) const
bool Compare(const AxialFormFactor &ff) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool operator==(const AxialFormFactor &ff) const
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void Copy(const AxialFormFactor &ff)
void Reset(Option_t *opt="")