Public Member Functions | Private Attributes | Friends | List of all members
genie::ELFormFactors Class Reference

A class holding the Elastic Form Factors Ge,Gm. More...

#include <ELFormFactors.h>

Public Member Functions

 ELFormFactors ()
 
 ELFormFactors (const ELFormFactors &form_factors)
 
virtual ~ELFormFactors ()
 
void SetModel (const ELFormFactorsModelI *model)
 Attach an algorithm. More...
 
void Calculate (const Interaction *interaction)
 Calculate the form factors for the input interaction using the attached algorithm. More...
 
double Gep (void) const
 Get the computed form factor Gep. More...
 
double Gmp (void) const
 Get the computed form factor Gmp. More...
 
double Gen (void) const
 Get the computed form factor Gen. More...
 
double Gmn (void) const
 Get the computed form factor Gmn. More...
 
const ELFormFactorsModelIModel (void) const
 Get the attached model. More...
 
void Reset (Option_t *opt="")
 
void Copy (const ELFormFactors &ff)
 
bool Compare (const ELFormFactors &ff) const
 
void Print (ostream &stream) const
 
bool operator== (const ELFormFactors &ff) const
 
ELFormFactorsoperator= (const ELFormFactors &ff)
 

Private Attributes

double fGep
 
double fGmp
 
double fGen
 
double fGmn
 
const ELFormFactorsModelIfModel
 

Friends

ostream & operator<< (ostream &stream, const ELFormFactors &ff)
 

Detailed Description

A class holding the Elastic Form Factors Ge,Gm.

This class is using the Strategy Pattern.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

Apr 20, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 36 of file ELFormFactors.h.

Constructor & Destructor Documentation

ELFormFactors::ELFormFactors ( )

Definition at line 34 of file ELFormFactors.cxx.

35 {
36  this->Reset();
37 }
void Reset(Option_t *opt="")
ELFormFactors::ELFormFactors ( const ELFormFactors form_factors)

Definition at line 39 of file ELFormFactors.cxx.

40 {
41  this->Copy(ff);
42 }
void Copy(const ELFormFactors &ff)
virtual genie::ELFormFactors::~ELFormFactors ( )
inlinevirtual

Definition at line 41 of file ELFormFactors.h.

41 { }

Member Function Documentation

void ELFormFactors::Calculate ( const Interaction interaction)

Calculate the form factors for the input interaction using the attached algorithm.

Definition at line 50 of file ELFormFactors.cxx.

51 {
52  if(!this->fModel)
53  {
54  LOG("ELFormFactors", pERROR)
55  << "No ELFormFactorModelI algorithm was defined!";
56  this->Reset("D");
57  }
58  else {
59  this->fGep = this->fModel->Gep(interaction);
60  this->fGmp = this->fModel->Gmp(interaction);
61  this->fGen = this->fModel->Gen(interaction);
62  this->fGmn = this->fModel->Gmn(interaction);
63  }
64 }
#define pERROR
Definition: Messenger.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual double Gep(const Interaction *interaction) const =0
Compute the elastic form factor G_{ep} for the input interaction.
virtual double Gen(const Interaction *interaction) const =0
Compute the elastic form factor G_{en} for the input interaction.
void Reset(Option_t *opt="")
virtual double Gmn(const Interaction *interaction) const =0
Compute the elastic form factor G_{mn} for the input interaction.
const ELFormFactorsModelI * fModel
Definition: ELFormFactors.h:80
virtual double Gmp(const Interaction *interaction) const =0
Compute the elastic form factor G_{mp} for the input interaction.
bool ELFormFactors::Compare ( const ELFormFactors ff) const

Definition at line 89 of file ELFormFactors.cxx.

90 {
91  bool equal =
92  math::AreEqual(this->fGep, ff.fGep) &&
93  math::AreEqual(this->fGmp, ff.fGmp) &&
94  math::AreEqual(this->fGen, ff.fGen) &&
95  math::AreEqual(this->fGmn, ff.fGmn);
96  return equal;
97 }
bool AreEqual(double x1, double x2)
Definition: MathUtils.cxx:236
void ELFormFactors::Copy ( const ELFormFactors ff)

