G4PixeShellDataSet Class Reference

#include <G4PixeShellDataSet.hh>

Inheritance diagram for G4PixeShellDataSet:

G4IDataSet

Public Member Functions

 G4PixeShellDataSet (G4int Z, G4IInterpolator *algo, const G4String &modelK="ecpssr", const G4String &modelL="ecpssr", const G4String &modelM="ecpssr", G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn)
virtual ~G4PixeShellDataSet ()
virtual G4double FindValue (G4double energy, G4int componentId=0) const
virtual void PrintData (void) const
virtual const G4IDataSet * GetComponent (G4int componentId) const
virtual void AddComponent (G4IDataSet *dataSet)
virtual size_t NumberOfComponents (void) const
virtual const G4DataVector & GetEnergies (G4int componentId) const
virtual const G4DataVector & GetData (G4int componentId) const
virtual void SetEnergiesData (G4DataVector *energies, G4DataVector *data, G4int componentId)
virtual G4bool LoadData (const G4String &fileName)
virtual G4bool SaveData (const G4String &fileName) const
virtual G4double RandomSelect (G4int) const

Protected Member Functions

G4double GetUnitEnergies () const
G4double GetUnitData () const
const G4IInterpolator * GetAlgorithm () const
void CleanUpComponents (void)

Detailed Description

Definition at line 57 of file G4PixeShellDataSet.hh.


Constructor & Destructor Documentation

G4PixeShellDataSet::G4PixeShellDataSet ( G4int  Z,
G4IInterpolator *  algo,
const G4String &  modelK = "ecpssr",
const G4String &  modelL = "ecpssr",
const G4String &  modelM = "ecpssr",
G4double  eUnit = CLHEP::MeV,
G4double  dataUnit = CLHEP::barn 
)

Definition at line 48 of file G4PixeShellDataSet.cc.

References FatalException, G4Exception(), and G4PixeShellDataSet().

Referenced by G4PixeShellDataSet().

00054                                                          :
00055   z(zeta),
00056   algorithm(algo),
00057   unitEnergies(eUnit),
00058   unitData(dataUnit)
00059 {
00060   if (algorithm == 0) G4Exception("G4PixeShellDataSet::G4PixeShellDataSet",
00061                                   "pii00000301",
00062                                   FatalException,
00063                                   "interpolation == 0");
00064 
00065   crossModel.push_back(modelK);
00066   crossModel.push_back(modelL);
00067   crossModel.push_back(modelM);
00068 
00069   shellName.push_back("k");
00070   shellName.push_back("l");
00071   shellName.push_back("m");
00072 
00073   size_t sizeK = modelK.size();
00074   size_t sizeL = modelL.size();
00075   size_t sizeM = modelM.size();
00076   
00077   if (sizeK > 0) subShellName.push_back("k");
00078 
00079   if (sizeK > 0 && sizeL > 0)
00080     {
00081       subShellName.push_back("l1");
00082       subShellName.push_back("l2");
00083       subShellName.push_back("l3");
00084     }
00085   if (sizeK > 0 && sizeL > 0 && sizeM >0)
00086     {
00087       subShellName.push_back("m1");
00088       subShellName.push_back("m2");
00089       subShellName.push_back("m3");
00090       subShellName.push_back("m4");
00091       subShellName.push_back("m5");
00092     }
00093 }

G4PixeShellDataSet::~G4PixeShellDataSet (  )  [virtual]

Definition at line 96 of file G4PixeShellDataSet.cc.

References CleanUpComponents().

00097 {
00098   CleanUpComponents();
00099   if (algorithm) delete algorithm;
00100 }


Member Function Documentation

virtual void G4PixeShellDataSet::AddComponent ( G4IDataSet *  dataSet  )  [inline, virtual]

Implements G4IDataSet.

Definition at line 78 of file G4PixeShellDataSet.hh.

Referenced by LoadData().

00079   { components.push_back(dataSet); }

void G4PixeShellDataSet::CleanUpComponents ( void   )  [protected]

Definition at line 192 of file G4PixeShellDataSet.cc.

Referenced by LoadData(), and ~G4PixeShellDataSet().

00193 {
00194   while (!components.empty())
00195     {
00196       if (components.back()) delete components.back();
00197       components.pop_back();
00198     }
00199 }

G4double G4PixeShellDataSet::FindValue ( G4double  energy,
G4int  componentId = 0 
) const [virtual]

Implements G4IDataSet.

Definition at line 103 of file G4PixeShellDataSet.cc.

00104 {
00105   // Returns the sum over the shells corresponding to e
00106   G4double value = 0.;
00107 
00108   std::vector<G4IDataSet *>::const_iterator i(components.begin());
00109   std::vector<G4IDataSet *>::const_iterator end(components.end());
00110 
00111   while (i != end)
00112     {
00113       value += (*i)->FindValue(energy);
00114       i++;
00115     }
00116   return value;
00117 }

