Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XVCrystalIntegratedDensity Class Reference

#include <XVCrystalIntegratedDensity.hh>

Inheritance diagram for XVCrystalIntegratedDensity:

Public Member Functions

void SetIntegrationPoints (unsigned int, unsigned int)
 
unsigned int GetIntegrationPoints (unsigned int)
 
unsigned int GetIntegrationPoints ()
 
void SetNumberOfPoints (unsigned int)
 
unsigned int GetNumberOfPoints ()
 
void SetDensity (XVCrystalCharacteristic *)
 
XVCrystalCharacteristicGetDensity ()
 
void SetPotential (XVCrystalCharacteristic *)
 
XVCrystalCharacteristicGetPotential ()
 
void SetXPhysicalLattice (XPhysicalLattice *)
 
XPhysicalLatticeGetXPhysicalLattice ()
 
void SetParticleCharge (G4int)
 
G4int GetParticleCharge ()
 
void PrintOnFile (const G4String &)
 
void ReadFromFile (const G4String &)
 
G4bool HasBeenInitialized (XPhysicalLattice *, G4int)
 
G4double GetIntegratedDensity (G4double, XPhysicalLattice *, G4int)
 
virtual void InitializeTable ()
 
 XVCrystalIntegratedDensity ()
 
 ~XVCrystalIntegratedDensity ()
 

Protected Member Functions

G4double GetStep ()
 
virtual void ComputePotentialParameters ()
 
virtual G4double ComputeIntegratedDensity (G4double, G4int)
 
G4double FindCatmullRomInterpolate (G4double &p0, G4double &p1, G4double &p2, G4double &p3, G4double &x)
 

Protected Attributes

G4double fPotentialMinimum
 
G4double fPotentialMaximum
 
G4double fPotentialRange
 

Detailed Description

Definition at line 36 of file XVCrystalIntegratedDensity.hh.

Constructor & Destructor Documentation

XVCrystalIntegratedDensity::XVCrystalIntegratedDensity ( )

Definition at line 32 of file XVCrystalIntegratedDensity.cc.

32  {
33  fNumberOfPoints = 512;
34  fIntegrationPoints[0] = 32;
35  fIntegrationPoints[1] = 32;
36  fIntegrationPoints[2] = 32;
37 }
XVCrystalIntegratedDensity::~XVCrystalIntegratedDensity ( )

Definition at line 41 of file XVCrystalIntegratedDensity.cc.

41  {
42 }

Member Function Documentation

G4double XVCrystalIntegratedDensity::ComputeIntegratedDensity ( G4double  vPotentialInitial,
G4int   
)
protectedvirtual

Reimplemented in XCrystalIntegratedDensityPlanar.

Definition at line 231 of file XVCrystalIntegratedDensity.cc.

232  {
233 
234  unsigned int i1,i2,i3;
235  i1 = i2 = i3 = 0;
236 
237  G4ThreeVector vPositionTemp = G4ThreeVector(0.,0.,0.);
238  G4double vDensity = 0.;
239 
240  G4ThreeVector vSize = fLattice->GetXUnitCell()->GetSize();
241  while(i1<fIntegrationPoints[2]){
242  vPositionTemp.setY(G4double(G4double(i3)/
243  G4double(fIntegrationPoints[2])*vSize.z()));
244  while(i1<fIntegrationPoints[1]){
245  vPositionTemp.setZ(G4double(G4double(i2)/
246  G4double(fIntegrationPoints[1])*vSize.y()));
247  while(i1<fIntegrationPoints[0]){
248  vPositionTemp.setX(G4double(G4double(i1)/
249  G4double(fIntegrationPoints[0])*vSize.x()));
250  if(fPotential->GetEC(vPositionTemp,fLattice).x()
251  < vPotentialInitial){
252  vDensity += fDensity->GetEC(vPositionTemp,fLattice).x();
253  }
254  i1++;
255  };
256  i2++;
257  };
258  i3++;
259  };
260 
261  vDensity *= fLattice->GetXUnitCell()->ComputeVolume();
262  vDensity /= GetIntegrationPoints();
263 
264  return vDensity;
265 }
CLHEP::Hep3Vector G4ThreeVector
double x() const
void setY(double)
G4double ComputeVolume()
Definition: XUnitCell.cc:108
double z() const
void setZ(double)
void setX(double)
G4ThreeVector GetSize()
Definition: XUnitCell.cc:51
XUnitCell * GetXUnitCell()
G4ThreeVector GetEC(G4ThreeVector, XPhysicalLattice *)
double y() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::ComputePotentialParameters ( )
protectedvirtual

