Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4DopplerProfile Class Reference

#include <G4DopplerProfile.hh>

Public Member Functions

 G4DopplerProfile (G4int minZ=1, G4int maxZ=100)
 
size_t NumberOfProfiles (G4int Z) const
 
void PrintData () const
 
const G4VEMDataSetProfile (G4int Z, G4int ShellIndex) const
 
const G4VEMDataSetProfiles (G4int Z) const
 
G4double RandomSelectMomentum (G4int Z, G4int shellIndex) const
 
 ~G4DopplerProfile ()
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 51 of file G4DopplerProfile.hh.

Constructor & Destructor Documentation

◆ G4DopplerProfile() [1/2]

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

Definition at line 51 of file G4DopplerProfile.cc.

52 : zMin(minZ), zMax(maxZ)
53{
54 LoadBiggsP("/doppler/p-biggs");
55
56 for (G4int Z=zMin; Z<zMax+1; Z++)
57 {
58 LoadProfile("/doppler/profile",Z);
59 }
60}
static const G4int maxZ
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
void LoadBiggsP(const G4String &fileName)
void LoadProfile(const G4String &fileName, G4int Z)

References LoadBiggsP(), LoadProfile(), Z, zMax, and zMin.

◆ ~G4DopplerProfile()

G4DopplerProfile::~G4DopplerProfile ( )

Definition at line 65 of file G4DopplerProfile.cc.

66{
67 for (auto& pos : profileMap)
68 {
69 G4VEMDataSet* dataSet = pos.second;
70 delete dataSet;
71 dataSet = nullptr;
72 }
73}
static const G4double pos
std::map< G4int, G4VEMDataSet *, std::less< G4int > > profileMap

References pos, and profileMap.

◆ G4DopplerProfile() [2/2]

G4DopplerProfile::G4DopplerProfile ( const G4DopplerProfile )
privatedelete

Member Function Documentation

◆ LoadBiggsP()

void G4DopplerProfile::LoadBiggsP ( const G4String fileName)
private

Definition at line 118 of file G4DopplerProfile.cc.

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

References biggsP, FatalException, geant4_check_module_cycles::file, G4Exception(), G4InuclParticleNames::name(), and nBiggs.

Referenced by G4DopplerProfile().

◆ 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 = std::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 }
210
211 // Create G4EMDataSet for the current shell
212 G4VDataSetAlgorithm* algo = interpolation->Clone();
213 G4VEMDataSet* dataSet = new G4EMDataSet(Z, biggs, profi, algo, 1., 1., true);
214
215 // Add current shell profile component to G4CompositeEMDataSet for the current Z
216 dataSetForZ->AddComponent(dataSet);
217 }
218
219 // Fill in number of shells for the current Z
220 nShells.push_back(nShell);
221
222 profileMap[Z] = dataSetForZ;
223}
std::vector< G4int > nShells
virtual G4VDataSetAlgorithm * Clone() const =0
virtual void AddComponent(G4VEMDataSet *dataSet)=0

References G4VEMDataSet::AddComponent(), biggsP, G4VDataSetAlgorithm::Clone(), FatalException, geant4_check_module_cycles::file, G4Exception(), G4InuclParticleNames::name(), nBiggs, nShells, profileMap, and Z.

Referenced by G4DopplerProfile().

◆ NumberOfProfiles()

size_t G4DopplerProfile::NumberOfProfiles ( G4int  Z) const

Definition at line 77 of file G4DopplerProfile.cc.

78{
79 G4int n = 0;
80 if (Z>= zMin && Z <= zMax) n = nShells[Z-1];
81 return n;
82}

References CLHEP::detail::n, nShells, Z, zMax, and zMin.

◆ operator=()

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

◆ PrintData()

void G4DopplerProfile::PrintData ( void  ) const

Definition at line 107 of file G4DopplerProfile.cc.

108{
109 for (G4int Z=zMin; Z<zMax; Z++)
110 {
111 const G4VEMDataSet* profis = Profiles(Z);
112 profis->PrintData();
113 }
114}
const G4VEMDataSet * Profiles(G4int Z) const
virtual void PrintData(void) const =0

References G4VEMDataSet::PrintData(), Profiles(), Z, zMax, and zMin.

◆ Profile()

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

Definition at line 98 of file G4DopplerProfile.cc.

99{
100 const G4VEMDataSet* profis = Profiles(Z);
101 const G4VEMDataSet* profi = profis->GetComponent(shellIndex);
102 return profi;
103}
virtual const G4VEMDataSet * GetComponent(G4int componentId) const =0

References G4VEMDataSet::GetComponent(), Profiles(), and Z.

◆ Profiles()

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

Definition at line 86 of file G4DopplerProfile.cc.

87{
88 if (Z < zMin || Z > zMax)
89 G4Exception("G4DopplerProfile::Profiles",
90 "em1005",FatalException,"Z outside boundaries");
91 auto pos = profileMap.find(Z);
92 G4VEMDataSet* dataSet = (*pos).second;
93 return dataSet;
94}

References FatalException, G4Exception(), pos, profileMap, Z, and zMax.

Referenced by PrintData(), Profile(), and RandomSelectMomentum().

◆ 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}
virtual G4double RandomSelect(G4int componentId=0) const =0

References Profiles(), G4VEMDataSet::RandomSelect(), and Z.

Referenced by G4LivermoreComptonModel::SampleSecondaries(), G4LivermorePolarizedComptonModel::SampleSecondaries(), G4LowEPComptonModel::SampleSecondaries(), and G4LowEPPolarizedComptonModel::SampleSecondaries().

Field Documentation

◆ biggsP

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

Definition at line 76 of file G4DopplerProfile.hh.

Referenced by LoadBiggsP(), and LoadProfile().

◆ nBiggs

size_t G4DopplerProfile::nBiggs = 31
private

Definition at line 81 of file G4DopplerProfile.hh.

Referenced by LoadBiggsP(), and LoadProfile().

◆ nShells

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

Definition at line 75 of file G4DopplerProfile.hh.

Referenced by LoadProfile(), and NumberOfProfiles().

◆ profileMap

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

Definition at line 74 of file G4DopplerProfile.hh.

Referenced by LoadProfile(), Profiles(), and ~G4DopplerProfile().

◆ zMax

G4int G4DopplerProfile::zMax
private

Definition at line 79 of file G4DopplerProfile.hh.

Referenced by G4DopplerProfile(), NumberOfProfiles(), PrintData(), and Profiles().

◆ zMin

G4int G4DopplerProfile::zMin
private

Definition at line 78 of file G4DopplerProfile.hh.

Referenced by G4DopplerProfile(), NumberOfProfiles(), and PrintData().


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