Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XVCrystalPlanarAnalytical Class Referenceabstract

#include <XVCrystalPlanarAnalytical.hh>

Inheritance diagram for XVCrystalPlanarAnalytical:
Collaboration diagram for XVCrystalPlanarAnalytical:

Public Member Functions

void SetNumberOfPlanes (G4int)
 
G4int GetNumberOfPlanes ()
 
virtual G4double ComputeECForSinglePlane (G4double, XPhysicalLattice *)=0
 
G4ThreeVector ComputeEC (G4ThreeVector, XPhysicalLattice *)
 
G4ThreeVector ComputeECFromVector (G4ThreeVector)
 
G4ThreeVector ComputePositionInUnitCell (G4ThreeVector, XPhysicalLattice *)
 
virtual G4double ComputeMaximum (XPhysicalLattice *)
 
virtual G4double ComputeMinimum (XPhysicalLattice *)
 
virtual void PrintOnFile (const G4String &, XPhysicalLattice *, G4double)
 
virtual void ReadFromFile (const G4String &, XPhysicalLattice *, G4double=1)
 
virtual void ReadFromECHARM (const G4String &, G4double=1)
 
void InitializeVector ()
 
 XVCrystalPlanarAnalytical ()
 
 ~XVCrystalPlanarAnalytical ()
 
- Public Member Functions inherited from XVCrystalCharacteristic
XPhysicalLatticeGetXPhysicalLattice (G4VPhysicalVolume *)
 
XUnitCellGetXUnitCell (G4VPhysicalVolume *)
 
XLogicalLatticeGetLogicalLattice (G4VPhysicalVolume *)
 
void InitializePhysicalLattice (XPhysicalLattice *)
 
G4ThreeVector GetEC (G4ThreeVector, XPhysicalLattice *)
 
virtual G4double ComputeTFScreeningRadius (XPhysicalLattice *)
 
virtual G4double GetMaximum (XPhysicalLattice *)
 
virtual G4double GetMinimum (XPhysicalLattice *)
 
G4bool IsInitialized (XPhysicalLattice *)
 
 XVCrystalCharacteristic ()
 
 ~XVCrystalCharacteristic ()
 

Additional Inherited Members

- Protected Attributes inherited from XVCrystalCharacteristic
G4double fMaximum
 
G4double fMinimum
 
XPhysicalLatticefPhysicalLattice
 
G4PhysicsVectorfVectorEC
 

Detailed Description

Definition at line 35 of file XVCrystalPlanarAnalytical.hh.

Constructor & Destructor Documentation

XVCrystalPlanarAnalytical::XVCrystalPlanarAnalytical ( )

Definition at line 33 of file XVCrystalPlanarAnalytical.cc.

33  {
34  fNumberOfPlanes = 4;
35 }
XVCrystalPlanarAnalytical::~XVCrystalPlanarAnalytical ( )

Definition at line 39 of file XVCrystalPlanarAnalytical.cc.

39  {
40 }

Member Function Documentation

G4ThreeVector XVCrystalPlanarAnalytical::ComputeEC ( G4ThreeVector  vPositionVector,
XPhysicalLattice vLattice 
)
virtual

Implements XVCrystalCharacteristic.

Definition at line 57 of file XVCrystalPlanarAnalytical.cc.

58  {
59  G4VPhysicalVolume* vVolume = vLattice->GetVolume();
60 
61  G4double vInterplanarDistance =
63 
64  G4double vPosition = ComputePositionInUnitCell(vPositionVector,
65  vLattice).x();
66 
67  G4double vValue = 0.;
68  for(int i=-int(GetNumberOfPlanes()/2);i<=+int(GetNumberOfPlanes()/2);i++){
69  vValue += ComputeECForSinglePlane( ( vPosition + G4double(i) ) *
70  vInterplanarDistance ,
71  vLattice );
72  }
73 
74  return G4ThreeVector(vValue,0.,0.);
75 }
virtual G4double ComputeECForSinglePlane(G4double, XPhysicalLattice *)=0
CLHEP::Hep3Vector G4ThreeVector
double x() const
XPhysicalLattice * GetXPhysicalLattice(G4VPhysicalVolume *)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4ThreeVector ComputePositionInUnitCell(G4ThreeVector, XPhysicalLattice *)
double G4double
Definition: G4Types.hh:76
G4double ComputeInterplanarPeriod()
G4VPhysicalVolume * GetVolume()

