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

#include <G4LatticeManager.hh>

Public Member Functions

void SetVerboseLevel (G4int vb)
 
void Reset ()
 
G4bool RegisterLattice (G4VPhysicalVolume *, G4LatticePhysical *)
 
G4bool RegisterLattice (G4VPhysicalVolume *, G4LatticeLogical *)
 
G4bool RegisterLattice (G4Material *, G4LatticeLogical *)
 
G4LatticeLogicalLoadLattice (G4Material *, const G4String &latDir)
 
G4LatticeLogicalGetLattice (G4Material *) const
 
G4bool HasLattice (G4Material *) const
 
G4LatticePhysicalLoadLattice (G4VPhysicalVolume *, const G4String &latDir)
 
G4LatticePhysicalGetLattice (G4VPhysicalVolume *) const
 
G4bool HasLattice (G4VPhysicalVolume *) const
 
G4double MapKtoV (G4VPhysicalVolume *, G4int, const G4ThreeVector &) const
 
G4ThreeVector MapKtoVDir (G4VPhysicalVolume *, G4int, const G4ThreeVector &) const
 

Static Public Member Functions

static G4LatticeManagerGetLatticeManager ()
 

Protected Types

typedef std::map< G4Material *, G4LatticeLogical * > LatticeMatMap
 
typedef std::set< G4LatticeLogical * > LatticeLogReg
 
typedef std::map< G4VPhysicalVolume *, G4LatticePhysical * > LatticeVolMap
 
typedef std::set< G4LatticePhysical * > LatticePhyReg
 

Protected Member Functions

void Clear ()
 

Protected Attributes

G4int verboseLevel
 
LatticeLogReg fLLattices
 
LatticeMatMap fLLatticeList
 
LatticePhyReg fPLattices
 
LatticeVolMap fPLatticeList
 

Detailed Description

Definition at line 47 of file G4LatticeManager.hh.

Member Typedef Documentation

◆ LatticeLogReg

typedef std::set<G4LatticeLogical*> G4LatticeManager::LatticeLogReg
protected

Definition at line 89 of file G4LatticeManager.hh.

◆ LatticeMatMap

Definition at line 88 of file G4LatticeManager.hh.

◆ LatticePhyReg

typedef std::set<G4LatticePhysical*> G4LatticeManager::LatticePhyReg
protected

Definition at line 95 of file G4LatticeManager.hh.

◆ LatticeVolMap

Definition at line 94 of file G4LatticeManager.hh.

Member Function Documentation

◆ Clear()

void G4LatticeManager::Clear ( )
protected

Definition at line 79 of file G4LatticeManager.cc.

79 {
80 fPLatticeList.clear();
81 fPLattices.clear();
82
83 fLLatticeList.clear();
84 fLLattices.clear();
85}
LatticeMatMap fLLatticeList
LatticeLogReg fLLattices
LatticePhyReg fPLattices
LatticeVolMap fPLatticeList

Referenced by Reset().

◆ GetLattice() [1/2]

G4LatticeLogical * G4LatticeManager::GetLattice ( G4Material Mat) const

Definition at line 209 of file G4LatticeManager.cc.

209 {
210 LatticeMatMap::const_iterator latFind = fLLatticeList.find(Mat);
211 if (latFind != fLLatticeList.end()) {
212 if (verboseLevel)
213 G4cout << "G4LatticeManager::GetLattice found " << latFind->second
214 << " for " << (Mat?Mat->GetName():"NULL") << "." << G4endl;
215 return latFind->second;
216 }
217
218 if (verboseLevel)
219 G4cerr << "G4LatticeManager:: Found no matching lattices for "
220 << (Mat?Mat->GetName():"NULL") << "." << G4endl;
221
222 return 0; // No lattice associated with volume
223}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
Definition: G4Material.hh:172

Referenced by MapKtoV(), MapKtoVDir(), and G4VPhononProcess::StartTracking().

◆ GetLattice() [2/2]

G4LatticePhysical * G4LatticeManager::GetLattice ( G4VPhysicalVolume Vol) const

Definition at line 228 of file G4LatticeManager.cc.

228 {
229 LatticeVolMap::const_iterator latFind = fPLatticeList.find(Vol);
230 if (latFind != fPLatticeList.end()) {
231 if (verboseLevel)
232 G4cout << "G4LatticeManager::GetLattice found " << latFind->second
233 << " for " << (Vol?Vol->GetName():"default") << "." << G4endl;
234 return latFind->second;
235 }
236
237 if (verboseLevel)
238 G4cerr << "G4LatticeManager::GetLattice found no matching lattices for "
239 << (Vol?Vol->GetName():"default") << "." << G4endl;
240
241 return 0; // No lattice associated with volume
242}
const G4String & GetName() const

