Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
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 74 of file G4LatticeManager.cc.

References fLLatticeList, fLLattices, fPLatticeList, and fPLattices.

Referenced by Reset().

74  {
75  fPLatticeList.clear();
76  fPLattices.clear();
77 
78  fLLatticeList.clear();
79  fLLattices.clear();
80 }
LatticeVolMap fPLatticeList
LatticePhyReg fPLattices
LatticeMatMap fLLatticeList
LatticeLogReg fLLattices
G4LatticeLogical * G4LatticeManager::GetLattice ( G4Material Mat) const

Definition at line 195 of file G4LatticeManager.cc.

References fLLatticeList, G4cerr, G4cout, G4endl, G4Material::GetName(), and verboseLevel.

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

195  {
196  LatticeMatMap::const_iterator latFind = fLLatticeList.find(Mat);
197  if (latFind != fLLatticeList.end()) {
198  if (verboseLevel)
199  G4cout << "G4LatticeManager::GetLattice found " << latFind->second
200  << " for " << (Mat?Mat->GetName():"NULL") << "." << G4endl;
201  return latFind->second;
202  }
203 
204 
205  if (verboseLevel)
206  G4cerr << "G4LatticeManager:: Found no matching lattices for "
207  << (Mat?Mat->GetName():"NULL") << "." << G4endl;
208 
209  return 0; // No lattice associated with volume
210 }
const G4String & GetName() const
Definition: G4Material.hh:176
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
LatticeMatMap fLLatticeList
G4GLOB_DLL std::ostream G4cerr
G4LatticePhysical * G4LatticeManager::GetLattice ( G4VPhysicalVolume Vol) const

Definition at line 215 of file G4LatticeManager.cc.

References fPLatticeList, G4cerr, G4cout, G4endl, G4VPhysicalVolume::GetName(), and verboseLevel.

215  {
216  LatticeVolMap::const_iterator latFind = fPLatticeList.find(Vol);
217  if (latFind != fPLatticeList.end()) {
218  if (verboseLevel)
219  G4cout << "G4LatticeManager::GetLattice found " << latFind->second
220  << " for " << (Vol?Vol->GetName():"default") << "." << G4endl;
221  return latFind->second;
222  }
223 
224  if (verboseLevel)
225  G4cerr << "G4LatticeManager::GetLattice found no matching lattices for "
226  << (Vol?Vol->GetName():"default") << "." << G4endl;
227 
228  return 0; // No lattice associated with volume
229 }
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
LatticeVolMap fPLatticeList
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4LatticeManager * G4LatticeManager::GetLatticeManager ( )
static

Definition at line 84 of file G4LatticeManager.cc.

Referenced by XPhononStackingAction::ClassifyNewTrack(), and G4VPhononProcess::StartTracking().

84  {
85  //if no lattice manager exists, create one.
86  if (!fLM) fLM = new G4LatticeManager();
87  return fLM;
88 }
G4bool G4LatticeManager::HasLattice ( G4Material Mat) const

Definition at line 241 of file G4LatticeManager.cc.

References fLLatticeList.

241  {
242  return (fLLatticeList.find(Mat) != fLLatticeList.end());
243 }
LatticeMatMap fLLatticeList
G4bool G4LatticeManager::HasLattice ( G4VPhysicalVolume Vol) const

Definition at line 235 of file G4LatticeManager.cc.

References fPLatticeList.

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

Definition at line 112 of file G4LatticeManager.cc.

References G4cerr, G4cout, G4endl, G4Material::GetName(), G4LatticeReader::MakeLattice(), RegisterLattice(), and verboseLevel.

Referenced by LoadLattice().

