Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LatticeLogical Class Reference

#include <G4LatticeLogical.hh>

Public Types

enum  { MAXRES = 322 }
 

Public Member Functions

 G4LatticeLogical ()
 
virtual ~G4LatticeLogical ()=default
 
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 40 of file G4LatticeLogical.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAXRES 

Definition at line 43 of file G4LatticeLogical.hh.

44 {
45 MAXRES = 322
46 }; // Maximum map resolution (bins)

Constructor & Destructor Documentation

◆ G4LatticeLogical()

G4LatticeLogical::G4LatticeLogical ( )

Definition at line 38 of file G4LatticeLogical.cc.

39{
40 for (G4int i = 0; i < 3; i++) {
41 for (G4int j = 0; j < MAXRES; j++) {
42 for (G4int k = 0; k < MAXRES; k++) {
43 fMap[i][j][k] = 0.;
44 fN_map[i][j][k].set(0., 0., 0.);
45 }
46 }
47 }
48}
int G4int
Definition G4Types.hh:85
void set(double x, double y, double z)

◆ ~G4LatticeLogical()

virtual G4LatticeLogical::~G4LatticeLogical ( )
virtualdefault

Member Function Documentation

◆ Dump()

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

Definition at line 199 of file G4LatticeLogical.cc.

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

Referenced by operator<<().

◆ Dump_NMap()

void G4LatticeLogical::Dump_NMap ( std::ostream & os,
G4int pol,
const G4String & name ) const

Definition at line 230 of file G4LatticeLogical.cc.

231{
232 os << "VDir " << name << " "
233 << (pol == 0 ? "L"
234 : pol == 1 ? "FT"
235 : pol == 2 ? "ST"
236 : "??")
237 << " " << fDresTheta << " " << fDresPhi << std::endl;
238
239 for (G4int iTheta = 0; iTheta < fDresTheta; iTheta++) {
240 for (G4int iPhi = 0; iPhi < fDresPhi; iPhi++) {
241 os << fN_map[pol][iTheta][iPhi].x() << " " << fN_map[pol][iTheta][iPhi].y() << " "
242 << fN_map[pol][iTheta][iPhi].z() << std::endl;
243 }
244 }
245}
double z() const
double x() const
double y() const
const char * name(G4int ptype)

Referenced by Dump().

◆ DumpMap()

void G4LatticeLogical::DumpMap ( std::ostream & os,
G4int pol,
const G4String & name ) const

Definition at line 214 of file G4LatticeLogical.cc.

215{
216 os << "VG " << name << " "
217 << (pol == 0 ? "L"
218 : pol == 1 ? "FT"
219 : pol == 2 ? "ST"
220 : "??")
221 << " " << fVresTheta << " " << fVresPhi << std::endl;
222
223 for (G4int iTheta = 0; iTheta < fVresTheta; iTheta++) {
224 for (G4int iPhi = 0; iPhi < fVresPhi; iPhi++) {
225 os << fMap[pol][iTheta][iPhi] << std::endl;
226 }
227 }
228}

Referenced by Dump().

◆ GetAnhDecConstant()

G4double G4LatticeLogical::GetAnhDecConstant ( ) const
inline

Definition at line 87 of file G4LatticeLogical.hh.

87{ return fA; }

Referenced by G4LatticePhysical::GetAnhDecConstant().

◆ GetBeta()

G4double G4LatticeLogical::GetBeta ( ) const
inline

Definition at line 82 of file G4LatticeLogical.hh.

82{ return fBeta; }

Referenced by G4LatticePhysical::GetBeta().

◆ GetFTDOS()

G4double G4LatticeLogical::GetFTDOS ( ) const
inline

Definition at line 90 of file G4LatticeLogical.hh.

90{ return fFTDOS; }

Referenced by G4LatticePhysical::GetFTDOS().

◆ GetGamma()

G4double G4LatticeLogical::GetGamma ( ) const
inline

Definition at line 83 of file G4LatticeLogical.hh.

83{ return fGamma; }

Referenced by G4LatticePhysical::GetGamma().

◆ GetLambda()

G4double G4LatticeLogical::GetLambda ( ) const
inline

Definition at line 84 of file G4LatticeLogical.hh.

84{ return fLambda; }

Referenced by G4LatticePhysical::GetLambda().

◆ GetLDOS()

G4double G4LatticeLogical::GetLDOS ( ) const
inline

Definition at line 88 of file G4LatticeLogical.hh.

88{ return fLDOS; }

Referenced by G4LatticePhysical::GetLDOS().

◆ GetMu()

G4double G4LatticeLogical::GetMu ( ) const
inline

Definition at line 85 of file G4LatticeLogical.hh.

85{ return fMu; }

Referenced by G4LatticePhysical::GetMu().

◆ GetScatteringConstant()

G4double G4LatticeLogical::GetScatteringConstant ( ) const
inline

Definition at line 86 of file G4LatticeLogical.hh.

86{ return fB; }

Referenced by G4LatticePhysical::GetScatteringConstant().

◆ GetSTDOS()

G4double G4LatticeLogical::GetSTDOS ( ) const
inline

Definition at line 89 of file G4LatticeLogical.hh.

89{ return fSTDOS; }

Referenced by G4LatticePhysical::GetSTDOS().

◆ Load_NMap()

G4bool G4LatticeLogical::Load_NMap ( G4int tRes,
G4int pRes,
G4int polarizationState,
G4String map )

Definition at line 89 of file G4LatticeLogical.cc.

90{
91 if (tRes > MAXRES || pRes > MAXRES) {
92 G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of " << MAXRES << " by "
93 << MAXRES << ". terminating." << G4endl;
94 return false; // terminate if resolution out of bounds.
95 }
96
97 std::ifstream fMapFile(map.data());
98 if (! fMapFile.is_open()) {
99 return false;
100 }
101
102 G4double x, y, z; // Buffers to read coordinates from file
103 G4ThreeVector dir;
104 for (G4int theta = 0; theta < tRes; theta++) {
105 for (G4int phi = 0; phi < pRes; phi++) {
106 fMapFile >> x >> y >> z;
107 dir.set(x, y, z);
108 fN_map[polarizationState][theta][phi] = dir.unit(); // Enforce unity
109 }
110 }
111
112 if (verboseLevel != 0) {
113 G4cout << "\nG4LatticeLogical::Load_NMap(" << map << ") successful"
114 << " (Vdir " << tRes << " x " << pRes << " for polarization " << polarizationState
115 << ")." << G4endl;
116 }
117
118 fDresTheta = tRes; // store map dimensions
119 fDresPhi = pRes;
120 return true;
121}
double G4double
Definition G4Types.hh:83
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
Hep3Vector unit() const

Referenced by G4LatticeReader::ProcessNMap().

◆ LoadMap()

G4bool G4LatticeLogical::LoadMap ( G4int tRes,
G4int pRes,
G4int polarizationState,
G4String map )

Definition at line 53 of file G4LatticeLogical.cc.

54{
55 if (tRes > MAXRES || pRes > MAXRES) {
56 G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of " << MAXRES << " by "
57 << MAXRES << ". terminating." << G4endl;
58 return false; // terminate if resolution out of bounds.
59 }
60
61 std::ifstream fMapFile(map.data());
62 if (! fMapFile.is_open()) {
63 return false;
64 }
65
66 G4double vgrp = 0.;
67 for (G4int theta = 0; theta < tRes; theta++) {
68 for (G4int phi = 0; phi < pRes; phi++) {
69 fMapFile >> vgrp;
70 fMap[polarizationState][theta][phi] = vgrp * (m / s);
71 }
72 }
73
74 if (verboseLevel != 0) {
75 G4cout << "\nG4LatticeLogical::LoadMap(" << map << ") successful"
76 << " (Vg scalars " << tRes << " x " << pRes << " for polarization " << polarizationState
77 << ")." << G4endl;
78 }
79
80 fVresTheta = tRes; // store map dimensions
81 fVresPhi = pRes;
82 return true;
83}

Referenced by G4LatticeReader::ProcessMap().

◆ MapKtoV()

G4double G4LatticeLogical::MapKtoV ( G4int polarizationState,
const G4ThreeVector & k ) const
virtual

Definition at line 128 of file G4LatticeLogical.cc.

