Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions
G4LatticeLogical Class Reference

#include <G4LatticeLogical.hh>

Public Types

enum  { MAXRES =322 }
 

Public Member Functions

 G4LatticeLogical ()
 
virtual ~G4LatticeLogical ()
 
void SetVerboseLevel (G4int vb)
 
G4bool LoadMap (G4int, G4int, G4int, G4String)
 
G4bool Load_NMap (G4int, G4int, G4int, G4String)
 
virtual G4double MapKtoV (G4int, const G4ThreeVector &) const
 
virtual G4ThreeVector MapKtoVDir (G4int, const G4ThreeVector &) const
 
void Dump (std::ostream &os) const
 
void DumpMap (std::ostream &os, G4int pol, const G4String &name) const
 
void Dump_NMap (std::ostream &os, G4int pol, const G4String &name) const
 
void SetDynamicalConstants (G4double Beta, G4double Gamma, G4double Lambda, G4double Mu)
 
void SetScatteringConstant (G4double b)
 
void SetAnhDecConstant (G4double a)
 
void SetLDOS (G4double LDOS)
 
void SetSTDOS (G4double STDOS)
 
void SetFTDOS (G4double FTDOS)
 
G4double GetBeta () const
 
G4double GetGamma () const
 
G4double GetLambda () const
 
G4double GetMu () const
 
G4double GetScatteringConstant () const
 
G4double GetAnhDecConstant () const
 
G4double GetLDOS () const
 
G4double GetSTDOS () const
 
G4double GetFTDOS () const
 

Detailed Description

Definition at line 42 of file G4LatticeLogical.hh.

Member Enumeration Documentation

anonymous enum
Enumerator
MAXRES 

Definition at line 86 of file G4LatticeLogical.hh.

86 { MAXRES=322 }; // Maximum map resolution (bins)

Constructor & Destructor Documentation

G4LatticeLogical::G4LatticeLogical ( )

Definition at line 40 of file G4LatticeLogical.cc.

References MAXRES, and CLHEP::Hep3Vector::set().

41  : verboseLevel(0), fVresTheta(0), fVresPhi(0), fDresTheta(0), fDresPhi(0),
42  fA(0), fB(0), fLDOS(0), fSTDOS(0), fFTDOS(0),
43  fBeta(0), fGamma(0), fLambda(0), fMu(0) {
44  for (G4int i=0; i<3; i++) {
45  for (G4int j=0; j<MAXRES; j++) {
46  for (G4int k=0; k<MAXRES; k++) {
47  fMap[i][j][k] = 0.;
48  fN_map[i][j][k].set(0.,0.,0.);
49  }
50  }
51  }
52 }
void set(double x, double y, double z)
int G4int
Definition: G4Types.hh:78
G4LatticeLogical::~G4LatticeLogical ( )
virtual

Definition at line 54 of file G4LatticeLogical.cc.

54 {;}

Member Function Documentation

void G4LatticeLogical::Dump ( std::ostream &  os) const

Definition at line 202 of file G4LatticeLogical.cc.

References Dump_NMap(), and DumpMap().

Referenced by operator<<().

202  {
203  os << "dyn " << fBeta << " " << fGamma << " " << fLambda << " " << fMu
204  << "\nscat " << fB << " decay " << fA
205  << "\nLDOS " << fLDOS << " STDOS " << fSTDOS << " FTDOS " << fFTDOS
206  << std::endl;
207 
208  Dump_NMap(os, 0, "LVec.ssv");
209  Dump_NMap(os, 1, "FTVec.ssv");
210  Dump_NMap(os, 2, "STVec.ssv");
211 
212  DumpMap(os, 0, "L.ssv");
213  DumpMap(os, 1, "FT.ssv");
214  DumpMap(os, 2, "ST.ssv");
215 }
void Dump_NMap(std::ostream &os, G4int pol, const G4String &name) const
void DumpMap(std::ostream &os, G4int pol, const G4String &name) const
void G4LatticeLogical::Dump_NMap ( std::ostream &  os,
G4int  pol,
const G4String name 
) const

Definition at line 229 of file G4LatticeLogical.cc.

References CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by Dump().

230  {
231  os << "VDir " << name << " " << (pol==0?"L":pol==1?"FT":pol==2?"ST":"??")
232  << " " << fDresTheta << " " << fDresPhi << std::endl;
233 
234  for (G4int iTheta=0; iTheta<fDresTheta; iTheta++) {
235  for (G4int iPhi=0; iPhi<fDresPhi; iPhi++) {
236  os << fN_map[pol][iTheta][iPhi].x()
237  << " " << fN_map[pol][iTheta][iPhi].y()
238  << " " << fN_map[pol][iTheta][iPhi].z()
239  << std::endl;
240  }
241  }
242 }
double x() const
int G4int
Definition: G4Types.hh:78
double z() const
double y() const
void G4LatticeLogical::DumpMap ( std::ostream &  os,
G4int  pol,
const G4String name 
) const