◆ GetLatticeManager()

G4LatticeManager * G4LatticeManager::GetLatticeManager ( )
static

Definition at line 89 of file G4LatticeManager.cc.

89 {
90 // if no lattice manager exists, create one.
91 G4AutoLock latLock(&latMutex); // Protect before changing pointer
92 if (!fLM) fLM = new G4LatticeManager();
93 latLock.unlock();
94
95 return fLM;
96}

Referenced by G4VPhononProcess::StartTracking().

◆ HasLattice() [1/2]

G4bool G4LatticeManager::HasLattice ( G4Material Mat) const

Definition at line 254 of file G4LatticeManager.cc.

254 {
255 return (fLLatticeList.find(Mat) != fLLatticeList.end());
256}

◆ HasLattice() [2/2]

G4bool G4LatticeManager::HasLattice ( G4VPhysicalVolume Vol) const

Definition at line 248 of file G4LatticeManager.cc.

248 {
249 return (fPLatticeList.find(Vol) != fPLatticeList.end());
250}

◆ LoadLattice() [1/2]

G4LatticeLogical * G4LatticeManager::LoadLattice ( G4Material Mat,
const G4String latDir 
)

Definition at line 122 of file G4LatticeManager.cc.

123 {
124 if (verboseLevel) {
125 G4cout << "G4LatticeManager::LoadLattice material " << Mat->GetName()
126 << " " << latDir << G4endl;
127 }
128
129 G4LatticeReader latReader(verboseLevel);
130 G4LatticeLogical* newLat = latReader.MakeLattice(latDir+"/config.txt");
131 if (verboseLevel>1) G4cout << " Created newLat " << newLat << G4endl;
132
133 if (newLat) RegisterLattice(Mat, newLat);
134 else {
135 G4cerr << "ERROR creating " << latDir << " lattice for material "
136 << Mat->GetName() << G4endl;
137 }
138
139 return newLat;
140}
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)

Referenced by LoadLattice().

◆ LoadLattice() [2/2]

G4LatticePhysical * G4LatticeManager::LoadLattice ( G4VPhysicalVolume Vol,
const G4String latDir 
)

Definition at line 144 of file G4LatticeManager.cc.

145 {
146 if (verboseLevel) {
147 G4cout << "G4LatticeManager::LoadLattice volume " << Vol->GetName()
148 << " " << latDir << G4endl;
149 }
150
151 G4Material* theMat = Vol->GetLogicalVolume()->GetMaterial();
152
153 // Create and register the logical lattice, then the physical lattice
154 G4LatticeLogical* lLattice = LoadLattice(theMat, latDir);
155 if (!lLattice) return 0;
156
157 G4LatticePhysical* pLattice =
158 new G4LatticePhysical(lLattice, Vol->GetFrameRotation());
159 if (pLattice) RegisterLattice(Vol, pLattice);
160
161 if (verboseLevel>1) G4cout << " Created pLattice " << pLattice << G4endl;
162
163 return pLattice;
164}
G4LatticeLogical * LoadLattice(G4Material *, const G4String &latDir)
G4Material * GetMaterial() const
G4LogicalVolume * GetLogicalVolume() const
const G4RotationMatrix * GetFrameRotation() const

◆ MapKtoV()

G4double G4LatticeManager::MapKtoV ( G4VPhysicalVolume Vol,
G4int  polarizationState,
const G4ThreeVector k 
) const

Definition at line 264 of file G4LatticeManager.cc.

266 {
267 G4LatticePhysical* theLattice = GetLattice(Vol);
268 if (verboseLevel)
269 G4cout << "G4LatticeManager::MapKtoV using lattice " << theLattice
270 << G4endl;
271
272 // If no lattice available, use generic "speed of sound"
273 return theLattice ? theLattice->MapKtoV(polarizationState, k) : 300.*m/s;
274}
G4LatticeLogical * GetLattice(G4Material *) const
G4double MapKtoV(G4int, G4ThreeVector) const

◆ MapKtoVDir()

G4ThreeVector G4LatticeManager::MapKtoVDir ( G4VPhysicalVolume Vol,
G4int  polarizationState,
const G4ThreeVector k 
) const

Definition at line 282 of file G4LatticeManager.cc.