113  {
114  if (verboseLevel) {
115  G4cout << "G4LatticeManager::LoadLattice material " << Mat->GetName()
116  << " " << latDir << G4endl;
117  }
118 
119  G4LatticeReader latReader(verboseLevel);
120  G4LatticeLogical* newLat = latReader.MakeLattice(latDir+"/config.txt");
121  if (verboseLevel>1) G4cout << " Created newLat " << newLat << G4endl;
122 
123  if (newLat) RegisterLattice(Mat, newLat);
124  else {
125  G4cerr << "ERROR creating " << latDir << " lattice for material "
126  << Mat->GetName() << G4endl;
127  }
128 
129  return newLat;
130 }
const G4String & GetName() const
Definition: G4Material.hh:176
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)
G4GLOB_DLL std::ostream G4cerr
G4LatticePhysical * G4LatticeManager::LoadLattice ( G4VPhysicalVolume Vol,
const G4String latDir 
)

Definition at line 134 of file G4LatticeManager.cc.

References G4cout, G4endl, G4VPhysicalVolume::GetFrameRotation(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetMaterial(), G4VPhysicalVolume::GetName(), LoadLattice(), RegisterLattice(), and verboseLevel.

135  {
136  if (verboseLevel) {
137  G4cout << "G4LatticeManager::LoadLattice volume " << Vol->GetName()
138  << " " << latDir << G4endl;
139  }
140 
141  G4Material* theMat = Vol->GetLogicalVolume()->GetMaterial();
142 
143  // Create and register the logical lattice, then the physical lattice
144  G4LatticeLogical* lLattice = LoadLattice(theMat, latDir);
145  if (!lLattice) return 0;
146 
147  G4LatticePhysical* pLattice =
148  new G4LatticePhysical(lLattice, Vol->GetFrameRotation());
149  if (pLattice) RegisterLattice(Vol, pLattice);
150 
151  if (verboseLevel>1) G4cout << " Created pLattice " << pLattice << G4endl;
152 
153  return pLattice;
154 }
G4Material * GetMaterial() const
const G4RotationMatrix * GetFrameRotation() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
G4LatticeLogical * LoadLattice(G4Material *, const G4String &latDir)
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)
G4double G4LatticeManager::MapKtoV ( G4VPhysicalVolume Vol,
G4int  polarizationState,
const G4ThreeVector k 
) const

Definition at line 251 of file G4LatticeManager.cc.

References G4cout, G4endl, GetLattice(), python.hepunit::m, G4LatticePhysical::MapKtoV(), and verboseLevel.

Referenced by XPhononStackingAction::ClassifyNewTrack().

253  {
254  G4LatticePhysical* theLattice = GetLattice(Vol);
255  if (verboseLevel)
256  G4cout << "G4LatticeManager::MapKtoV using lattice " << theLattice
257  << G4endl;
258 
259  // If no lattice available, use generic "speed of sound"
260  return theLattice ? theLattice->MapKtoV(polarizationState, k) : 300.*m/s;
261 }
const XML_Char * s
G4double MapKtoV(G4int, G4ThreeVector) const
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4LatticeLogical * GetLattice(G4Material *) const
G4ThreeVector G4LatticeManager::MapKtoVDir ( G4VPhysicalVolume Vol,
G4int  polarizationState,
const G4ThreeVector k 
) const

Definition at line 269 of file G4LatticeManager.cc.

References G4cout, G4endl, GetLattice(), G4LatticePhysical::MapKtoVDir(), CLHEP::Hep3Vector::unit(), and verboseLevel.

Referenced by XPhononStackingAction::ClassifyNewTrack().

271  {
272  G4LatticePhysical* theLattice = GetLattice(Vol);
273  if (verboseLevel)
274  G4cout << "G4LatticeManager::MapKtoVDir using lattice " << theLattice
275  << G4endl;
276 
277  // If no lattice available, propagate along input wavevector
278  return theLattice ? theLattice->MapKtoVDir(polarizationState, k) : k.unit();
279 }
G4GLOB_DLL std::ostream G4cout
G4ThreeVector MapKtoVDir(G4int, G4ThreeVector) const
Hep3Vector unit() const
#define G4endl
Definition: G4ios.hh:61
G4LatticeLogical * GetLattice(G4Material *) const
G4bool G4LatticeManager::RegisterLattice ( G4VPhysicalVolume Vol,
G4LatticePhysical Lat 
)

Definition at line 161 of file G4LatticeManager.cc.