Definition at line 80 of file ELFormFactors.cxx.

81 {
82  this->fModel = ff.fModel;
83  this->fGep = ff.fGep;
84  this->fGmp = ff.fGmp;
85  this->fGen = ff.fGen;
86  this->fGmn = ff.fGmn;
87 }
const ELFormFactorsModelI * fModel
Definition: ELFormFactors.h:80
double genie::ELFormFactors::Gen ( void  ) const
inline

Get the computed form factor Gen.

Definition at line 56 of file ELFormFactors.h.

56 { return fGen; }
double genie::ELFormFactors::Gep ( void  ) const
inline

Get the computed form factor Gep.

Definition at line 50 of file ELFormFactors.h.

50 { return fGep; }
double genie::ELFormFactors::Gmn ( void  ) const
inline

Get the computed form factor Gmn.

Definition at line 59 of file ELFormFactors.h.

59 { return fGmn; }
double genie::ELFormFactors::Gmp ( void  ) const
inline

Get the computed form factor Gmp.

Definition at line 53 of file ELFormFactors.h.

53 { return fGmp; }
const ELFormFactorsModelI* genie::ELFormFactors::Model ( void  ) const
inline

Get the attached model.

Definition at line 62 of file ELFormFactors.h.

62 {return fModel;}
const ELFormFactorsModelI * fModel
Definition: ELFormFactors.h:80
ELFormFactors & ELFormFactors::operator= ( const ELFormFactors ff)

Definition at line 111 of file ELFormFactors.cxx.

112 {
113  this->Copy(ff);
114  return (*this);
115 }
void Copy(const ELFormFactors &ff)
bool ELFormFactors::operator== ( const ELFormFactors ff) const

Definition at line 106 of file ELFormFactors.cxx.

107 {
108  return this->Compare(ff);
109 }
bool Compare(const ELFormFactors &ff) const
void ELFormFactors::Print ( ostream &  stream) const

Definition at line 99 of file ELFormFactors.cxx.

100 {
101  stream<< endl;
102  stream<< "(Gep = " << this->fGep << ", Gmp = " << this->fGmp << ")" << endl;
103  stream<< "(Gen = " << this->fGen << ", Gmn = " << this->fGmn << ")" << endl;
104 }
QTextStream & endl(QTextStream &s)
void ELFormFactors::Reset ( Option_t *  opt = "")

Definition at line 66 of file ELFormFactors.cxx.

67 {
68 // Reset the ELFormFactors object (data & attached model). If the input
69 // option = D it resets the data only and not the attached model.
70 
71  this->fGep = 0.;
72  this->fGmp = 0.;
73  this->fGen = 0.;
74  this->fGmn = 0.;
75 
76  string option(opt);
77  if(option.find("D") == string::npos) {this->fModel = 0;}
78 }
opt
Definition: train.py:196
const ELFormFactorsModelI * fModel
Definition: ELFormFactors.h:80
void ELFormFactors::SetModel ( const ELFormFactorsModelI model)

Attach an algorithm.

Definition at line 44 of file ELFormFactors.cxx.

45 {
46  this->Reset();
47  this->fModel = model;
48 }
void Reset(Option_t *opt="")
const ELFormFactorsModelI * fModel
Definition: ELFormFactors.h:80

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const ELFormFactors ff 
)
friend

Definition at line 27 of file ELFormFactors.cxx.

28  {
29  ff.Print(stream);
30  return stream;
31  }
void Print(ostream &stream) const

Member Data Documentation

double genie::ELFormFactors::fGen
private

Definition at line 77 of file ELFormFactors.h.

double genie::ELFormFactors::fGep
private

Definition at line 75 of file ELFormFactors.h.

double genie::ELFormFactors::fGmn
private

Definition at line 78 of file ELFormFactors.h.

double genie::ELFormFactors::fGmp
private

Definition at line 76 of file ELFormFactors.h.

const ELFormFactorsModelI* genie::ELFormFactors::fModel
private

Definition at line 80 of file ELFormFactors.h.


The documentation for this class was generated from the following files: