Geant4  10.02.p03
G4RDDopplerProfile Class Reference

#include <G4RDDopplerProfile.hh>

Collaboration diagram for G4RDDopplerProfile:

Public Member Functions

 G4RDDopplerProfile (G4int minZ=1, G4int maxZ=100)
 
 ~G4RDDopplerProfile ()
 
size_t NumberOfProfiles (G4int Z) const
 
const G4RDVEMDataSetProfiles (G4int Z) const
 
const G4RDVEMDataSetProfile (G4int Z, G4int ShellIndex) const
 
void PrintData () const
 
G4double RandomSelectMomentum (G4int Z, G4int shellIndex) const
 

Private Member Functions

G4RDDopplerProfileoperator= (const G4RDDopplerProfile &right)
 
 G4RDDopplerProfile (const G4RDDopplerProfile &)
 
void LoadBiggsP (const G4String &fileName)
 
void LoadProfile (const G4String &fileName, G4int Z)
 

Private Attributes

std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > profileMap
 
std::vector< G4intnShells
 
G4int zMin
 
G4int zMax
 
size_t nBiggs
 
std::vector< G4doublebiggsP
 

Detailed Description

Definition at line 53 of file G4RDDopplerProfile.hh.

Constructor & Destructor Documentation

◆ G4RDDopplerProfile() [1/2]

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

Definition at line 56 of file G4RDDopplerProfile.cc.

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

◆ ~G4RDDopplerProfile()

G4RDDopplerProfile::~G4RDDopplerProfile ( )

Definition at line 70 of file G4RDDopplerProfile.cc.

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

◆ G4RDDopplerProfile() [2/2]

G4RDDopplerProfile::G4RDDopplerProfile ( const G4RDDopplerProfile )
private

Member Function Documentation

◆ LoadBiggsP()

void G4RDDopplerProfile::LoadBiggsP ( const G4String fileName)
private

Definition at line 120 of file G4RDDopplerProfile.cc.

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

◆ LoadProfile()

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

Definition at line 162 of file G4RDDopplerProfile.cc.

163 {
164  std::ostringstream ost;
165  ost << fileName << "-" << Z << ".dat";
166  G4String name(ost.str());
167 
168  char* path = getenv("G4LEDATA");
169  if (!path)
170  {
171  G4String excep("G4LEDATA environment variable not set!");
172  G4Exception("G4RDDopplerProfile::LoadProfile()",
173  "InvalidSetup", FatalException, excep);
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("G4RDDopplerProfile::LoadProfile()",
187  "DataNotFound", FatalException, excep);
188  }
189 
190  G4double p;
191  G4int nShell = 0;
192 
193  // Create CompositeDataSet for the current Z
194  G4RDVDataSetAlgorithm* interpolation = new G4RDLogLogInterpolation;
195  G4RDVEMDataSet* dataSetForZ = new G4RDCompositeEMDataSet(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 G4RDEMDataSet for the current shell
213  G4RDVDataSetAlgorithm* algo = interpolation->Clone();
214  G4RDVEMDataSet* dataSet = new G4RDEMDataSet(Z, biggs, profi, algo, 1., 1., true);
215 
216  // Add current shell profile component to G4RDCompositeEMDataSet 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 }
virtual G4RDVDataSetAlgorithm * Clone() const =0
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4double > biggsP
TFile * file
int G4int
Definition: G4Types.hh:78
Float_t Z
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > profileMap
std::vector< G4int > nShells
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
virtual void AddComponent(G4RDVEMDataSet *dataSet)=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumberOfProfiles()

size_t G4RDDopplerProfile::NumberOfProfiles ( G4int  Z) const

Definition at line 82 of file G4RDDopplerProfile.cc.

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

◆ operator=()

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

◆ PrintData()

void G4RDDopplerProfile::PrintData ( void  ) const

Definition at line 110 of file G4RDDopplerProfile.cc.

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

◆ Profile()

const G4RDVEMDataSet * G4RDDopplerProfile::Profile ( G4int  Z,
G4int  ShellIndex 
) const

Definition at line 102 of file G4RDDopplerProfile.cc.

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

◆ Profiles()

const G4RDVEMDataSet * G4RDDopplerProfile::Profiles ( G4int  Z) const

Definition at line 90 of file G4RDDopplerProfile.cc.

91 {
92  std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
93  if (Z < zMin || Z > zMax)
94  G4Exception("G4RDDopplerProfile::Profiles()", "OutOfRange",
95  FatalException, "Z outside boundaries!");
96  pos = profileMap.find(Z);
97  G4RDVEMDataSet* dataSet = (*pos).second;
98  return dataSet;
99 }
Float_t Z
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > profileMap
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 G4RDDopplerProfile::RandomSelectMomentum ( G4int  Z,
G4int  shellIndex 
) const

Definition at line 227 of file G4RDDopplerProfile.cc.

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

Member Data Documentation

◆ biggsP

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

Definition at line 85 of file G4RDDopplerProfile.hh.

◆ nBiggs

size_t G4RDDopplerProfile::nBiggs
private

Definition at line 83 of file G4RDDopplerProfile.hh.

◆ nShells

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

Definition at line 78 of file G4RDDopplerProfile.hh.

◆ profileMap

std::map<G4int,G4RDVEMDataSet*,std::less<G4int> > G4RDDopplerProfile::profileMap
private

Definition at line 77 of file G4RDDopplerProfile.hh.

◆ zMax

G4int G4RDDopplerProfile::zMax
private

Definition at line 81 of file G4RDDopplerProfile.hh.

◆ zMin

G4int G4RDDopplerProfile::zMin
private

Definition at line 80 of file G4RDDopplerProfile.hh.


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