References fPLatticeList, fPLattices, G4cout, G4endl, and verboseLevel.

Referenced by LoadLattice(), and RegisterLattice().

162  {
163  if (!Vol || !Lat) return false; // Don't register null pointers
164 
165  // SPECIAL: Register first lattice with a null volume to act as default
166  if (fPLatticeList.empty()) fPLatticeList[0] = Lat;
167 
168  fPLattices.insert(Lat);
169  fPLatticeList[Vol] = Lat;
170 
171  if (verboseLevel) {
172  G4cout << "G4LatticeManager::RegisterLattice: "
173  << " Total number of physical lattices: " << fPLatticeList.size()-1
174  << " (" << fPLattices.size() << " unique)" << G4endl;
175  }
176 
177  return true;
178 }
G4GLOB_DLL std::ostream G4cout
LatticeVolMap fPLatticeList
#define G4endl
Definition: G4ios.hh:61
LatticePhyReg fPLattices
G4bool G4LatticeManager::RegisterLattice ( G4VPhysicalVolume Vol,
G4LatticeLogical LLat 
)

Definition at line 180 of file G4LatticeManager.cc.

References G4VPhysicalVolume::GetFrameRotation(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetMaterial(), and RegisterLattice().

181  {
182  if (!Vol || !LLat) return false; // Don't register null pointers
183 
184  // Make sure logical lattice is registered for material
186 
187  // Create and register new physical lattice to go with volume
188  return RegisterLattice(Vol, new G4LatticePhysical(LLat, Vol->GetFrameRotation()));
189 }
G4Material * GetMaterial() const
const G4RotationMatrix * GetFrameRotation() const
G4LogicalVolume * GetLogicalVolume() const
G4bool RegisterLattice(G4VPhysicalVolume *, G4LatticePhysical *)
G4bool G4LatticeManager::RegisterLattice ( G4Material Mat,
G4LatticeLogical Lat 
)

Definition at line 94 of file G4LatticeManager.cc.

References fLLatticeList, fLLattices, G4cout, G4endl, and verboseLevel.

95  {
96  if (!Mat || !Lat) return false; // Don't register null pointers
97 
98  fLLattices.insert(Lat); // Take ownership in registry
99  fLLatticeList[Mat] = Lat;
100 
101  if (verboseLevel) {
102  G4cout << "G4LatticeManager::RegisterLattice: "
103  << " Total number of logical lattices: " << fLLatticeList.size()
104  << " (" << fLLattices.size() << " unique)" << G4endl;
105  }
106 
107  return true;
108 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
LatticeMatMap fLLatticeList
LatticeLogReg fLLattices
void G4LatticeManager::Reset ( )

Definition at line 58 of file G4LatticeManager.cc.

References Clear(), fLLattices, and fPLattices.

58  {
59  for (LatticeLogReg::iterator lm=fLLattices.begin();
60  lm != fLLattices.end(); ++lm) {
61  delete (*lm);
62  }
63 
64  for (LatticePhyReg::iterator pm=fPLattices.begin();
65  pm != fPLattices.end(); ++pm) {
66  delete (*pm);
67  }
68 
69  Clear();
70 }
LatticePhyReg fPLattices
LatticeLogReg fLLattices
void G4LatticeManager::SetVerboseLevel ( G4int  vb)
inline

Definition at line 55 of file G4LatticeManager.hh.

References verboseLevel.

55 { verboseLevel = vb; }

Field Documentation

LatticeMatMap G4LatticeManager::fLLatticeList
protected

Definition at line 93 of file G4LatticeManager.hh.

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

LatticeLogReg G4LatticeManager::fLLattices
protected

Definition at line 92 of file G4LatticeManager.hh.

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

LatticeVolMap G4LatticeManager::fPLatticeList
protected

Definition at line 99 of file G4LatticeManager.hh.

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

LatticePhyReg G4LatticeManager::fPLattices
protected

Definition at line 98 of file G4LatticeManager.hh.

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

G4int G4LatticeManager::verboseLevel
protected

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