Here is the call graph for this function:

Here is the caller graph for this function:

virtual G4double XVCrystalPlanarAnalytical::ComputeECForSinglePlane ( G4double  ,
XPhysicalLattice  
)
pure virtual
G4ThreeVector XVCrystalPlanarAnalytical::ComputeECFromVector ( G4ThreeVector  vPosition)
virtual

Implements XVCrystalCharacteristic.

Definition at line 80 of file XVCrystalPlanarAnalytical.cc.

80  {
81  G4double vInterplanarPeriod = fPhysicalLattice->ComputeInterplanarPeriod();
82  G4double vX = vPosition.x();
83  if (vX < 0.0) {
84  vX += ((int( - vX / vInterplanarPeriod) + 1.0 )
85  * vInterplanarPeriod);
86  }
87  else if( vX > vInterplanarPeriod ){
88  vX -= ( int( vX / vInterplanarPeriod) * vInterplanarPeriod );
89  }
90  return G4ThreeVector(fVectorEC->Value(vX),0.,0.);
91 }
CLHEP::Hep3Vector G4ThreeVector
double x() const
XPhysicalLattice * fPhysicalLattice
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4double Value(G4double theEnergy, size_t &lastidx) const
double G4double
Definition: G4Types.hh:76
G4double ComputeInterplanarPeriod()

Here is the call graph for this function:

G4double XVCrystalPlanarAnalytical::ComputeMaximum ( XPhysicalLattice vLattice)
virtual

Reimplemented from XVCrystalCharacteristic.

Reimplemented in XCrystalPlanarMoliereTempPotential, and XCrystalPlanarMolierePotential.

Definition at line 121 of file XVCrystalPlanarAnalytical.cc.

121  {
122  unsigned int vPrecision = 1024;
123  G4VPhysicalVolume* vVolume = vLattice->GetVolume();
125  / vPrecision;
126 
127  G4double vMaximum = -DBL_MAX;
128  G4double vValue;
129 
130  for(unsigned int i=0;i<vPrecision;i++){
131  if( (vValue = GetEC(G4ThreeVector(vStep * i,0.,0.),vLattice).x() )
132  > vMaximum) {vMaximum = vValue;}
133  }
134  return vMaximum;
135 }
CLHEP::Hep3Vector G4ThreeVector
XPhysicalLattice * GetXPhysicalLattice(G4VPhysicalVolume *)
tuple x
Definition: test.py:50
G4ThreeVector GetEC(G4ThreeVector, XPhysicalLattice *)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
G4double ComputeInterplanarPeriod()
G4VPhysicalVolume * GetVolume()

Here is the call graph for this function:

G4double XVCrystalPlanarAnalytical::ComputeMinimum ( XPhysicalLattice vLattice)
virtual

Reimplemented from XVCrystalCharacteristic.

Reimplemented in XCrystalPlanarMoliereTempPotential, and XCrystalPlanarMolierePotential.

Definition at line 139 of file XVCrystalPlanarAnalytical.cc.

139  {
140  unsigned int vPrecision = 1024;
141  G4VPhysicalVolume* vVolume = vLattice->GetVolume();
143  / vPrecision;
144 
145  G4double vMinimum = +DBL_MAX;
146  G4double vValue;
147 
148  for(unsigned int i=0;i<vPrecision;i++){
149  if( (vValue = GetEC(G4ThreeVector(vStep * i,0.,0.),vLattice).x() )
150  < vMinimum) {vMinimum = vValue;}
151  }
152  return vMinimum;
153 }
CLHEP::Hep3Vector G4ThreeVector
XPhysicalLattice * GetXPhysicalLattice(G4VPhysicalVolume *)
tuple x
Definition: test.py:50
G4ThreeVector GetEC(G4ThreeVector, XPhysicalLattice *)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
G4double ComputeInterplanarPeriod()
G4VPhysicalVolume * GetVolume()