Definition at line 160 of file XVCrystalIntegratedDensity.cc.

160  {
161  fPotentialMinimum = fPotential->GetMinimum(fLattice);
162  if(fParticleCharge < 0.){
163  fPotentialMinimum = - fPotential->GetMaximum(fLattice);
164  }
165 
166  fPotentialMaximum = fPotential->GetMaximum(fLattice);
167  if(fParticleCharge < 0.){
168  fPotentialMaximum = - fPotential->GetMinimum(fLattice);
169  }
170 
172 }
virtual G4double GetMinimum(XPhysicalLattice *)
virtual G4double GetMaximum(XPhysicalLattice *)

Here is the call graph for this function:

Here is the caller graph for this function:

G4double XVCrystalIntegratedDensity::FindCatmullRomInterpolate ( G4double p0,
G4double p1,
G4double p2,
G4double p3,
G4double x 
)
protected

Definition at line 270 of file XVCrystalIntegratedDensity.cc.

275 {
276  double a0, a1 , a2 , a3 , x2;
277 
278  x2 = x * x;
279  a0 = -0.5 * p0 + 1.5 * p1 - 1.5 * p2 + 0.5 * p3;
280  a1 = p0 - 2.5 * p1 + 2.0 * p2 - 0.5 * p3;
281  a2 = -0.5 * p0 + 0.5 * p2;
282  a3 = p1;
283 
284  return (a0 * x * x2 + a1 * x2 + a2 * x + a3);
285 }
const G4double a0
tuple x
Definition: test.py:50
XVCrystalCharacteristic * XVCrystalIntegratedDensity::GetDensity ( )

Definition at line 109 of file XVCrystalIntegratedDensity.cc.

109  {
110  return fDensity;
111 }

Here is the caller graph for this function:

G4double XVCrystalIntegratedDensity::GetIntegratedDensity ( G4double  vPotential,
XPhysicalLattice vLattice,
G4int  vParticleCharge 
)

Definition at line 205 of file XVCrystalIntegratedDensity.cc.

207  {
208 
209  G4double vPotentialModified = vPotential /
210  std::fabs(G4double(vParticleCharge)) - fPotentialMinimum;
211 
212  // if the crystal has not been initialized return -1 -> Error!
213  if(!HasBeenInitialized(vLattice,vParticleCharge))
214  return -1.;
215  // if the potential is higher than the maximum the average density
216  // is equal to the one of the amorphous material
217  else if(vPotentialModified >= std::fabs(fPotentialMaximum - fPotentialMinimum))
218  return 1.;
219  // if the value is less than zero (because of possible variation
220  // due to centrifugal force) take the zero value
221  else if(vPotentialModified < 0.) return fTableVector->Value(0.);
222  //else if(vPotentialModified < 1. && vParticleCharge < 0.) return 1.;
223  else{
224  return fTableVector->Value(vPotentialModified);
225  }
226 }
G4double Value(G4double theEnergy, size_t &lastidx) const
G4bool HasBeenInitialized(XPhysicalLattice *, G4int)
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int XVCrystalIntegratedDensity::GetIntegrationPoints ( unsigned int  vIndex)

Definition at line 59 of file XVCrystalIntegratedDensity.cc.

59  {
60  if(vIndex<3) {
61  return fIntegrationPoints[vIndex];
62  }
63  else{
64  return 0;
65  }
66 }
unsigned int XVCrystalIntegratedDensity::GetIntegrationPoints ( )