const G4IInterpolator* G4PixeShellDataSet::GetAlgorithm (  )  const [inline, protected]

Definition at line 103 of file G4PixeShellDataSet.hh.

00103 { return algorithm; }

virtual const G4IDataSet* G4PixeShellDataSet::GetComponent ( G4int  componentId  )  const [inline, virtual]

Implements G4IDataSet.

Definition at line 75 of file G4PixeShellDataSet.hh.

Referenced by GetData(), GetEnergies(), and PrintData().

00076   { return components[componentId]; }

virtual const G4DataVector& G4PixeShellDataSet::GetData ( G4int  componentId  )  const [inline, virtual]

Implements G4IDataSet.

Definition at line 87 of file G4PixeShellDataSet.hh.

References GetComponent(), and G4IDataSet::GetData().

00088   { return GetComponent(componentId)->GetData(0); }

virtual const G4DataVector& G4PixeShellDataSet::GetEnergies ( G4int  componentId  )  const [inline, virtual]

Implements G4IDataSet.

Definition at line 84 of file G4PixeShellDataSet.hh.

References GetComponent(), and G4IDataSet::GetEnergies().

00085   { return GetComponent(componentId)->GetEnergies(0); }

G4double G4PixeShellDataSet::GetUnitData (  )  const [inline, protected]

Definition at line 102 of file G4PixeShellDataSet.hh.

00102 { return unitData; }

G4double G4PixeShellDataSet::GetUnitEnergies (  )  const [inline, protected]

Definition at line 101 of file G4PixeShellDataSet.hh.

00101 { return unitEnergies; }

G4bool G4PixeShellDataSet::LoadData ( const G4String &  fileName  )  [virtual]

Implements G4IDataSet.

Definition at line 160 of file G4PixeShellDataSet.cc.

References AddComponent(), CleanUpComponents(), and G4IDataSet::LoadData().

00161 {
00162   CleanUpComponents();
00163 
00164   // Load shell cross sections
00165   
00166   G4int nShells = subShellName.size();
00167   
00168   for (G4int subShellIndex=0; subShellIndex<nShells; subShellIndex++)
00169     {
00170       G4String subName = subShellName[subShellIndex];    
00171       G4String fullFileName = FullFileName(file,subName);
00172 
00173       // Create component DataSet with the data from the current subshell
00174       G4IDataSet* dataSet = new G4DataSet(z,algorithm);
00175       dataSet->LoadData(fullFileName);
00176       
00177       // Add component to the ShellDataSet
00178       AddComponent(dataSet);
00179     }
00180 
00181   return true;
00182 }

virtual size_t G4PixeShellDataSet::NumberOfComponents ( void   )  const [inline, virtual]

Implements G4IDataSet.

Definition at line 81 of file G4PixeShellDataSet.hh.

Referenced by PrintData().

00082   { return components.size(); }

void G4PixeShellDataSet::PrintData ( void   )  const [virtual]

Implements G4IDataSet.

Definition at line 120 of file G4PixeShellDataSet.cc.

References G4cout, G4endl, GetComponent(), CLHEP::detail::n, NumberOfComponents(), and G4IDataSet::PrintData().

00121 {
00122   const size_t n = NumberOfComponents();
00123 
00124   G4cout << "The data set has " << n << " components" << G4endl;
00125   G4cout << G4endl;
00126  
00127   size_t i = 0;
00128  
00129   while (i < n)
00130     {
00131       G4cout << "--- Component " << i << " ---" << G4endl;
00132       GetComponent(i)->PrintData();
00133       i++;
00134     }
00135 }

virtual G4double G4PixeShellDataSet::RandomSelect ( G4int   )  const [inline, virtual]

Implements G4IDataSet.

Definition at line 97 of file G4PixeShellDataSet.hh.

00097 {return -1.;};

G4bool G4PixeShellDataSet::SaveData ( const G4String &  fileName  )  const [virtual]

Implements G4IDataSet.

Definition at line 185 of file G4PixeShellDataSet.cc.

00186 {
00187   // Dummy implementation
00188   return true;
00189 }

void G4PixeShellDataSet::SetEnergiesData ( G4DataVector *  energies,
G4DataVector *  data,
G4int  componentId 
) [virtual]

Implements G4IDataSet.

Definition at line 138 of file G4PixeShellDataSet.cc.

References FatalException, G4Exception(), and G4IDataSet::SetEnergiesData().

00141 {
00142   G4IDataSet* component = components[componentId];
00143  
00144   if (component)
00145     {
00146       component->SetEnergiesData(energies, data, 0);
00147       return;
00148     }
00149 
00150   std::ostringstream message;
00151   message << "G4PixeShellDataSet::SetEnergiesData - component " << componentId << " not found";
00152  
00153   G4Exception("G4PixeShellDataSet::SetEnergiesData",
00154               "pii000000310",
00155               FatalException,
00156               message.str().c_str());
00157 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:56 2013 for Geant4 by  doxygen 1.4.7