Geant4  10.02.p03
XVCrystalIntegratedDensity Class Reference

#include <XVCrystalIntegratedDensity.hh>

Inheritance diagram for XVCrystalIntegratedDensity:
Collaboration 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
 

Private Attributes

XPhysicalLatticefLattice
 
G4int fParticleCharge
 
XVCrystalCharacteristicfDensity
 
XVCrystalCharacteristicfPotential
 
G4PhysicsLinearVectorfTableVector
 
unsigned int fNumberOfPoints
 
unsigned int fIntegrationPoints [3]
 

Detailed Description

Definition at line 33 of file XVCrystalIntegratedDensity.hh.

Constructor & Destructor Documentation

◆ XVCrystalIntegratedDensity()

XVCrystalIntegratedDensity::XVCrystalIntegratedDensity ( )

Definition at line 29 of file XVCrystalIntegratedDensity.cc.

29  {
30  fNumberOfPoints = 512;
31  fIntegrationPoints[0] = 32;
32  fIntegrationPoints[1] = 32;
33  fIntegrationPoints[2] = 32;
34 }

◆ ~XVCrystalIntegratedDensity()

XVCrystalIntegratedDensity::~XVCrystalIntegratedDensity ( )

Definition at line 38 of file XVCrystalIntegratedDensity.cc.

38  {
39 }
Here is the call graph for this function:

Member Function Documentation

◆ ComputeIntegratedDensity()

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

Reimplemented in XCrystalIntegratedDensityPlanar.

Definition at line 228 of file XVCrystalIntegratedDensity.cc.

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

◆ ComputePotentialParameters()

void XVCrystalIntegratedDensity::ComputePotentialParameters ( )
protectedvirtual

Definition at line 157 of file XVCrystalIntegratedDensity.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindCatmullRomInterpolate()

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

Definition at line 267 of file XVCrystalIntegratedDensity.cc.

272 {
273  double a0, a1 , a2 , a3 , x2;
274 
275  x2 = x * x;
276  a0 = -0.5 * p0 + 1.5 * p1 - 1.5 * p2 + 0.5 * p3;
277  a1 = p0 - 2.5 * p1 + 2.0 * p2 - 0.5 * p3;
278  a2 = -0.5 * p0 + 0.5 * p2;
279  a3 = p1;
280 
281  return (a0 * x * x2 + a1 * x2 + a2 * x + a3);
282 }
const G4double a0
Double_t x2[nxs]
static const G4double a1
static const G4double a3
static const G4double a2
Here is the caller graph for this function:

◆ GetDensity()

XVCrystalCharacteristic * XVCrystalIntegratedDensity::GetDensity ( )

Definition at line 106 of file XVCrystalIntegratedDensity.cc.

106  {
107  return fDensity;
108 }
XVCrystalCharacteristic * fDensity
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIntegratedDensity()

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

Definition at line 202 of file XVCrystalIntegratedDensity.cc.

204  {
205 
206  G4double vPotentialModified = vPotential /
207  std::fabs(G4double(vParticleCharge)) - fPotentialMinimum;
208 
209  // if the crystal has not been initialized return -1 -> Error!
210  if(!HasBeenInitialized(vLattice,vParticleCharge))
211  return -1.;
212  // if the potential is higher than the maximum the average density
213  // is equal to the one of the amorphous material
214  else if(vPotentialModified >= std::fabs(fPotentialMaximum - fPotentialMinimum))
215  return 1.;
216  // if the value is less than zero (because of possible variation
217  // due to centrifugal force) take the zero value
218  else if(vPotentialModified < 0.) return fTableVector->Value(0.);
219  //else if(vPotentialModified < 1. && vParticleCharge < 0.) return 1.;
220  else{
221  return fTableVector->Value(vPotentialModified);
222  }
223 }
G4PhysicsLinearVector * fTableVector
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:

◆ GetIntegrationPoints() [1/2]

unsigned int XVCrystalIntegratedDensity::GetIntegrationPoints ( unsigned int  vIndex)

Definition at line 56 of file XVCrystalIntegratedDensity.cc.

