Geant4  10.02.p03
G4DopplerProfile Class Reference

#include <G4DopplerProfile.hh>

Collaboration diagram for G4DopplerProfile:

Public Member Functions

 G4DopplerProfile (G4int minZ=1, G4int maxZ=100)
 
 ~G4DopplerProfile ()
 
size_t NumberOfProfiles (G4int Z) const
 
const G4VEMDataSet * Profiles (G4int Z) const
 
const G4VEMDataSet * Profile (G4int Z, G4int ShellIndex) const
 
void PrintData () const
 
G4double RandomSelectMomentum (G4int Z, G4int shellIndex) const
 

Private Member Functions

G4DopplerProfile & operator= (const G4DopplerProfile &right)
 
 G4DopplerProfile (const G4DopplerProfile &)
 
void LoadBiggsP (const G4String &fileName)
 
void LoadProfile (const G4String &fileName, G4int Z)
 

Private Attributes

std::map< G4int, G4VEMDataSet *, std::less< G4int > > profileMap
 
std::vector< G4int > nShells
 
G4int zMin
 
G4int zMax
 
size_t nBiggs
 
std::vector< G4double > biggsP
 

Detailed Description

Definition at line 52 of file G4DopplerProfile.hh.

Constructor & Destructor Documentation

◆ G4DopplerProfile() [1/2]

G4DopplerProfile::G4DopplerProfile ( G4int  minZ = 1,
G4int  maxZ = 100 
)

Definition at line 55 of file G4DopplerProfile.cc.

56  : zMin(minZ), zMax(maxZ)
57 {
58  nBiggs = 31;
59 
60  LoadBiggsP("/doppler/p-biggs");
61 
62  for (G4int Z=zMin; Z<zMax+1; Z++)
63  {
64  LoadProfile("/doppler/profile",Z);
65  }
66 }
void LoadProfile(const G4String &fileName, G4int Z)
int G4int
Definition: G4Types.hh:78
void LoadBiggsP(const G4String &fileName)
Float_t Z
Here is the call graph for this function:

◆ ~G4DopplerProfile()

G4DopplerProfile::~G4DopplerProfile ( )

Definition at line 69 of file G4DopplerProfile.cc.

70 {
71  std::map<G4int,G4VEMDataSet*,std::less<G4int> >::iterator pos;
72  for (pos = profileMap.begin(); pos != profileMap.end(); ++pos)
73  {
74  G4VEMDataSet* dataSet = (*pos).second;
75  delete dataSet;
76  dataSet = 0;
77  }
78 }
std::map< G4int, G4VEMDataSet *, std::less< G4int > > profileMap
static const G4double pos

◆ G4DopplerProfile() [2/2]

G4DopplerProfile::G4DopplerProfile ( const G4DopplerProfile &  )
private

Member Function Documentation

◆ LoadBiggsP()

void G4DopplerProfile::LoadBiggsP ( const G4String &  fileName)
private

Definition at line 119 of file G4DopplerProfile.cc.

120 {
121  std::ostringstream ost;
122  ost << fileName << ".dat";
123  G4String name(ost.str());
124 
125  char* path = getenv("G4LEDATA");
126  if (!path)
127  {
128  G4Exception("G4DopplerProfile::LoadBiggsP",
129  "em0006",FatalException,"G4LEDATA environment variable not set");
130  return;
131  }
132 
133  G4String pathString(path);
134  G4String dirFile = pathString + name;
135  std::ifstream file(dirFile);
136  std::filebuf* lsdp = file.rdbuf();
137 
138  if (! (lsdp->is_open()) )
139  {
140  G4String s1("data file: ");
141  G4String s2(" not found");
142  G4String excep = s1 + dirFile + s2;
143  G4Exception("G4DopplerProfile::LoadBiggsP",
144  "em0003",FatalException,excep);
145  }
146 
147  G4double p;
148  while(!file.eof())
149  {
150  file >> p;
151  biggsP.push_back(p);
152  }
153 
154  // Make sure that the number of data loaded corresponds to the number in Biggs' paper
155  if (biggsP.size() != nBiggs)
156  G4Exception("G4DopplerProfile::LoadBiggsP",
157  "em1006",FatalException,"Number of momenta read in is not 31");
158 }
G4String name
Definition: TRTMaterials.hh:40
TFile * file
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::vector< G4double > biggsP
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadProfile()

void G4DopplerProfile::LoadProfile ( const G4String &  fileName,
G4int  Z 
)
private

Definition at line 161 of file G4DopplerProfile.cc.