Definition at line 217 of file G4LatticeLogical.cc.

Referenced by Dump().

218  {
219  os << "VG " << name << " " << (pol==0?"L":pol==1?"FT":pol==2?"ST":"??")
220  << " " << fVresTheta << " " << fVresPhi << std::endl;
221 
222  for (G4int iTheta=0; iTheta<fVresTheta; iTheta++) {
223  for (G4int iPhi=0; iPhi<fVresPhi; iPhi++) {
224  os << fMap[pol][iTheta][iPhi] << std::endl;
225  }
226  }
227 }
int G4int
Definition: G4Types.hh:78
G4double G4LatticeLogical::GetAnhDecConstant ( ) const
inline

Definition at line 80 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetAnhDecConstant().

80 { return fA; }
G4double G4LatticeLogical::GetBeta ( ) const
inline

Definition at line 75 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetBeta().

75 { return fBeta; }
G4double G4LatticeLogical::GetFTDOS ( ) const
inline

Definition at line 83 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetFTDOS().

83 { return fFTDOS; }
G4double G4LatticeLogical::GetGamma ( ) const
inline

Definition at line 76 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetGamma().

76 { return fGamma; }
G4double G4LatticeLogical::GetLambda ( ) const
inline

Definition at line 77 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetLambda().

77 { return fLambda; }
G4double G4LatticeLogical::GetLDOS ( ) const
inline

Definition at line 81 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetLDOS().

81 { return fLDOS; }
G4double G4LatticeLogical::GetMu ( ) const
inline

Definition at line 78 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetMu().

78 { return fMu; }
G4double G4LatticeLogical::GetScatteringConstant ( ) const
inline

Definition at line 79 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetScatteringConstant().

79 { return fB; }
G4double G4LatticeLogical::GetSTDOS ( ) const
inline

Definition at line 82 of file G4LatticeLogical.hh.

Referenced by G4LatticePhysical::GetSTDOS().

82 { return fSTDOS; }
G4bool G4LatticeLogical::Load_NMap ( G4int  tRes,
G4int  pRes,
G4int  polarizationState,
G4String  map 
)

Definition at line 98 of file G4LatticeLogical.cc.

References G4String::data(), G4cerr, G4cout, G4endl, MAXRES, CLHEP::Hep3Vector::set(), CLHEP::Hep3Vector::unit(), test::x, and z.

Referenced by G4LatticeReader::ProcessNMap().

99  {
100  if (tRes>MAXRES || pRes>MAXRES) {
101  G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of "
102  << MAXRES << " by " << MAXRES << ". terminating." << G4endl;
103  return false; //terminate if resolution out of bounds.
104  }
105 
106  std::ifstream fMapFile(map.data());
107  if(!fMapFile.is_open()) return false;
108 
109  G4double x,y,z; // Buffers to read coordinates from file
110  G4ThreeVector dir;
111  for (G4int theta = 0; theta<tRes; theta++) {
112  for (G4int phi = 0; phi<pRes; phi++) {
113  fMapFile >> x >> y >> z;
114  dir.set(x,y,z);
115  fN_map[polarizationState][theta][phi] = dir.unit(); // Enforce unity
116  }
117  }
118 
119  if (verboseLevel) {
120  G4cout << "\nG4LatticeLogical::Load_NMap(" << map << ") successful"
121  << " (Vdir " << tRes << " x " << pRes << " for polarization "
122  << polarizationState << ")." << G4endl;
123  }
124 
125  fDresTheta=tRes; //store map dimensions
126  fDresPhi=pRes;
127  return true;
128 }
void set(double x, double y, double z)
G4double z
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
const char * data() const
Hep3Vector unit() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr
G4bool G4LatticeLogical::LoadMap ( G4int  tRes,
G4int  pRes,
G4int  polarizationState,
G4String  map 
)

Definition at line 62 of file G4LatticeLogical.cc.

References G4String::data(), G4cerr, G4cout, G4endl, python.hepunit::m, and MAXRES.

Referenced by G4LatticeReader::ProcessMap().

63  {
64  if (tRes>MAXRES || pRes>MAXRES) {
65  G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of "
66  << MAXRES << " by " << MAXRES << ". terminating." << G4endl;
67  return false; //terminate if resolution out of bounds.
68  }
69 
70  std::ifstream fMapFile(map.data());
71  if (!fMapFile.is_open()) return false;
72 
73  G4double vgrp = 0.;
74  for (G4int theta = 0; theta<tRes; theta++) {
75  for (G4int phi = 0; phi<pRes; phi++) {
76  fMapFile >> vgrp;
77  fMap[polarizationState][theta][phi] = vgrp * (m/s);
78  }
79  }
80 
81  if (verboseLevel) {
82  G4cout << "\nG4LatticeLogical::LoadMap(" << map << ") successful"
83  << " (Vg scalars " << tRes << " x " << pRes << " for polarization "
84  << polarizationState << ")." << G4endl;
85  }
86 
87  fVresTheta=tRes; //store map dimensions
88  fVresPhi=pRes;
89  return true;
90 }
const XML_Char * s
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
const char * data() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr
G4double G4LatticeLogical::MapKtoV ( G4int  polarizationState,
const G4ThreeVector k 
) const
virtual