56  {
57  if(vIndex<3) {
58  return fIntegrationPoints[vIndex];
59  }
60  else{
61  return 0;
62  }
63 }

◆ GetIntegrationPoints() [2/2]

unsigned int XVCrystalIntegratedDensity::GetIntegrationPoints ( )

Definition at line 67 of file XVCrystalIntegratedDensity.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNumberOfPoints()

unsigned int XVCrystalIntegratedDensity::GetNumberOfPoints ( )

Definition at line 80 of file XVCrystalIntegratedDensity.cc.

80  {
81  return fNumberOfPoints;
82 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetParticleCharge()

G4int XVCrystalIntegratedDensity::GetParticleCharge ( )

Definition at line 131 of file XVCrystalIntegratedDensity.cc.

131  {
132  return fParticleCharge;
133 }

◆ GetPotential()

XVCrystalCharacteristic * XVCrystalIntegratedDensity::GetPotential ( )

Definition at line 93 of file XVCrystalIntegratedDensity.cc.

93  {
94  return fPotential;
95 }
XVCrystalCharacteristic * fPotential
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStep()

G4double XVCrystalIntegratedDensity::GetStep ( )
protected

Definition at line 137 of file XVCrystalIntegratedDensity.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXPhysicalLattice()

XPhysicalLattice * XVCrystalIntegratedDensity::GetXPhysicalLattice ( )

Definition at line 119 of file XVCrystalIntegratedDensity.cc.

119  {
120  return fLattice;
121 }
Here is the caller graph for this function:

◆ HasBeenInitialized()

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

Definition at line 144 of file XVCrystalIntegratedDensity.cc.

145  {
146  //now it checks only of the table is initialized,
147  //it does not check if the particular crystal is initialized.
148  //To be changed in the future!
149  if(fTableVector->GetVectorLength() == 0) return false;
150  else if(vLattice!=fLattice) return false;
151  else if(vParticleCharge!=fParticleCharge) return false;
152  else return true;
153 }
G4PhysicsLinearVector * fTableVector
size_t GetVectorLength() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeTable()

void XVCrystalIntegratedDensity::InitializeTable ( )
virtual

Definition at line 173 of file XVCrystalIntegratedDensity.cc.

173  {
174 
176 
177  G4cout << "XVCrystalIntegratedDensity::InitializeTable()::";
178  G4cout << "Potential Range = " << fPotentialRange/CLHEP::eV;
179  G4cout << " - Minimum = " << fPotentialMinimum / CLHEP::eV;
180  G4cout << " - Maximum " << fPotentialMaximum / CLHEP::eV << G4endl;
181 
182  G4double vPotentialInitial = 0.;
183 
184  fTableVector =
185  new G4PhysicsLinearVector(0.,
188 
189  G4double vValue = 0;
190  for(unsigned int i=0;i<GetNumberOfPoints();i++){
191  vPotentialInitial = (fPotentialMinimum +
194  vValue = ComputeIntegratedDensity(vPotentialInitial,fParticleCharge);
195  fTableVector->PutValue(i,vValue);
196  }
197 }
G4PhysicsLinearVector * fTableVector
virtual G4double ComputeIntegratedDensity(G4double, G4int)
G4GLOB_DLL std::ostream G4cout
void PutValue(size_t index, G4double theValue)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const double eV
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintOnFile()

void XVCrystalIntegratedDensity::PrintOnFile ( const G4String filename)

Definition at line 286 of file XVCrystalIntegratedDensity.cc.

286  {
287  std::ofstream vFileOut;
288  vFileOut.open(filename);
289  G4double vStep = GetStep();
290 
291  vFileOut << "energy,dens" << std::endl;
292  for(unsigned int i = 0;i < fNumberOfPoints;i++){
293  vFileOut << i * vStep / CLHEP::eV;
294  vFileOut << " , ";
295  vFileOut << GetIntegratedDensity((i+1) * vStep
297  vFileOut << std::endl;
298  }
299  vFileOut.close();
300 }
G4double GetIntegratedDensity(G4double, XPhysicalLattice *, G4int)
double G4double
Definition: G4Types.hh:76
static const double eV
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadFromFile()

void XVCrystalIntegratedDensity::ReadFromFile ( const G4String filename)

Definition at line 304 of file XVCrystalIntegratedDensity.cc.

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

◆ SetDensity()

void XVCrystalIntegratedDensity::SetDensity ( XVCrystalCharacteristic vDensity)

Definition at line 100 of file XVCrystalIntegratedDensity.cc.

100  {
101  fDensity = vDensity;
102 }
XVCrystalCharacteristic * fDensity
Here is the caller graph for this function:

◆ SetIntegrationPoints()

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

Definition at line 44 of file XVCrystalIntegratedDensity.cc.

45  {
46  if(vIndex<3) {
47  if(vIntegrationPoints > 0){
48  fIntegrationPoints[vIndex] = vIntegrationPoints;
49  }
50  }
51 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNumberOfPoints()

void XVCrystalIntegratedDensity::SetNumberOfPoints ( unsigned int  vNumberOfPoints)

Definition at line 74 of file XVCrystalIntegratedDensity.cc.

74  {
75  fNumberOfPoints = vNumberOfPoints;
76 }
Here is the caller graph for this function:

◆ SetParticleCharge()

void XVCrystalIntegratedDensity::SetParticleCharge ( G4int  vParticleCharge)

Definition at line 125 of file XVCrystalIntegratedDensity.cc.

125  {
126  fParticleCharge = vParticleCharge;
127 }
Here is the caller graph for this function:

◆ SetPotential()

void XVCrystalIntegratedDensity::SetPotential ( XVCrystalCharacteristic vPotential)

Definition at line 87 of file XVCrystalIntegratedDensity.cc.

87  {
88  fPotential = vPotential;
89 }
XVCrystalCharacteristic * fPotential
Here is the caller graph for this function:

◆ SetXPhysicalLattice()

void XVCrystalIntegratedDensity::SetXPhysicalLattice ( XPhysicalLattice vLattice)

Definition at line 113 of file XVCrystalIntegratedDensity.cc.

113  {
114  fLattice = vLattice;
115 }
Here is the caller graph for this function:

Member Data Documentation

◆ fDensity

XVCrystalCharacteristic* XVCrystalIntegratedDensity::fDensity
private

Definition at line 81 of file XVCrystalIntegratedDensity.hh.

◆ fIntegrationPoints

unsigned int XVCrystalIntegratedDensity::fIntegrationPoints[3]
private

Definition at line 92 of file XVCrystalIntegratedDensity.hh.

◆ fLattice

XPhysicalLattice* XVCrystalIntegratedDensity::fLattice
private

Definition at line 79 of file XVCrystalIntegratedDensity.hh.

◆ fNumberOfPoints

unsigned int XVCrystalIntegratedDensity::fNumberOfPoints
private

Definition at line 91 of file XVCrystalIntegratedDensity.hh.

◆ fParticleCharge

G4int XVCrystalIntegratedDensity::fParticleCharge
private

Definition at line 80 of file XVCrystalIntegratedDensity.hh.

◆ fPotential

XVCrystalCharacteristic* XVCrystalIntegratedDensity::fPotential
private

Definition at line 82 of file XVCrystalIntegratedDensity.hh.

◆ fPotentialMaximum

G4double XVCrystalIntegratedDensity::fPotentialMaximum
protected

Definition at line 86 of file XVCrystalIntegratedDensity.hh.

◆ fPotentialMinimum

G4double XVCrystalIntegratedDensity::fPotentialMinimum
protected

Definition at line 85 of file XVCrystalIntegratedDensity.hh.

◆ fPotentialRange

G4double XVCrystalIntegratedDensity::fPotentialRange
protected

Definition at line 87 of file XVCrystalIntegratedDensity.hh.

◆ fTableVector

G4PhysicsLinearVector* XVCrystalIntegratedDensity::fTableVector
private

Definition at line 90 of file XVCrystalIntegratedDensity.hh.


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