Geant4  10.02.p03
G4RDCompositeEMDataSet Class Reference

#include <G4RDCompositeEMDataSet.hh>

Inheritance diagram for G4RDCompositeEMDataSet:
Collaboration diagram for G4RDCompositeEMDataSet:

Public Member Functions

 G4RDCompositeEMDataSet (G4RDVDataSetAlgorithm *argAlgorithm, G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn, G4int zMin=1, G4int zMax=99)
 
virtual ~G4RDCompositeEMDataSet ()
 
virtual G4double FindValue (G4double x, G4int componentId=0) const
 
virtual void PrintData (void) const
 
virtual const G4RDVEMDataSetGetComponent (G4int componentId) const
 
virtual void AddComponent (G4RDVEMDataSet *dataSet)
 
virtual size_t NumberOfComponents () const
 
virtual const G4DataVectorGetEnergies (G4int componentId) const
 
virtual const G4DataVectorGetData (G4int componentId) const
 
virtual void SetEnergiesData (G4DataVector *x, G4DataVector *data, G4int componentId)
 
virtual G4bool LoadData (const G4String &fileName)
 
virtual G4bool SaveData (const G4String &fileName) const
 
virtual G4double RandomSelect (G4int componentId) const
 
- Public Member Functions inherited from G4RDVEMDataSet
 G4RDVEMDataSet ()
 
virtual ~G4RDVEMDataSet ()
 

Private Member Functions

void CleanUpComponents (void)
 
 G4RDCompositeEMDataSet ()
 
 G4RDCompositeEMDataSet (const G4RDCompositeEMDataSet &copy)
 
G4RDCompositeEMDataSetoperator= (const G4RDCompositeEMDataSet &right)
 

Private Attributes

std::vector< G4RDVEMDataSet * > components
 
G4RDVDataSetAlgorithmalgorithm
 
G4double unitEnergies
 
G4double unitData
 
G4int minZ
 
G4int maxZ
 

Detailed Description

Definition at line 57 of file G4RDCompositeEMDataSet.hh.

Constructor & Destructor Documentation

◆ G4RDCompositeEMDataSet() [1/3]

G4RDCompositeEMDataSet::G4RDCompositeEMDataSet ( G4RDVDataSetAlgorithm argAlgorithm,
G4double  eUnit = CLHEP::MeV,
G4double  dataUnit = CLHEP::barn,
G4int  zMin = 1,
G4int  zMax = 99 
)

Definition at line 44 of file G4RDCompositeEMDataSet.cc.

