G4ElementData.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4ElementData.hh 67044 2013-01-30 08:50:06Z gcosmo $
00027 //
00028 //---------------------------------------------------------------------------
00029 //
00030 // GEANT4 Class file
00031 //
00032 // Description: Data structure for cross sections, shell cross sections,
00033 //              isotope cross sections. Control of vector size should be
00034 //              performed in user code, no protection in this class
00035 //
00036 // Author:      V.Ivanchenko 10.03.2011
00037 //
00038 // Modifications:
00039 //
00040 //----------------------------------------------------------------------------
00041 //
00042 
00043 #ifndef ElementData_h
00044 #define ElementData_h 1
00045 
00046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00047 
00048 #include "globals.hh"
00049 #include "G4NistElementBuilder.hh"
00050 #include "G4PhysicsVector.hh"
00051 #include <vector>
00052 
00053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00054 
00055 class G4ElementData 
00056 {
00057 public:
00058 
00059   G4ElementData();
00060 
00061   ~G4ElementData();
00062 
00063   // add cross section for the element
00064   void InitialiseForElement(G4int Z, G4PhysicsVector* v);
00065 
00066   // reserve vector of components
00067   void InitialiseForComponent(G4int Z, G4int nComponents=0);
00068 
00069   // prepare vector of components
00070   void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
00071 
00072   // set name of the dataset
00073   void SetName(const G4String& nam);
00074 
00075   // get vector for the element 
00076   inline G4PhysicsVector* GetElementData(G4int Z);
00077 
00078   // get number of components for the element 
00079   inline size_t GetNumberOfComponents(G4int Z);
00080 
00081   // get component ID which may be number of nucleons, 
00082   // or shell number, or any other integer
00083   inline G4int GetComponentID(G4int Z, size_t idx);
00084 
00085   // get vector per shell or per isotope
00086   inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
00087 
00088   // get vector per shell or per isotope
00089   inline G4PhysicsVector* GetComponentDataByID(G4int Z, G4int id);
00090 
00091   // return cross section per element 
00092   // if not available return zero
00093   inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
00094 
00095   // return cross section per element 
00096   // if not available return zero
00097   inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
00098 
00099 private:
00100 
00101   // Assignment operator and copy constructor
00102   G4ElementData & operator=(const G4ElementData &right);
00103   G4ElementData(const G4ElementData&);
00104 
00105   G4PhysicsVector* elmData[maxNumElements];
00106   std::vector<G4PhysicsVector*> compData[maxNumElements];
00107   std::vector<G4int> compID[maxNumElements];
00108   size_t compLength[maxNumElements];
00109   G4String name;
00110 };
00111 
00112 inline void G4ElementData::SetName(const G4String& nam)
00113 {
00114   name = nam;
00115 }
00116 
00117 inline 
00118 G4PhysicsVector* G4ElementData::GetElementData(G4int Z)
00119 {
00120   return elmData[Z];
00121 }
00122 
00123 inline 
00124 size_t G4ElementData::GetNumberOfComponents(G4int Z)
00125 {
00126   return compLength[Z];
00127 }
00128 
00129 inline G4int G4ElementData::GetComponentID(G4int Z, size_t idx)
00130 {
00131   return (compID[Z])[idx];
00132 }
00133 
00134 inline 
00135 G4PhysicsVector* G4ElementData::GetComponentDataByIndex(G4int Z, size_t idx)
00136 {
00137   return (compData[Z])[idx];
00138 }
00139 
00140 inline 
00141 G4PhysicsVector* G4ElementData::GetComponentDataByID(G4int Z, G4int id)
00142 {
00143   G4PhysicsVector* v = 0;
00144   for(size_t i=0; i<compLength[Z]; ++i) {
00145     if(id == (compID[Z])[i]) {
00146       v = (compData[Z])[i];
00147       break;
00148     }
00149   }
00150   return v;
00151 }
00152 
00153 inline 
00154 G4double G4ElementData::GetValueForElement(G4int Z, G4double kinEnergy)
00155 {
00156   return elmData[Z]->Value(kinEnergy);
00157 }
00158 
00159 inline G4double 
00160 G4ElementData::GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
00161 {
00162   return ((compData[Z])[idx])->Value(kinEnergy);
00163 }
00164 
00165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00166 
00167 #endif
00168  

Generated on Mon May 27 17:48:07 2013 for Geant4 by  doxygen 1.4.7