Definition at line 70 of file XVCrystalIntegratedDensity.cc.

70  {
71  return fIntegrationPoints[0]*fIntegrationPoints[1]*fIntegrationPoints[2];
72 }

Here is the caller graph for this function:

unsigned int XVCrystalIntegratedDensity::GetNumberOfPoints ( )

Definition at line 83 of file XVCrystalIntegratedDensity.cc.

83  {
84  return fNumberOfPoints;
85 }

Here is the caller graph for this function:

G4int XVCrystalIntegratedDensity::GetParticleCharge ( )

Definition at line 134 of file XVCrystalIntegratedDensity.cc.

134  {
135  return fParticleCharge;
136 }
XVCrystalCharacteristic * XVCrystalIntegratedDensity::GetPotential ( )

Definition at line 96 of file XVCrystalIntegratedDensity.cc.

96  {
97  return fPotential;
98 }

Here is the caller graph for this function:

G4double XVCrystalIntegratedDensity::GetStep ( )
protected

Definition at line 140 of file XVCrystalIntegratedDensity.cc.

140  {
141  return fPotentialRange / fNumberOfPoints;
142 }

Here is the caller graph for this function:

XPhysicalLattice * XVCrystalIntegratedDensity::GetXPhysicalLattice ( )

Definition at line 122 of file XVCrystalIntegratedDensity.cc.

122  {
123  return fLattice;
124 }

Here is the caller graph for this function:

G4bool XVCrystalIntegratedDensity::HasBeenInitialized ( XPhysicalLattice vLattice,
G4int  vParticleCharge 
)

Definition at line 147 of file XVCrystalIntegratedDensity.cc.

148  {
149  //now it checks only of the table is initialized,
150  //it does not check if the particular crystal is initialized.
151  //To be changed in the future!
152  if(fTableVector->GetVectorLength() == 0) return false;
153  else if(vLattice!=fLattice) return false;
154  else if(vParticleCharge!=fParticleCharge) return false;
155  else return true;
156 }
size_t GetVectorLength() const

Here is the call graph for this function:

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::InitializeTable ( )
virtual

Definition at line 176 of file XVCrystalIntegratedDensity.cc.

