Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 48 of file G4LatticeManager.hh.

Member Typedef Documentation

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

Definition at line 90 of file G4LatticeManager.hh.

Definition at line 89 of file G4LatticeManager.hh.

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

Definition at line 96 of file G4LatticeManager.hh.

Definition at line 95 of file G4LatticeManager.hh.

Member Function Documentation

void G4LatticeManager::Clear ( )
protected

Definition at line 80 of file G4LatticeManager.cc.

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

Here is the caller graph for this function:

G4LatticeLogical * G4LatticeManager::GetLattice ( G4Material Mat) const

Definition at line 210 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

G4LatticePhysical * G4LatticeManager::GetLattice ( G4VPhysicalVolume Vol) const

Definition at line 229 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

G4LatticeManager * G4LatticeManager::GetLatticeManager ( )
static

Definition at line 90 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4LatticeManager::HasLattice ( G4Material Mat) const

Definition at line 255 of file G4LatticeManager.cc.

255  {
256  return (fLLatticeList.find(Mat) != fLLatticeList.end());
257 }
LatticeMatMap fLLatticeList
G4bool G4LatticeManager::HasLattice ( G4VPhysicalVolume Vol) const

Definition at line 249 of file G4LatticeManager.cc.

249  {
250  return (fPLatticeList.find(Vol) != fPLatticeList.end());
251 }
LatticeVolMap fPLatticeList
G4LatticeLogical * G4LatticeManager::LoadLattice ( G4Material Mat,
const G4String latDir 
)

Definition at line 123 of file G4LatticeManager.cc.

124  {
125  if (verboseLevel) {
126  G4cout << "G4LatticeManager::LoadLattice material " << Mat->GetName()
127  << " " << latDir << G4endl;
128  }
129 
130  G4LatticeReader latReader(verboseLevel);
131  G4LatticeLogical* newLat = latReader.MakeLattice(latDir+"/config.txt");
132  if (verboseLevel>1) G4cout << " Created newLat " << newLat << G4endl;
133 
134  if (newLat) RegisterLattice(Mat, newLat);
135  else {
136  G4cerr << "ERROR creating " << latDir << " lattice for material "
137  << Mat->GetName() << G4endl;
138  }
139 
140  return newLat;
141 }
const G4String & GetName() const
Definition: G4Material.hh:178
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 145 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

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

Definition at line 265 of file G4LatticeManager.cc.

267  {
268  G4LatticePhysical* theLattice = GetLattice(Vol);
269  if (verboseLevel)
270  G4cout << "G4LatticeManager::MapKtoV using lattice " << theLattice
271  << G4endl;
272 
273  // If no lattice available, use generic "speed of sound"
274  return theLattice ? theLattice->MapKtoV(polarizationState, k) : 300.*m/s;
275 }
G4double MapKtoV(G4int, G4ThreeVector) const
const XML_Char * s
Definition: expat.h:262
G4GLOB_DLL std::ostream G4cout
static constexpr double m
Definition: G4SIunits.hh:129
#define G4endl
Definition: G4ios.hh:61
G4LatticeLogical * GetLattice(G4Material *) const

Here is the call graph for this function:

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

Definition at line 283 of file G4LatticeManager.cc.

285  {
286  G4LatticePhysical* theLattice = GetLattice(Vol);
287  if (verboseLevel)
288  G4cout << "G4LatticeManager::MapKtoVDir using lattice " << theLattice
289  << G4endl;
290 
291  // If no lattice available, propagate along input wavevector
292  return theLattice ? theLattice->MapKtoVDir(polarizationState, k) : k.unit();
293 }
G4GLOB_DLL std::ostream G4cout
G4ThreeVector MapKtoVDir(G4int, G4ThreeVector) const
Hep3Vector unit() const
#define G4endl
Definition: G4ios.hh:61
G4LatticeLogical * GetLattice(G4Material *) const

Here is the call graph for this function:

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

Definition at line 172 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 195 of file G4LatticeManager.cc.

196  {
197  if (!Vol || !LLat) return false; // Don't register null pointers
198 
199  // Make sure logical lattice is registered for material
201 
202  // Create and register new physical lattice to go with volume
203  return RegisterLattice(Vol, new G4LatticePhysical(LLat, Vol->GetFrameRotation()));
204 }
G4Material * GetMaterial() const
const G4RotationMatrix * GetFrameRotation() const
G4LogicalVolume * GetLogicalVolume() const
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)

Here is the call graph for this function:

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

Definition at line 103 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

void G4LatticeManager::Reset ( )

Definition at line 64 of file G4LatticeManager.cc.

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

Here is the call graph for this function:

void G4LatticeManager::SetVerboseLevel ( G4int  vb)
inline

Definition at line 55 of file G4LatticeManager.hh.

55 { verboseLevel = vb; }

Member Data Documentation

LatticeMatMap G4LatticeManager::fLLatticeList
protected

Definition at line 93 of file G4LatticeManager.hh.

LatticeLogReg G4LatticeManager::fLLattices
protected

Definition at line 92 of file G4LatticeManager.hh.

LatticeVolMap G4LatticeManager::fPLatticeList
protected

Definition at line 99 of file G4LatticeManager.hh.

LatticePhyReg G4LatticeManager::fPLattices
protected

Definition at line 98 of file G4LatticeManager.hh.

G4int G4LatticeManager::verboseLevel
protected

Definition at line 87 of file G4LatticeManager.hh.


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