49  :
50  algorithm(argAlgorithm),
51  unitEnergies(argUnitEnergies),
52  unitData(argUnitData),
53  minZ(argMinZ),
54  maxZ(argMaxZ)
55 {
56  if (algorithm == 0)
57  G4Exception("G4RDCompositeEMDataSet::G4RDCompositeEMDataSet()",
58  "InvalidSetup", FatalException, "Interpolation == 0!");
59 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4RDVDataSetAlgorithm * algorithm
Here is the call graph for this function:

◆ ~G4RDCompositeEMDataSet()

G4RDCompositeEMDataSet::~G4RDCompositeEMDataSet ( )
virtual

Definition at line 63 of file G4RDCompositeEMDataSet.cc.

64 {
66  if (algorithm) delete algorithm;
67 }
G4RDVDataSetAlgorithm * algorithm
Here is the call graph for this function:

◆ G4RDCompositeEMDataSet() [2/3]

G4RDCompositeEMDataSet::G4RDCompositeEMDataSet ( )
private
Here is the caller graph for this function:

◆ G4RDCompositeEMDataSet() [3/3]

G4RDCompositeEMDataSet::G4RDCompositeEMDataSet ( const G4RDCompositeEMDataSet copy)
private

Member Function Documentation

◆ AddComponent()

virtual void G4RDCompositeEMDataSet::AddComponent ( G4RDVEMDataSet dataSet)
inlinevirtual

Implements G4RDVEMDataSet.

Definition at line 73 of file G4RDCompositeEMDataSet.hh.

73 { components.push_back(dataSet); }
std::vector< G4RDVEMDataSet * > components
Here is the caller graph for this function:

◆ CleanUpComponents()

void G4RDCompositeEMDataSet::CleanUpComponents ( void  )
private

Definition at line 159 of file G4RDCompositeEMDataSet.cc.

160 {
161  while (!components.empty())
162  {
163  if (components.back())
164  delete components.back();
165  components.pop_back();
166  }
167 }
std::vector< G4RDVEMDataSet * > components
Here is the caller graph for this function:

◆ FindValue()

G4double G4RDCompositeEMDataSet::FindValue ( G4double  x,
G4int  componentId = 0 
) const
virtual

Implements G4RDVEMDataSet.

Definition at line 70 of file G4RDCompositeEMDataSet.cc.

71 {
72  const G4RDVEMDataSet* component(GetComponent(argComponentId));
73 
74  if (component) return component->FindValue(argEnergy);
75 
76  std::ostringstream message;
77  message << "Component " << argComponentId << " not found";
78 
79  G4Exception("G4RDCompositeEMDataSet::FindValue()",
80  "DataNotFound", FatalException, message.str().c_str());
81 
82  return 0.;
83 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:

◆ GetComponent()

virtual const G4RDVEMDataSet* G4RDCompositeEMDataSet::GetComponent ( G4int  componentId) const
inlinevirtual

Implements G4RDVEMDataSet.

Definition at line 72 of file G4RDCompositeEMDataSet.hh.

72 { return components[componentId]; }
std::vector< G4RDVEMDataSet * > components
Here is the caller graph for this function:

◆ GetData()

virtual const G4DataVector& G4RDCompositeEMDataSet::GetData ( G4int  componentId) const
inlinevirtual

Implements G4RDVEMDataSet.

Definition at line 77 of file G4RDCompositeEMDataSet.hh.

77 { return GetComponent(componentId)->GetData(0); }
virtual const G4DataVector & GetData(G4int componentId) const =0
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:

◆ GetEnergies()

virtual const G4DataVector& G4RDCompositeEMDataSet::GetEnergies ( G4int  componentId) const
inlinevirtual

Implements G4RDVEMDataSet.

Definition at line 76 of file G4RDCompositeEMDataSet.hh.

76 { return GetComponent(componentId)->GetEnergies(0); }
virtual const G4DataVector & GetEnergies(G4int componentId) const =0
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:

◆ LoadData()

G4bool G4RDCompositeEMDataSet::LoadData ( const G4String fileName)
virtual

Implements G4RDVEMDataSet.

Definition at line 119 of file G4RDCompositeEMDataSet.cc.

120 {
122 
123  for (G4int z(minZ); z<maxZ; z++)
124  {
126  if (!component->LoadData(argFileName))
127  {
128  delete component;
129  return false;
130  }
131  AddComponent(component);
132  }
133  return true;
134 }
virtual G4RDVDataSetAlgorithm * Clone() const =0
int G4int
Definition: G4Types.hh:78
virtual void AddComponent(G4RDVEMDataSet *dataSet)
G4RDVDataSetAlgorithm * algorithm
virtual G4bool LoadData(const G4String &fileName)=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumberOfComponents()

virtual size_t G4RDCompositeEMDataSet::NumberOfComponents ( void  ) const
inlinevirtual

Implements G4RDVEMDataSet.

Definition at line 74 of file G4RDCompositeEMDataSet.hh.

74 { return components.size(); }
std::vector< G4RDVEMDataSet * > components
Here is the caller graph for this function:

◆ operator=()

G4RDCompositeEMDataSet& G4RDCompositeEMDataSet::operator= ( const G4RDCompositeEMDataSet right)
private
Here is the caller graph for this function:

◆ PrintData()

void G4RDCompositeEMDataSet::PrintData ( void  ) const
virtual

Implements G4RDVEMDataSet.

Definition at line 85 of file G4RDCompositeEMDataSet.cc.

86 {
87  const size_t n(NumberOfComponents());
88 
89  G4cout << "The data set has " << n << " components" << G4endl;
90  G4cout << G4endl;
91 
92  size_t i(0);
93 
94  while (i<n)
95  {
96  G4cout << "--- Component " << i << " ---" << G4endl;
97  GetComponent(i)->PrintData();
98  i++;
99  }
100 }
virtual size_t NumberOfComponents() const
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
virtual void PrintData(void) const =0
#define G4endl
Definition: G4ios.hh:61
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:

◆ RandomSelect()

G4double G4RDCompositeEMDataSet::RandomSelect ( G4int  componentId) const
virtual

Implements G4RDVEMDataSet.

Definition at line 170 of file G4RDCompositeEMDataSet.cc.

171 {
172  G4double value = 0.;
173  if (componentId >= 0 && componentId < (G4int)components.size())
174  {
175  const G4RDVEMDataSet* dataSet = GetComponent(componentId);
176  value = dataSet->RandomSelect();
177  }
178  return value;
179 }
int G4int
Definition: G4Types.hh:78
std::vector< G4RDVEMDataSet * > components
double G4double
Definition: G4Types.hh:76
virtual G4double RandomSelect(G4int componentId=0) const =0
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveData()

G4bool G4RDCompositeEMDataSet::SaveData ( const G4String fileName) const
virtual

Implements G4RDVEMDataSet.

Definition at line 138 of file G4RDCompositeEMDataSet.cc.

139 {
140  for (G4int z=minZ; z<maxZ; z++)
141  {
142  const G4RDVEMDataSet* component(GetComponent(z-minZ));
143 
144  if (!component)
145  {
146  std::ostringstream message;
147  message << "Component " << (z-minZ) << " not found";
148  G4Exception("G4RDCompositeEMDataSet::SaveData()",
149  "DataNotFound", FatalException, message.str().c_str());
150  }
151 
152  if (!component->SaveData(argFileName))
153  return false;
154  }
155 
156  return true;
157 }
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEnergiesData()

void G4RDCompositeEMDataSet::SetEnergiesData ( G4DataVector x,
G4DataVector data,
G4int  componentId 
)
virtual

Implements G4RDVEMDataSet.

Definition at line 102 of file G4RDCompositeEMDataSet.cc.

103 {
104  G4RDVEMDataSet * component(components[argComponentId]);
105 
106  if (component)
107  {
108  component->SetEnergiesData(argEnergies, argData, 0);
109  return;
110  }
111 
112  std::ostringstream message;
113  message << "Component " << argComponentId << " not found";
114 
115  G4Exception("G4RDCompositeEMDataSet::SetEnergiesData()",
116  "DataNotFound", FatalException, message.str().c_str());
117 }
std::vector< G4RDVEMDataSet * > components
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ algorithm

G4RDVDataSetAlgorithm* G4RDCompositeEMDataSet::algorithm
private

Definition at line 97 of file G4RDCompositeEMDataSet.hh.

◆ components

std::vector<G4RDVEMDataSet*> G4RDCompositeEMDataSet::components
private

Definition at line 95 of file G4RDCompositeEMDataSet.hh.

◆ maxZ

G4int G4RDCompositeEMDataSet::maxZ
private

Definition at line 103 of file G4RDCompositeEMDataSet.hh.

◆ minZ

G4int G4RDCompositeEMDataSet::minZ
private

Definition at line 102 of file G4RDCompositeEMDataSet.hh.

◆ unitData

G4double G4RDCompositeEMDataSet::unitData
private

Definition at line 100 of file G4RDCompositeEMDataSet.hh.

◆ unitEnergies

G4double G4RDCompositeEMDataSet::unitEnergies
private

Definition at line 99 of file G4RDCompositeEMDataSet.hh.


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