Here is the call graph for this function:

G4ThreeVector XVCrystalPlanarAnalytical::ComputePositionInUnitCell ( G4ThreeVector  vPosition,
XPhysicalLattice vLattice 
)
virtual

Reimplemented from XVCrystalCharacteristic.

Definition at line 96 of file XVCrystalPlanarAnalytical.cc.

97  {
98  G4VPhysicalVolume* vVolume = vLattice->GetVolume();
99 
100  G4double vInterplanarPeriod =
102 
103  G4double vPositionX = vPosition.x();
104 
105  if((vPositionX >= 0.) &&
106  (vPositionX < vInterplanarPeriod)){
107  return G4ThreeVector(vPositionX/vInterplanarPeriod,0.,0.);
108  }
109  else if(vPositionX == vInterplanarPeriod){
110  return G4ThreeVector(0.,0.,0.);
111  }
112  else{
113  vPositionX -= std::fmod(vPosition.x(),vInterplanarPeriod)
114  * vInterplanarPeriod;
115  return G4ThreeVector(vPositionX/vInterplanarPeriod,0.,0.);
116  }
117 }
CLHEP::Hep3Vector G4ThreeVector
double x() const
XPhysicalLattice * GetXPhysicalLattice(G4VPhysicalVolume *)
double G4double
Definition: G4Types.hh:76
G4double ComputeInterplanarPeriod()
G4VPhysicalVolume * GetVolume()

Here is the call graph for this function:

Here is the caller graph for this function:

G4int XVCrystalPlanarAnalytical::GetNumberOfPlanes ( )

Definition at line 50 of file XVCrystalPlanarAnalytical.cc.

50  {
51  return fNumberOfPlanes;
52 }

Here is the caller graph for this function:

void XVCrystalPlanarAnalytical::InitializeVector ( )
virtual

Implements XVCrystalCharacteristic.

Definition at line 251 of file XVCrystalPlanarAnalytical.cc.

251  {
252  G4int imax = 4096;
253  G4double vXposition = 0.;
254  G4double vInterplanarPeriod = fPhysicalLattice->ComputeInterplanarPeriod();
255 
257  vInterplanarPeriod*(imax-1)/imax,
258  imax);
259  for(G4int i = 0;i<imax;i++){
260  vXposition = double(i) / double(imax) * vInterplanarPeriod;
261  fVectorEC->PutValue(i,ComputeEC(G4ThreeVector(vXposition,0.,0.),
262  fPhysicalLattice).x());
263  }
264 }
CLHEP::Hep3Vector G4ThreeVector
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
XPhysicalLattice * fPhysicalLattice
void PutValue(size_t index, G4double theValue)
G4ThreeVector ComputeEC(G4ThreeVector, XPhysicalLattice *)
static const G4int imax
double G4double
Definition: G4Types.hh:76
G4double ComputeInterplanarPeriod()

Here is the call graph for this function:

void XVCrystalPlanarAnalytical::PrintOnFile ( const G4String filename,
XPhysicalLattice vLattice,
G4double  vUnit 
)
virtual

Implements XVCrystalCharacteristic.

Definition at line 157 of file XVCrystalPlanarAnalytical.cc.

