GENIEGenerator
Loading...
Searching...
No Matches
QELFormFactors.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, 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
17using namespace genie;
18using namespace genie::utils;
19
20using std::endl;
21using std::string;
22
23//____________________________________________________________________________
24namespace genie
25{
26 ostream & operator << (ostream & stream, const QELFormFactors & ff)
27 {
28 ff.Print(stream);
29 return stream;
30 }
31}
32//____________________________________________________________________________
37//____________________________________________________________________________
39{
40 this->Copy(form_factors);
41}
42//____________________________________________________________________________
44{
45 this->Reset();
46 this->fModel = model;
47}
48//____________________________________________________________________________
49void 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//____________________________________________________________________________
64void 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//____________________________________________________________________________
98void 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//___________________________________________________________________________
#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
Summary information for an interaction.
Definition Interaction.h:56
Pure abstract base class. Defines the QELFormFactorsModelI interface to be implemented by any algorit...
void Print(ostream &stream) const
double Fp(void) const
Get the computed form factor Fp.
void Reset(Option_t *opt="")
void Calculate(const Interaction *interaction)
Compute the form factors for the input interaction using the attached model.
const QELFormFactorsModelI * fModel
double F1V(void) const
Get the computed form factor F1V.
bool operator==(const QELFormFactors &ff) const
bool Compare(const QELFormFactors &ff) const
double FA(void) const
Get the computed form factor FA.
double xiF2V(void) const
Get the computed form factor xi*F2V.
QELFormFactors & operator=(const QELFormFactors &ff)
void SetModel(const QELFormFactorsModelI *model)
Attach an algorithm.
void Copy(const QELFormFactors &ff)
bool AreEqual(double x1, double x2)
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)