DISStructureFunc.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
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 DISStructureFunc & ff)
27  {
28  ff.Print(stream);
29  return stream;
30  }
31 }
32 //____________________________________________________________________________
34 {
35  this->Reset();
36 }
37 //____________________________________________________________________________
39 {
40  this->Copy(sf);
41 }
42 //____________________________________________________________________________
44 {
45  this->Reset();
46  this->fModel = model;
47 }
48 //____________________________________________________________________________
50 {
51  if(!this->fModel) {
52  LOG("DISSF",pERROR)
53  << "No DISStructureFuncModelI attached. Can not calculate SF's";
54  this->Reset("D");
55  return;
56  }
57 
58  fModel->Calculate(interaction);
59 
60  this->fF1 = fModel->F1();
61  this->fF2 = fModel->F2();
62  this->fF3 = fModel->F3();
63  this->fF4 = fModel->F4();
64  this->fF5 = fModel->F5();
65  this->fF6 = fModel->F6();
66 }
67 //____________________________________________________________________________
68 void DISStructureFunc::Reset(Option_t * opt)
69 {
70 // Reset the DISStructureFunc object (data & attached model). If the input
71 // option = D it resets the data only and not the attached model.
72 
73  this->fF1 = 0.0;
74  this->fF2 = 0.0;
75  this->fF3 = 0.0;
76  this->fF4 = 0.0;
77  this->fF5 = 0.0;
78  this->fF6 = 0.0;
79 
80  string option(opt);
81  if(option.find("D") == string::npos) {this->fModel = 0;}
82 }
83 //____________________________________________________________________________
85 {
86  this->fF1 = sf.fF1;
87  this->fF2 = sf.fF2;
88  this->fF3 = sf.fF3;
89  this->fF4 = sf.fF4;
90  this->fF5 = sf.fF5;
91  this->fF6 = sf.fF6;
92 
93  this->fModel = sf.fModel;
94 }
95 //____________________________________________________________________________
97 {
98  bool equal =
99  math::AreEqual(this->fF1, sf.fF1) &&
100  math::AreEqual(this->fF2, sf.fF2) &&
101  math::AreEqual(this->fF3, sf.fF3) &&
102  math::AreEqual(this->fF4, sf.fF4) &&
103  math::AreEqual(this->fF5, sf.fF5) &&
104  math::AreEqual(this->fF6, sf.fF6);
105  return equal;
106 }
107 //____________________________________________________________________________
108 void DISStructureFunc::Print(ostream & stream) const
109 {
110  stream << "(F1-F6) = ("
111  << this->fF1 << ", " << this->fF2 << ", "
112  << this->fF3 << ", " << this->fF4 << ", "
113  << this->fF5 << ", " << this->fF6 << ")" << endl;
114 /*
115  stream << "F1 = " << this->fF1 << endl;
116  stream << "F2 = " << this->fF2 << endl;
117  stream << "F3 = " << this->fF3 << endl;
118  stream << "F4 = " << this->fF4 << endl;
119  stream << "F5 = " << this->fF5 << endl;
120  stream << "F6 = " << this->fF6 << endl;
121 */
122 }
123 //____________________________________________________________________________
125 {
126  return this->Compare(sf);
127 }
128 //___________________________________________________________________________
130 {
131  this->Copy(sf);
132  return (*this);
133 }
134 //___________________________________________________________________________
void SetModel(const DISStructureFuncModelI *model)
Attach an algorithm.
Pure Abstract Base Class. Defines the DISStructureFuncModelI interface to be implemented by any algor...
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
#define pERROR
Definition: Messenger.h:59
std::string string
Definition: nybbler.cc:12
bool AreEqual(double x1, double x2)
Definition: MathUtils.cxx:236
opt
Definition: train.py:196
DISStructureFunc & operator=(const DISStructureFunc &sf)
const DISStructureFuncModelI * fModel
Definition: model.py:1
void Copy(const DISStructureFunc &sf)
ostream & operator<<(ostream &stream, const T2KEvGenMetaData &md)
Summary information for an interaction.
Definition: Interaction.h:56
bool Compare(const DISStructureFunc &sf) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
A class holding Deep Inelastic Scattering (DIS) Form Factors (invariant structure funstions) ...
bool operator==(const DISStructureFunc &sf) const
void Calculate(const Interaction *interaction)
Calculate the S/F&#39;s for the input interaction using the attached algorithm.
void Print(ostream &stream) const
Root of GENIE utility namespaces.
QTextStream & endl(QTextStream &s)
void Reset(Option_t *opt="")