159  {
160  std::ofstream vFileOut;
161  vFileOut.open(filename);
162  vFileOut << "pos val" << std::endl;
163 
164  G4int imax = 8192;
165  G4double vXposition = 0.;
166  G4double vInterplanarPeriod = vLattice->ComputeInterplanarPeriod();
167 
168  for(G4int i = 0;i<imax;i++){
169  vXposition = double(i) / double(imax) * vInterplanarPeriod;
170  vFileOut << vXposition / CLHEP::angstrom << " ";
171  vFileOut << GetEC(G4ThreeVector(vXposition,0.,0.),vLattice).x() / vUnit;
172  vFileOut << std::endl;
173  }
174 
175  vFileOut.close();
176 }
CLHEP::Hep3Vector G4ThreeVector
double x() const
int G4int
Definition: G4Types.hh:78
G4ThreeVector GetEC(G4ThreeVector, XPhysicalLattice *)
static const G4int imax
double G4double
Definition: G4Types.hh:76
G4double ComputeInterplanarPeriod()
static constexpr double angstrom
Definition: SystemOfUnits.h:82

Here is the call graph for this function:

void XVCrystalPlanarAnalytical::ReadFromECHARM ( const G4String filename,
G4double  vConversion = 1 
)
virtual

Implements XVCrystalCharacteristic.

Definition at line 214 of file XVCrystalPlanarAnalytical.cc.

215  {
216  std::ifstream vFileIn;
217  vFileIn.open(filename);
218 
219  G4int imax;
220  G4double xmax;
221 
222  vFileIn >> imax;
223  vFileIn >> xmax;
224 
225  xmax *= CLHEP::meter;
226  fMaximum = -DBL_MAX;
227  fMinimum = +DBL_MAX;
228 
229  fVectorEC = new G4PhysicsLinearVector(0,xmax,imax);
230 
231  for(G4int i=0;i<imax; i++){
232  double vTempX;
233  vFileIn >> vTempX;
234 
235  vTempX *= vConversion;
236  if(vTempX > fMaximum) {fMaximum = vTempX;}
237  if(vTempX < fMinimum) {fMinimum = vTempX;}
238  fVectorEC->PutValue(i,vTempX);
239  }
240 
241  G4cout << "XVCrystalPlanarAnalytical::ReadFromECHARM() - " <<
242  vConversion << " " << imax << " " << xmax << " " <<
243  fMinimum << " " << fMaximum << G4endl;
244 
245  vFileIn.close();
246 
247 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static constexpr double meter
Definition: SystemOfUnits.h:70
void PutValue(size_t index, G4double theValue)
#define G4endl
Definition: G4ios.hh:61
static const G4int imax
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

void XVCrystalPlanarAnalytical::ReadFromFile ( const G4String filename,
XPhysicalLattice ,
G4double  = 1 
)
virtual

Implements XVCrystalCharacteristic.

Definition at line 180 of file XVCrystalPlanarAnalytical.cc.

181  {
182  std::ifstream vFileIn;
183  vFileIn.open(filename);
184  std::string vTempString;
185  vFileIn >> vTempString >> vTempString;
186 
187  double vTempX;
188  double vTempVal;
189  std::vector<double> vTempXvector;
190  std::vector<double> vTempValvector;
191 
192  while(!vFileIn.eof()){
193  vFileIn >> vTempX;
194  vFileIn >> vTempVal;
195  vTempXvector.push_back(vTempX);
196  vTempValvector.push_back(vTempVal);
197  }
198 
199  vFileIn.close();
200 
201  G4int imax = vTempXvector.size();
202  G4double vInterplanarPeriod = vTempXvector.at(imax-1);
203 
205  vInterplanarPeriod*(imax-1)/imax,
206  imax);
207  for(G4int i = 0;i<imax;i++){
208  fVectorEC->PutValue(i,vTempValvector.at(i));
209  }
210 }
int G4int
Definition: G4Types.hh:78
void PutValue(size_t index, G4double theValue)
static const G4int imax
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void XVCrystalPlanarAnalytical::SetNumberOfPlanes ( G4int  vNumberOfPlanes)

Definition at line 44 of file XVCrystalPlanarAnalytical.cc.

44  {
45  fNumberOfPlanes = vNumberOfPlanes;
46 }

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