Definition at line 136 of file G4LatticeLogical.cc.

References G4cout, G4endl, CLHEP::Hep3Vector::getPhi(), CLHEP::Hep3Vector::getTheta(), int(), python.hepunit::pi, and python.hepunit::twopi.

Referenced by G4LatticePhysical::MapKtoV().

137  {
138  G4double theta, phi, tRes, pRes;
139 
140  tRes=pi/fVresTheta;
141  pRes=twopi/fVresPhi;
142 
143  theta=k.getTheta();
144  phi=k.getPhi();
145 
146  if(phi<0) phi = phi + twopi;
147  if(theta>pi) theta=theta-pi;
148 
149  G4double Vg = fMap[polarizationState][int(theta/tRes)][int(phi/pRes)];
150 
151  if(Vg == 0){
152  G4cout<<"\nFound v=0 for polarization "<<polarizationState
153  <<" theta "<<theta<<" phi "<<phi<< " translating to map coords "
154  <<"theta "<< int(theta/tRes) << " phi " << int(phi/pRes)<<G4endl;
155  }
156 
157  if (verboseLevel>1) {
158  G4cout << "G4LatticeLogical::MapKtoV theta,phi=" << theta << " " << phi
159  << " : ith,iph " << int(theta/tRes) << " " << int(phi/pRes)
160  << " : V " << Vg << G4endl;
161  }
162 
163  return Vg;
164 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
double getTheta() const
G4GLOB_DLL std::ostream G4cout
double getPhi() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4ThreeVector G4LatticeLogical::MapKtoVDir ( G4int  polarizationState,
const G4ThreeVector k 
) const
virtual

Definition at line 172 of file G4LatticeLogical.cc.

References G4cout, G4endl, CLHEP::Hep3Vector::getPhi(), CLHEP::Hep3Vector::getTheta(), int(), and python.hepunit::pi.

Referenced by G4LatticePhysical::MapKtoVDir().

173  {
174  G4double theta, phi, tRes, pRes;
175 
176  tRes=pi/(fDresTheta-1);//The summant "-1" is required:index=[0:array length-1]
177  pRes=2*pi/(fDresPhi-1);
178 
179  theta=k.getTheta();
180  phi=k.getPhi();
181 
182  if(theta>pi) theta=theta-pi;
183  //phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
184  if(phi<0) phi = phi + 2*pi;
185 
186  G4int iTheta = int(theta/tRes+0.5);
187  G4int iPhi = int(phi/pRes+0.5);
188 
189  if (verboseLevel>1) {
190  G4cout << "G4LatticeLogical::MapKtoVDir theta,phi=" << theta << " " << phi
191  << " : ith,iph " << iTheta << " " << iPhi
192  << " : dir " << fN_map[polarizationState][iTheta][iPhi] << G4endl;
193  }
194 
195  return fN_map[polarizationState][iTheta][iPhi];
196 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
double getTheta() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
double getPhi() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4LatticeLogical::SetAnhDecConstant ( G4double  a)
inline

Definition at line 70 of file G4LatticeLogical.hh.

References test::a.

Referenced by G4LatticeReader::ProcessValue().

70 { fA=a; }
void G4LatticeLogical::SetDynamicalConstants ( G4double  Beta,
G4double  Gamma,
G4double  Lambda,
G4double  Mu 
)
inline

Definition at line 64 of file G4LatticeLogical.hh.

Referenced by G4LatticeReader::ProcessConstants().

65  {
66  fBeta=Beta; fGamma=Gamma; fLambda=Lambda; fMu=Mu;
67  }
void G4LatticeLogical::SetFTDOS ( G4double  FTDOS)
inline

Definition at line 73 of file G4LatticeLogical.hh.

Referenced by G4LatticeReader::ProcessValue().

73 { fFTDOS=FTDOS; }
void G4LatticeLogical::SetLDOS ( G4double  LDOS)
inline

Definition at line 71 of file G4LatticeLogical.hh.

Referenced by G4LatticeReader::ProcessValue().

71 { fLDOS=LDOS; }
void G4LatticeLogical::SetScatteringConstant ( G4double  b)
inline

Definition at line 69 of file G4LatticeLogical.hh.

References test::b.

Referenced by G4LatticeReader::ProcessValue().

69 { fB=b; }
void G4LatticeLogical::SetSTDOS ( G4double  STDOS)
inline

Definition at line 72 of file G4LatticeLogical.hh.

Referenced by G4LatticeReader::ProcessValue().

72 { fSTDOS=STDOS; }
void G4LatticeLogical::SetVerboseLevel ( G4int  vb)
inline

Definition at line 47 of file G4LatticeLogical.hh.

47 { verboseLevel = vb; }

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