162 {
163  std::ostringstream ost;
164  ost << fileName << "-" << Z << ".dat";
165  G4String name(ost.str());
166 
167  char* path = getenv("G4LEDATA");
168  if (!path)
169  {
170  G4String excep("G4LEDATA environment variable not set");
171  G4Exception("G4DopplerProfile::LoadProfile",
172  "em0006",FatalException,excep);
173  return;
174  }
175 
176  G4String pathString(path);
177  G4String dirFile = pathString + name;
178  std::ifstream file(dirFile);
179  std::filebuf* lsdp = file.rdbuf();
180 
181  if (! (lsdp->is_open()) )
182  {
183  G4String s1("data file: ");
184  G4String s2(" not found");
185  G4String excep = s1 + dirFile + s2;
186  G4Exception("G4DopplerProfile::LoadProfile",
187  "em0003",FatalException,excep);
188  }
189 
190  G4double p;
191  G4int nShell = 0;
192 
193  // Create CompositeDataSet for the current Z
194  G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation;
195  G4VEMDataSet* dataSetForZ = new G4CompositeEMDataSet(interpolation,1.,1.,1,1);
196 
197  while (!file.eof())
198  {
199  nShell++;
200  G4DataVector* profi = new G4DataVector;
201  G4DataVector* biggs = new G4DataVector;
202 
203  // Read in profile data for the current shell
204  for (size_t i=0; i<nBiggs; i++)
205  {
206  file >> p;
207  profi->push_back(p);
208  biggs->push_back(biggsP[i]);
209  // if (i == 16) G4cout << "profile = " << p << G4endl;
210  }
211 
212  // Create G4EMDataSet for the current shell
213  G4VDataSetAlgorithm* algo = interpolation->Clone();
214  G4VEMDataSet* dataSet = new G4EMDataSet(Z, biggs, profi, algo, 1., 1., true);
215 
216  // Add current shell profile component to G4CompositeEMDataSet for the current Z
217  dataSetForZ->AddComponent(dataSet);
218  }
219 
220  // Fill in number of shells for the current Z
221  nShells.push_back(nShell);
222 
223  profileMap[Z] = dataSetForZ;
224 }
G4String name
Definition: TRTMaterials.hh:40
std::map< G4int, G4VEMDataSet *, std::less< G4int > > profileMap
std::vector< G4int > nShells
TFile * file
int G4int
Definition: G4Types.hh:78
virtual G4VDataSetAlgorithm * Clone() const =0
Float_t Z
virtual void AddComponent(G4VEMDataSet *dataSet)=0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::vector< G4double > biggsP
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumberOfProfiles()

size_t G4DopplerProfile::NumberOfProfiles ( G4int  Z) const

Definition at line 81 of file G4DopplerProfile.cc.

82 {
83  G4int n = 0;
84  if (Z>= zMin && Z <= zMax) n = nShells[Z-1];
85  return n;
86 }
std::vector< G4int > nShells
int G4int
Definition: G4Types.hh:78
Char_t n[5]
Float_t Z

◆ operator=()

G4DopplerProfile& G4DopplerProfile::operator= ( const G4DopplerProfile &  right)
private

◆ PrintData()

void G4DopplerProfile::PrintData ( void  ) const

Definition at line 109 of file G4DopplerProfile.cc.

110 {
111  for (G4int Z=zMin; Z<zMax; Z++)
112  {
113  const G4VEMDataSet* profis = Profiles(Z);
114  profis->PrintData();
115  }
116 }
const G4VEMDataSet * Profiles(G4int Z) const
int G4int
Definition: G4Types.hh:78
Float_t Z
virtual void PrintData(void) const =0
Here is the call graph for this function:

◆ Profile()

const G4VEMDataSet * G4DopplerProfile::Profile ( G4int  Z,
G4int  ShellIndex 
) const

Definition at line 101 of file G4DopplerProfile.cc.

102 {
103  const G4VEMDataSet* profis = Profiles(Z);
104  const G4VEMDataSet* profi = profis->GetComponent(shellIndex);
105  return profi;
106 }
const G4VEMDataSet * Profiles(G4int Z) const
virtual const G4VEMDataSet * GetComponent(G4int componentId) const =0
Float_t Z
Here is the call graph for this function:

◆ Profiles()

const G4VEMDataSet * G4DopplerProfile::Profiles ( G4int  Z) const

Definition at line 89 of file G4DopplerProfile.cc.

90 {
91  std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator pos;
92  if (Z < zMin || Z > zMax)
93  G4Exception("G4DopplerProfile::Profiles",
94  "em1005",FatalException,"Z outside boundaries");
95  pos = profileMap.find(Z);
96  G4VEMDataSet* dataSet = (*pos).second;
97  return dataSet;
98 }
std::map< G4int, G4VEMDataSet *, std::less< G4int > > profileMap
Float_t Z
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const G4double pos
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RandomSelectMomentum()

G4double G4DopplerProfile::RandomSelectMomentum ( G4int  Z,
G4int  shellIndex 
) const

Definition at line 227 of file G4DopplerProfile.cc.

228 {
229  G4double value = 0.;
230  const G4VEMDataSet* profis = Profiles(Z);
231  value = profis->RandomSelect(shellIndex);
232  return value;
233 }
const G4VEMDataSet * Profiles(G4int Z) const
Float_t Z
virtual G4double RandomSelect(G4int componentId=0) const =0
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ biggsP

std::vector<G4double> G4DopplerProfile::biggsP
private

Definition at line 84 of file G4DopplerProfile.hh.

◆ nBiggs

size_t G4DopplerProfile::nBiggs
private

Definition at line 82 of file G4DopplerProfile.hh.

◆ nShells

std::vector<G4int> G4DopplerProfile::nShells
private

Definition at line 77 of file G4DopplerProfile.hh.

◆ profileMap

std::map<G4int,G4VEMDataSet*,std::less<G4int> > G4DopplerProfile::profileMap
private

Definition at line 76 of file G4DopplerProfile.hh.

◆ zMax

G4int G4DopplerProfile::zMax
private

Definition at line 80 of file G4DopplerProfile.hh.

◆ zMin

G4int G4DopplerProfile::zMin
private

Definition at line 79 of file G4DopplerProfile.hh.


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