176  {
177 
179 
180  G4cout << "XVCrystalIntegratedDensity::InitializeTable()::";
181  G4cout << "Potential Range = " << fPotentialRange/CLHEP::eV;
182  G4cout << " - Minimum = " << fPotentialMinimum / CLHEP::eV;
183  G4cout << " - Maximum " << fPotentialMaximum / CLHEP::eV << G4endl;
184 
185  G4double vPotentialInitial = 0.;
186 
187  fTableVector =
188  new G4PhysicsLinearVector(0.,
191 
192  G4double vValue = 0;
193  for(unsigned int i=0;i<GetNumberOfPoints();i++){
194  vPotentialInitial = (fPotentialMinimum +
197  vValue = ComputeIntegratedDensity(vPotentialInitial,fParticleCharge);
198  fTableVector->PutValue(i,vValue);
199  }
200 }
virtual G4double ComputeIntegratedDensity(G4double, G4int)
G4GLOB_DLL std::ostream G4cout
void PutValue(size_t index, G4double theValue)
static constexpr double eV
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::PrintOnFile ( const G4String filename)

Definition at line 289 of file XVCrystalIntegratedDensity.cc.

289  {
290  std::ofstream vFileOut;
291  vFileOut.open(filename);
292  G4double vStep = GetStep();
293 
294  vFileOut << "energy,dens" << std::endl;
295  for(unsigned int i = 0;i < fNumberOfPoints;i++){
296  vFileOut << i * vStep / CLHEP::eV;
297  vFileOut << " , ";
298  vFileOut << GetIntegratedDensity((i+1) * vStep
299  + fPotentialMinimum,fLattice,fParticleCharge);
300  vFileOut << std::endl;
301  }
302  vFileOut.close();
303 }
G4double GetIntegratedDensity(G4double, XPhysicalLattice *, G4int)
static constexpr double eV
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::ReadFromFile ( const G4String filename)

Definition at line 307 of file XVCrystalIntegratedDensity.cc.

307  {
308  std::ifstream vFileIn;
309  vFileIn.open(filename);
310  if(!vFileIn){
311  G4cout << "XVCrystalIntegratedDensity::";
312  G4cout << "ReadFromFile - ERROR READING FILE!!!!! ";
313  G4cout << filename << G4endl;
314  }
315 
318  G4double vDensity = 0.;
319 
320  vFileIn >> fPotentialMinimum;
321  vFileIn >> fPotentialMaximum;
322 
323  fPotentialMinimum *= CLHEP::eV;
324  fPotentialMaximum *= CLHEP::eV;
325 
326  std::vector<G4double> fTable;
327 
328  while(!vFileIn.eof()){
329  vFileIn >> vDensity;
330  if(vDensity < 1.E-2) {
331  vDensity = 1.E-2;
332  }
333  fTable.push_back(vDensity);
334  };
335 
336  fNumberOfPoints = fTable.size();
337 
338  fTableVector =
339  new G4PhysicsLinearVector(0.,
340  std::fabs(fPotentialMaximum - fPotentialMinimum),
341  fNumberOfPoints);
342 
343  for(unsigned int i=0;i<fTable.size();i++){
344  fTableVector->PutValue(i,fTable.at(i));
345  }
346 
347  fPotentialRange = std::fabs(fPotentialMaximum - fPotentialMinimum);
348 
349  G4cout << "XVCrystalIntegratedDensity::InitializeTable()::";
350  G4cout << "Potential Range = " << fPotentialRange/CLHEP::eV;
351  G4cout << " - Minimum = " << fPotentialMinimum / CLHEP::eV;
352  G4cout << " - Maximum " << fPotentialMaximum / CLHEP::eV << G4endl;
353  vFileIn.close();
354 }
G4GLOB_DLL std::ostream G4cout
void PutValue(size_t index, G4double theValue)
static constexpr double eV
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetDensity ( XVCrystalCharacteristic vDensity)

Definition at line 103 of file XVCrystalIntegratedDensity.cc.

103  {
104  fDensity = vDensity;
105 }

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetIntegrationPoints ( unsigned int  vIndex,
unsigned int  vIntegrationPoints 
)

Definition at line 47 of file XVCrystalIntegratedDensity.cc.

48  {
49  if(vIndex<3) {
50  if(vIntegrationPoints > 0){
51  fIntegrationPoints[vIndex] = vIntegrationPoints;
52  }
53  }
54 }

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetNumberOfPoints ( unsigned int  vNumberOfPoints)

Definition at line 77 of file XVCrystalIntegratedDensity.cc.

77  {
78  fNumberOfPoints = vNumberOfPoints;
79 }

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetParticleCharge ( G4int  vParticleCharge)

Definition at line 128 of file XVCrystalIntegratedDensity.cc.

128  {
129  fParticleCharge = vParticleCharge;
130 }

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetPotential ( XVCrystalCharacteristic vPotential)

Definition at line 90 of file XVCrystalIntegratedDensity.cc.

90  {
91  fPotential = vPotential;
92 }

Here is the caller graph for this function:

void XVCrystalIntegratedDensity::SetXPhysicalLattice ( XPhysicalLattice vLattice)

Definition at line 116 of file XVCrystalIntegratedDensity.cc.

116  {
117  fLattice = vLattice;
118 }

Here is the caller graph for this function:

Member Data Documentation

G4double XVCrystalIntegratedDensity::fPotentialMaximum
protected

Definition at line 89 of file XVCrystalIntegratedDensity.hh.

G4double XVCrystalIntegratedDensity::fPotentialMinimum
protected

Definition at line 88 of file XVCrystalIntegratedDensity.hh.

G4double XVCrystalIntegratedDensity::fPotentialRange
protected

Definition at line 90 of file XVCrystalIntegratedDensity.hh.


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