129{
130 G4double theta, phi, tRes, pRes;
131
132 tRes = pi / fVresTheta;
133 pRes = twopi / fVresPhi;
134
135 theta = k.getTheta();
136 phi = k.getPhi();
137
138 if (phi < 0) {
139 phi = phi + twopi;
140 }
141 if (theta > pi) {
142 theta = theta - pi;
143 }
144
145 G4double Vg = fMap[polarizationState][int(theta / tRes)][int(phi / pRes)];
146
147 if (Vg == 0) {
148 G4cout << "\nFound v=0 for polarization " << polarizationState << " theta " << theta << " phi "
149 << phi << " translating to map coords "
150 << "theta " << int(theta / tRes) << " phi " << int(phi / pRes) << G4endl;
151 }
152
153 if (verboseLevel > 1) {
154 G4cout << "G4LatticeLogical::MapKtoV theta,phi=" << theta << " " << phi << " : ith,iph "
155 << int(theta / tRes) << " " << int(phi / pRes) << " : V " << Vg << G4endl;
156 }
157
158 return Vg;
159}
double getTheta() const
double getPhi() const

Referenced by G4LatticePhysical::MapKtoV().

◆ MapKtoVDir()

G4ThreeVector G4LatticeLogical::MapKtoVDir ( G4int polarizationState,
const G4ThreeVector & k ) const
virtual

Definition at line 166 of file G4LatticeLogical.cc.

167{
168 G4double theta, phi, tRes, pRes;
169
170 tRes = pi / (fDresTheta - 1); // The summant "-1" is required:index=[0:array length-1]
171 pRes = 2 * pi / (fDresPhi - 1);
172
173 theta = k.getTheta();
174 phi = k.getPhi();
175
176 if (theta > pi) {
177 theta = theta - pi;
178 }
179 // phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
180 if (phi < 0) {
181 phi = phi + 2 * pi;
182 }
183
184 auto iTheta = int(theta / tRes + 0.5);
185 auto iPhi = int(phi / pRes + 0.5);
186
187 if (verboseLevel > 1) {
188 G4cout << "G4LatticeLogical::MapKtoVDir theta,phi=" << theta << " " << phi << " : ith,iph "
189 << iTheta << " " << iPhi << " : dir " << fN_map[polarizationState][iTheta][iPhi]
190 << G4endl;
191 }
192
193 return fN_map[polarizationState][iTheta][iPhi];
194}

Referenced by G4LatticePhysical::MapKtoVDir().

◆ SetAnhDecConstant()

void G4LatticeLogical::SetAnhDecConstant ( G4double a)
inline

Definition at line 77 of file G4LatticeLogical.hh.

77{ fA = a; }

Referenced by G4LatticeReader::ProcessValue().

◆ SetDynamicalConstants()

void G4LatticeLogical::SetDynamicalConstants ( G4double Beta,
G4double Gamma,
G4double Lambda,
G4double Mu )
inline

Definition at line 68 of file G4LatticeLogical.hh.

69 {
70 fBeta = Beta;
71 fGamma = Gamma;
72 fLambda = Lambda;
73 fMu = Mu;
74 }

Referenced by G4LatticeReader::ProcessConstants().

◆ SetFTDOS()

void G4LatticeLogical::SetFTDOS ( G4double FTDOS)
inline

Definition at line 80 of file G4LatticeLogical.hh.

80{ fFTDOS = FTDOS; }

Referenced by G4LatticeReader::ProcessValue().

◆ SetLDOS()

void G4LatticeLogical::SetLDOS ( G4double LDOS)
inline

Definition at line 78 of file G4LatticeLogical.hh.

78{ fLDOS = LDOS; }

Referenced by G4LatticeReader::ProcessValue().

◆ SetScatteringConstant()

void G4LatticeLogical::SetScatteringConstant ( G4double b)
inline

Definition at line 76 of file G4LatticeLogical.hh.

76{ fB = b; }

Referenced by G4LatticeReader::ProcessValue().

◆ SetSTDOS()

void G4LatticeLogical::SetSTDOS ( G4double STDOS)
inline

Definition at line 79 of file G4LatticeLogical.hh.

79{ fSTDOS = STDOS; }

Referenced by G4LatticeReader::ProcessValue().

◆ SetVerboseLevel()

void G4LatticeLogical::SetVerboseLevel ( G4int vb)
inline

Definition at line 52 of file G4LatticeLogical.hh.

52{ verboseLevel = vb; }

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