GENIEGenerator
Loading...
Searching...
No Matches
ELFormFactors.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
17
18using std::endl;
19using std::string;
20
21using namespace genie;
22using namespace genie::utils;
23
24//____________________________________________________________________________
25namespace genie
26{
27 ostream & operator << (ostream & stream, const ELFormFactors & ff)
28 {
29 ff.Print(stream);
30 return stream;
31 }
32}
33//____________________________________________________________________________
35{
36 this->Reset();
37}
38//____________________________________________________________________________
40{
41 this->Copy(ff);
42}
43//____________________________________________________________________________
45{
46 this->Reset();
47 this->fModel = model;
48}
49//____________________________________________________________________________
50void ELFormFactors::Calculate(const Interaction * interaction)
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}
65//____________________________________________________________________________
66void ELFormFactors::Reset(Option_t * opt)
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}
79//____________________________________________________________________________
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}
88//____________________________________________________________________________
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}
98//____________________________________________________________________________
99void ELFormFactors::Print(ostream & stream) const
100{
101 stream<< endl;
102 stream<< "(Gep = " << this->fGep << ", Gmp = " << this->fGmp << ")" << endl;
103 stream<< "(Gen = " << this->fGen << ", Gmn = " << this->fGmn << ")" << endl;
104}
105//____________________________________________________________________________
107{
108 return this->Compare(ff);
109}
110//___________________________________________________________________________
112{
113 this->Copy(ff);
114 return (*this);
115}
116//___________________________________________________________________________
#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
Pure abstract base class. Defines the ELFormFactorsModelI interface to be implemented by any algorith...
ELFormFactors & operator=(const ELFormFactors &ff)
void Print(ostream &stream) const
void Copy(const ELFormFactors &ff)
void Reset(Option_t *opt="")
bool Compare(const ELFormFactors &ff) const
void Calculate(const Interaction *interaction)
Calculate the form factors for the input interaction using the attached algorithm.
bool operator==(const ELFormFactors &ff) const
void SetModel(const ELFormFactorsModelI *model)
Attach an algorithm.
const ELFormFactorsModelI * fModel
Summary information for an interaction.
Definition Interaction.h:56
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)