284 {
285 G4LatticePhysical* theLattice = GetLattice(Vol);
286 if (verboseLevel)
287 G4cout << "G4LatticeManager::MapKtoVDir using lattice " << theLattice
288 << G4endl;
289
290 // If no lattice available, propagate along input wavevector
291 return theLattice ? theLattice->MapKtoVDir(polarizationState, k) : k.unit();
292}
Hep3Vector unit() const
G4ThreeVector MapKtoVDir(G4int, G4ThreeVector) const

◆ RegisterLattice() [1/3]

G4bool G4LatticeManager::RegisterLattice ( G4Material Mat,
G4LatticeLogical Lat 
)

Definition at line 102 of file G4LatticeManager.cc.

103 {
104 if (!Mat || !Lat) return false; // Don't register null pointers
105
106 G4AutoLock latLock(&latMutex); // Protect before changing registry
107 fLLattices.insert(Lat); // Take ownership in registry
108 fLLatticeList[Mat] = Lat;
109 latLock.unlock();
110
111 if (verboseLevel) {
112 G4cout << "G4LatticeManager::RegisterLattice: "
113 << " Total number of logical lattices: " << fLLatticeList.size()
114 << " (" << fLLattices.size() << " unique)" << G4endl;
115 }
116
117 return true;
118}

◆ RegisterLattice() [2/3]

G4bool G4LatticeManager::RegisterLattice ( G4VPhysicalVolume Vol,
G4LatticeLogical LLat 
)

Definition at line 194 of file G4LatticeManager.cc.

195 {
196 if (!Vol || !LLat) return false; // Don't register null pointers
197
198 // Make sure logical lattice is registered for material
200
201 // Create and register new physical lattice to go with volume
202 return RegisterLattice(Vol, new G4LatticePhysical(LLat, Vol->GetFrameRotation()));
203}

◆ RegisterLattice() [3/3]

G4bool G4LatticeManager::RegisterLattice ( G4VPhysicalVolume Vol,
G4LatticePhysical Lat 
)

Definition at line 171 of file G4LatticeManager.cc.

172 {
173 if (!Vol || !Lat) return false; // Don't register null pointers
174
175 G4AutoLock latLock(&latMutex); // Protect before changing registry
176
177 // SPECIAL: Register first lattice with a null volume to act as default
178 if (fPLatticeList.empty()) fPLatticeList[0] = Lat;
179
180 fPLattices.insert(Lat);
181 fPLatticeList[Vol] = Lat;
182
183 latLock.unlock();
184
185 if (verboseLevel) {
186 G4cout << "G4LatticeManager::RegisterLattice: "
187 << " Total number of physical lattices: " << fPLatticeList.size()-1
188 << " (" << fPLattices.size() << " unique)" << G4endl;
189 }
190
191 return true;
192}

Referenced by LoadLattice(), and RegisterLattice().

◆ Reset()

void G4LatticeManager::Reset ( )

Definition at line 63 of file G4LatticeManager.cc.

63 {
64 for (LatticeLogReg::iterator lm=fLLattices.begin();
65 lm != fLLattices.end(); ++lm) {
66 delete (*lm);
67 }
68
69 for (LatticePhyReg::iterator pm=fPLattices.begin();
70 pm != fPLattices.end(); ++pm) {
71 delete (*pm);
72 }
73
74 Clear();
75}

◆ SetVerboseLevel()

void G4LatticeManager::SetVerboseLevel ( G4int  vb)
inline

Definition at line 54 of file G4LatticeManager.hh.

54{ verboseLevel = vb; }

Member Data Documentation

◆ fLLatticeList

LatticeMatMap G4LatticeManager::fLLatticeList
protected

Definition at line 92 of file G4LatticeManager.hh.

Referenced by Clear(), GetLattice(), HasLattice(), and RegisterLattice().

◆ fLLattices

LatticeLogReg G4LatticeManager::fLLattices
protected

Definition at line 91 of file G4LatticeManager.hh.

Referenced by Clear(), RegisterLattice(), and Reset().

◆ fPLatticeList

LatticeVolMap G4LatticeManager::fPLatticeList
protected

Definition at line 98 of file G4LatticeManager.hh.

Referenced by Clear(), GetLattice(), HasLattice(), and RegisterLattice().

◆ fPLattices

LatticePhyReg G4LatticeManager::fPLattices
protected

Definition at line 97 of file G4LatticeManager.hh.

Referenced by Clear(), RegisterLattice(), and Reset().

◆ verboseLevel

G4int G4LatticeManager::verboseLevel
protected

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