Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -23,28 +23,23 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4GeometryCell implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4GeometryCell.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryCell.hh"
|
||||
|
||||
G4GeometryCell::G4GeometryCell(const G4VPhysicalVolume &aVolume,
|
||||
G4GeometryCell::G4GeometryCell(const G4VPhysicalVolume& aVolume,
|
||||
G4int RepNum)
|
||||
: fVPhysicalVolume(&aVolume),
|
||||
fRepNum(RepNum)
|
||||
: fVPhysicalVolume(&aVolume), fRepNum(RepNum)
|
||||
{}
|
||||
|
||||
G4GeometryCell::~G4GeometryCell()
|
||||
{}
|
||||
|
||||
|
||||
const G4VPhysicalVolume &G4GeometryCell::GetPhysicalVolume() const
|
||||
const G4VPhysicalVolume& G4GeometryCell::GetPhysicalVolume() const
|
||||
{
|
||||
return *fVPhysicalVolume;
|
||||
}
|
||||
@@ -55,14 +50,15 @@ G4int G4GeometryCell::GetReplicaNumber() const
|
||||
}
|
||||
|
||||
|
||||
G4GeometryCell::G4GeometryCell(const G4GeometryCell &rhs)
|
||||
: fVPhysicalVolume(rhs.fVPhysicalVolume),
|
||||
fRepNum(rhs.fRepNum)
|
||||
G4GeometryCell::G4GeometryCell(const G4GeometryCell& rhs)
|
||||
: fVPhysicalVolume(rhs.fVPhysicalVolume), fRepNum(rhs.fRepNum)
|
||||
{
|
||||
}
|
||||
|
||||
G4GeometryCell &G4GeometryCell::operator=(const G4GeometryCell &rhs){
|
||||
if (this != &rhs) {
|
||||
G4GeometryCell& G4GeometryCell::operator=(const G4GeometryCell& rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
fVPhysicalVolume = rhs.fVPhysicalVolume; // this is treated
|
||||
// as identifyer
|
||||
fRepNum = rhs.fRepNum;
|
||||
@@ -71,26 +67,30 @@ G4GeometryCell &G4GeometryCell::operator=(const G4GeometryCell &rhs){
|
||||
}
|
||||
|
||||
|
||||
G4bool operator==(const G4GeometryCell &k1, const G4GeometryCell &k2)
|
||||
G4bool operator==(const G4GeometryCell& k1, const G4GeometryCell& k2)
|
||||
{
|
||||
G4bool equal=true;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume())) {
|
||||
G4bool equal = true;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume()))
|
||||
{
|
||||
equal = false;
|
||||
}
|
||||
else if (k1.GetReplicaNumber() != k2.GetReplicaNumber()) {
|
||||
else if (k1.GetReplicaNumber() != k2.GetReplicaNumber())
|
||||
{
|
||||
equal = false;
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
|
||||
G4bool operator!=(const G4GeometryCell &k1, const G4GeometryCell &k2)
|
||||
G4bool operator!=(const G4GeometryCell& k1, const G4GeometryCell& k2)
|
||||
{
|
||||
G4bool unequal = false;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume())) {
|
||||
unequal = true;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume()))
|
||||
{
|
||||
unequal = true;
|
||||
}
|
||||
else if (k1.GetReplicaNumber() != k2.GetReplicaNumber()) {
|
||||
unequal = true;
|
||||
else if (k1.GetReplicaNumber() != k2.GetReplicaNumber())
|
||||
{
|
||||
unequal = true;
|
||||
}
|
||||
return unequal;
|
||||
}
|
||||
|
||||
@@ -23,30 +23,29 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4GeometryCellCmp implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4GeometryCellCmp.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryCellComp.hh"
|
||||
#include "G4GeometryCell.hh"
|
||||
//#include "G4VPhysicalVolume.hh"
|
||||
|
||||
|
||||
G4GeometryCellComp::G4GeometryCellComp()
|
||||
{}
|
||||
|
||||
G4bool G4GeometryCellComp::operator() (const G4GeometryCell &k1,
|
||||
const G4GeometryCell &k2) const
|
||||
{
|
||||
G4bool smaler=false;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume())) {
|
||||
smaler = &(k1.GetPhysicalVolume()) < &(k2.GetPhysicalVolume());
|
||||
} else {
|
||||
smaler = k1.GetReplicaNumber() < k2.GetReplicaNumber();
|
||||
}
|
||||
return smaler;
|
||||
}
|
||||
|
||||
G4bool G4GeometryCellComp::operator() (const G4GeometryCell& k1,
|
||||
const G4GeometryCell& k2) const
|
||||
{
|
||||
G4bool smaller = false;
|
||||
if (&(k1.GetPhysicalVolume()) != &(k2.GetPhysicalVolume()))
|
||||
{
|
||||
smaller = &(k1.GetPhysicalVolume()) < &(k2.GetPhysicalVolume());
|
||||
}
|
||||
else
|
||||
{
|
||||
smaller = k1.GetReplicaNumber() < k2.GetReplicaNumber();
|
||||
}
|
||||
return smaller;
|
||||
}
|
||||
|
||||
@@ -23,22 +23,19 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4GeometryCellImportance implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4GeometryCellImportance.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryCellImportance.hh"
|
||||
#include "G4GeometryCellStepStream.hh"
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const G4GeometryCellImportance &gCelli)
|
||||
std::ostream& operator<<(std::ostream& out,
|
||||
const G4GeometryCellImportance& gCelli)
|
||||
{
|
||||
for (G4GeometryCellImportance::const_iterator it = gCelli.begin();
|
||||
it != gCelli.end(); ++it) {
|
||||
for (auto it = gCelli.cbegin(); it != gCelli.cend(); ++it)
|
||||
{
|
||||
out << (*it).first << ", importance = ";
|
||||
out << (*it).second << "\n";
|
||||
}
|
||||
|
||||
@@ -23,24 +23,19 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4GeometryCellStep implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4GeometryCellStep.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryCellStep.hh"
|
||||
|
||||
G4GeometryCellStep::G4GeometryCellStep(const G4GeometryCell &preCell,
|
||||
const G4GeometryCell &postCell)
|
||||
:
|
||||
fPreGeometryCell(preCell),
|
||||
fPostGeometryCell(postCell),
|
||||
fCrossBoundary(false)
|
||||
{}
|
||||
G4GeometryCellStep::G4GeometryCellStep(const G4GeometryCell& preCell,
|
||||
const G4GeometryCell& postCell)
|
||||
: fPreGeometryCell(preCell), fPostGeometryCell(postCell)
|
||||
{
|
||||
}
|
||||
|
||||
G4GeometryCellStep::~G4GeometryCellStep()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,27 +23,23 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4GeometryCellStepStream implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4GeometryCellStepStream.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryCellStepStream.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4GeometryCellStep.hh"
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const G4GeometryCell &tk)
|
||||
std::ostream& operator<<(std::ostream& out, const G4GeometryCell& tk)
|
||||
{
|
||||
out << "Volume name = " << tk.GetPhysicalVolume().GetName() << ", ";
|
||||
out << "Replica number = " << tk.GetReplicaNumber();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const G4GeometryCellStep &ps)
|
||||
std::ostream& operator<<(std::ostream& out, const G4GeometryCellStep& ps)
|
||||
{
|
||||
out << "PreGeometryCell : " << ps.GetPreGeometryCell() << " ";
|
||||
out << "PostGeometryCell: " << ps.GetPostGeometryCell() << " ";
|
||||
|
||||
@@ -23,13 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4IStore implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4IStore.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4IStore.hh"
|
||||
@@ -46,21 +43,29 @@ G4Mutex G4IStore::IStoreMutex = G4MUTEX_INITIALIZER;
|
||||
// ***************************************************************************
|
||||
// Static class variable: ptr to single instance of class
|
||||
// ***************************************************************************
|
||||
G4ThreadLocal G4IStore* G4IStore::fInstance = 0;
|
||||
G4ThreadLocal G4IStore* G4IStore::fInstance = nullptr;
|
||||
|
||||
G4IStore::G4IStore() :
|
||||
fWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume())
|
||||
{}
|
||||
|
||||
G4IStore::G4IStore(const G4String& ParallelWorldName) :
|
||||
fWorldVolume(G4TransportationManager::GetTransportationManager()->GetParallelWorld(ParallelWorldName))
|
||||
G4IStore::G4IStore()
|
||||
: fWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()->GetWorldVolume())
|
||||
{
|
||||
G4cout << " G4IStore:: ParallelWorldName = " << ParallelWorldName << G4endl;
|
||||
G4cout << " G4IStore:: fParallelWorldVolume = " << fWorldVolume->GetName() << G4endl;
|
||||
}
|
||||
|
||||
G4IStore::G4IStore(const G4String& ParallelWorldName)
|
||||
: fWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetParallelWorld(ParallelWorldName))
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << " G4IStore:: ParallelWorldName = "
|
||||
<< ParallelWorldName << G4endl;
|
||||
G4cout << " G4IStore:: fParallelWorldVolume = "
|
||||
<< fWorldVolume->GetName() << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
G4IStore::~G4IStore()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void G4IStore::Clear()
|
||||
{
|
||||
@@ -70,17 +75,19 @@ void G4IStore::Clear()
|
||||
void G4IStore::SetWorldVolume()
|
||||
{
|
||||
G4cout << " G4IStore:: SetWorldVolume " << G4endl;
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()->GetWorldVolume();
|
||||
G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
}
|
||||
|
||||
void G4IStore::SetParallelWorldVolume(G4String paraName)
|
||||
void G4IStore::SetParallelWorldVolume(const G4String& paraName)
|
||||
{
|
||||
G4cout << " G4IStore:: SetParallelWorldVolume " << G4endl;
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()->GetParallelWorld(paraName);
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()
|
||||
->GetParallelWorld(paraName);
|
||||
G4cout << " ParallelWorld volume is: " << fWorldVolume->GetName() << G4endl;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
}
|
||||
|
||||
const G4VPhysicalVolume& G4IStore::GetWorldVolume() const
|
||||
@@ -88,76 +95,79 @@ const G4VPhysicalVolume& G4IStore::GetWorldVolume() const
|
||||
return *fWorldVolume;
|
||||
}
|
||||
|
||||
// const G4VPhysicalVolume& G4IStore::GetParallelWorldVolume() const
|
||||
// {
|
||||
// return *fParallelWorldVolume;
|
||||
// }
|
||||
|
||||
const G4VPhysicalVolume* G4IStore::GetParallelWorldVolumePointer() const
|
||||
{
|
||||
return fWorldVolume;
|
||||
}
|
||||
|
||||
void G4IStore::SetInternalIterator(const G4GeometryCell &gCell) const
|
||||
void G4IStore::SetInternalIterator(const G4GeometryCell& gCell) const
|
||||
{
|
||||
fCurrentIterator = fGeometryCelli.find(gCell);
|
||||
}
|
||||
|
||||
void G4IStore::AddImportanceGeometryCell(G4double importance,
|
||||
const G4GeometryCell &gCell)
|
||||
const G4GeometryCell& gCell)
|
||||
{
|
||||
if (importance < 0 ) {
|
||||
if (importance < 0 )
|
||||
{
|
||||
Error("AddImportanceGeometryCell() - Invalid importance value given.");
|
||||
}
|
||||
if (!IsInWorld(gCell.GetPhysicalVolume()) ) {
|
||||
if (!IsInWorld(gCell.GetPhysicalVolume()) )
|
||||
{
|
||||
Error("AddImportanceGeometryCell() - Physical volume not found!");
|
||||
}
|
||||
SetInternalIterator(gCell);
|
||||
if (fCurrentIterator!=fGeometryCelli.end()) {
|
||||
if (fCurrentIterator != fGeometryCelli.cend())
|
||||
{
|
||||
Error("AddImportanceGeometryCell() - Region already existing!");
|
||||
}
|
||||
fGeometryCelli[gCell] = importance;
|
||||
}
|
||||
|
||||
void G4IStore::AddImportanceGeometryCell(G4double importance,
|
||||
const G4VPhysicalVolume &aVolume,
|
||||
G4int aRepNum)
|
||||
const G4VPhysicalVolume& aVolume,
|
||||
G4int aRepNum)
|
||||
{
|
||||
AddImportanceGeometryCell(importance,
|
||||
G4GeometryCell(aVolume, aRepNum));
|
||||
AddImportanceGeometryCell(importance, G4GeometryCell(aVolume, aRepNum));
|
||||
}
|
||||
|
||||
void G4IStore::ChangeImportance(G4double importance,
|
||||
const G4GeometryCell &gCell){
|
||||
if (importance < 0 ) {
|
||||
const G4GeometryCell& gCell)
|
||||
{
|
||||
if (importance < 0 )
|
||||
{
|
||||
Error("ChangeImportance() - Invalid importance value given.");
|
||||
}
|
||||
if (!IsInWorld(gCell.GetPhysicalVolume()) ) {
|
||||
if (!IsInWorld(gCell.GetPhysicalVolume()))
|
||||
{
|
||||
Error("ChangeImportance() - Physical volume not found!");
|
||||
}
|
||||
SetInternalIterator(gCell);
|
||||
if (fCurrentIterator==fGeometryCelli.end()) {
|
||||
if (fCurrentIterator == fGeometryCelli.cend())
|
||||
{
|
||||
Error("ChangeImportance() - Region does not exist!");
|
||||
}
|
||||
fGeometryCelli[gCell] = importance;
|
||||
|
||||
}
|
||||
|
||||
void G4IStore::ChangeImportance(G4double importance,
|
||||
const G4VPhysicalVolume &aVolume,
|
||||
G4int aRepNum)
|
||||
const G4VPhysicalVolume& aVolume,
|
||||
G4int aRepNum)
|
||||
{
|
||||
ChangeImportance(importance, G4GeometryCell(aVolume, aRepNum));
|
||||
}
|
||||
|
||||
G4double G4IStore::GetImportance(const G4VPhysicalVolume &aVolume,
|
||||
G4int aRepNum) const
|
||||
G4double G4IStore::GetImportance(const G4VPhysicalVolume& aVolume,
|
||||
G4int aRepNum) const
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&G4IStore::IStoreMutex);
|
||||
#endif
|
||||
SetInternalIterator(G4GeometryCell(aVolume, aRepNum));
|
||||
G4GeometryCellImportance::const_iterator gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator==fGeometryCelli.end()) {
|
||||
auto gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator == fGeometryCelli.cend())
|
||||
{
|
||||
Error("GetImportance() - Region does not exist!");
|
||||
return 0.;
|
||||
}
|
||||
@@ -166,18 +176,17 @@ G4double G4IStore::GetImportance(const G4VPhysicalVolume &aVolume,
|
||||
G4MUTEXUNLOCK(&G4IStore::IStoreMutex);
|
||||
#endif
|
||||
return importance_value;
|
||||
// return (*fCurrentIterator).second;
|
||||
}
|
||||
|
||||
|
||||
G4double G4IStore::GetImportance(const G4GeometryCell &gCell) const
|
||||
G4double G4IStore::GetImportance(const G4GeometryCell& gCell) const
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&G4IStore::IStoreMutex);
|
||||
#endif
|
||||
SetInternalIterator(gCell);
|
||||
G4GeometryCellImportance::const_iterator gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator==fGeometryCelli.end()) {
|
||||
auto gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator == fGeometryCelli.cend())
|
||||
{
|
||||
std::ostringstream err_mess;
|
||||
err_mess << "GetImportance() - Region does not exist!" << G4endl
|
||||
<< "Geometry cell, " << gCell
|
||||
@@ -193,15 +202,17 @@ G4double G4IStore::GetImportance(const G4GeometryCell &gCell) const
|
||||
// return (*fCurrentIterator).second;
|
||||
}
|
||||
|
||||
G4bool G4IStore::IsKnown(const G4GeometryCell &gCell) const {
|
||||
G4bool G4IStore::IsKnown(const G4GeometryCell& gCell) const
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&G4IStore::IStoreMutex);
|
||||
#endif
|
||||
G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
|
||||
|
||||
if ( inWorldKnown ) {
|
||||
|
||||
if ( inWorldKnown )
|
||||
{
|
||||
SetInternalIterator(gCell);
|
||||
inWorldKnown = (fCurrentIterator!=fGeometryCelli.end());
|
||||
inWorldKnown = (fCurrentIterator != fGeometryCelli.cend());
|
||||
}
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXUNLOCK(&G4IStore::IStoreMutex);
|
||||
@@ -209,20 +220,17 @@ G4bool G4IStore::IsKnown(const G4GeometryCell &gCell) const {
|
||||
return inWorldKnown;
|
||||
}
|
||||
|
||||
G4bool G4IStore::IsInWorld(const G4VPhysicalVolume &aVolume) const
|
||||
G4bool G4IStore::IsInWorld(const G4VPhysicalVolume& aVolume) const
|
||||
{
|
||||
G4bool isIn(true);
|
||||
// G4cout << "G4IStore:: aVolume: " << aVolume.GetName() << G4endl;
|
||||
// G4cout << "G4IStore:: fWorld: " << fWorldVolume->GetName() << G4endl;
|
||||
if (!(aVolume == *fWorldVolume)) {
|
||||
isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
|
||||
if (!(aVolume == *fWorldVolume))
|
||||
{
|
||||
isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
|
||||
}
|
||||
return isIn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4IStore::Error(const G4String &msg) const
|
||||
void G4IStore::Error(const G4String& msg) const
|
||||
{
|
||||
G4Exception("G4IStore::Error()", "GeomBias0002", FatalException, msg);
|
||||
}
|
||||
@@ -234,9 +242,11 @@ void G4IStore::Error(const G4String &msg) const
|
||||
//
|
||||
G4IStore* G4IStore::GetInstance()
|
||||
{
|
||||
if (!fInstance)
|
||||
if (fInstance == nullptr)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "G4IStore:: Creating new MASS IStore " << G4endl;
|
||||
#endif
|
||||
fInstance = new G4IStore();
|
||||
}
|
||||
return fInstance;
|
||||
@@ -249,11 +259,13 @@ G4IStore* G4IStore::GetInstance()
|
||||
//
|
||||
G4IStore* G4IStore::GetInstance(const G4String& ParallelWorldName)
|
||||
{
|
||||
if (!fInstance)
|
||||
if (fInstance == nullptr)
|
||||
{
|
||||
G4cout << "G4IStore:: Creating new Parallel IStore " << ParallelWorldName << G4endl;
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "G4IStore:: Creating new Parallel IStore "
|
||||
<< ParallelWorldName << G4endl;
|
||||
#endif
|
||||
fInstance = new G4IStore(ParallelWorldName);
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ImportanceAlgorithm implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ImportanceAlgorithm.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4Types.hh"
|
||||
@@ -43,7 +39,7 @@
|
||||
G4Mutex G4ImportanceAlgorithm::ImportanceMutex = G4MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
G4ImportanceAlgorithm::G4ImportanceAlgorithm(): fWorned(false)
|
||||
G4ImportanceAlgorithm::G4ImportanceAlgorithm()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,7 +49,7 @@ G4ImportanceAlgorithm::~G4ImportanceAlgorithm()
|
||||
|
||||
G4Nsplit_Weight
|
||||
G4ImportanceAlgorithm::Calculate(G4double ipre,
|
||||
G4double ipost,
|
||||
G4double ipost,
|
||||
G4double init_w) const
|
||||
{
|
||||
|
||||
@@ -61,23 +57,28 @@ G4ImportanceAlgorithm::Calculate(G4double ipre,
|
||||
G4MUTEXLOCK(&G4ImportanceAlgorithm::ImportanceMutex);
|
||||
#endif
|
||||
|
||||
G4Nsplit_Weight nw = {0,0};
|
||||
if (ipost>0.){
|
||||
if (!(ipre>0.)){
|
||||
G4Nsplit_Weight nw;
|
||||
if (ipost>0.)
|
||||
{
|
||||
if (!(ipre>0.))
|
||||
{
|
||||
Error("Calculate() - ipre==0.");
|
||||
}
|
||||
G4double ipre_over_ipost = ipre/ipost;
|
||||
if ((ipre_over_ipost<0.25 || ipre_over_ipost> 4) && !fWorned) {
|
||||
if ((ipre_over_ipost<0.25 || ipre_over_ipost> 4) && !fWarned)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Calculate() - ipre_over_ipost ! in [0.25, 4]." << G4endl
|
||||
<< "ipre_over_ipost = " << ipre_over_ipost << ".";
|
||||
Warning(os.str());
|
||||
fWorned = true;
|
||||
if (ipre_over_ipost<=0) {
|
||||
Error("Calculate() - ipre_over_ipost<=0.");
|
||||
fWarned = true;
|
||||
if (ipre_over_ipost<=0)
|
||||
{
|
||||
Error("Calculate() - ipre_over_ipost<=0.");
|
||||
}
|
||||
}
|
||||
if (init_w<=0.) {
|
||||
if (init_w<=0.)
|
||||
{
|
||||
Error("Calculate() - iniitweight<= 0. found!");
|
||||
}
|
||||
|
||||
@@ -89,32 +90,36 @@ G4ImportanceAlgorithm::Calculate(G4double ipre,
|
||||
nw.fW = init_w * ipre_over_ipost;
|
||||
|
||||
// geometrical splitting for double mode
|
||||
if (ipre_over_ipost<1) {
|
||||
if ( static_cast<G4double>(nw.fN) != inv) {
|
||||
// double mode
|
||||
// probability p for splitting into n+1 tracks
|
||||
G4double p = inv - nw.fN;
|
||||
// get a random number out of [0,1)
|
||||
G4double r = G4UniformRand();
|
||||
if (r<p) {
|
||||
nw.fN++;
|
||||
}
|
||||
if (ipre_over_ipost<1)
|
||||
{
|
||||
if ( static_cast<G4double>(nw.fN) != inv)
|
||||
{
|
||||
// double mode
|
||||
// probability p for splitting into n+1 tracks
|
||||
G4double p = inv - nw.fN;
|
||||
// get a random number out of [0,1)
|
||||
G4double r = G4UniformRand();
|
||||
if (r<p)
|
||||
{
|
||||
++nw.fN;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ipre_over_ipost > 1
|
||||
// russian roulett
|
||||
else if (ipre_over_ipost>1) {
|
||||
else if (ipre_over_ipost>1) // russian roulette
|
||||
{
|
||||
// probabiity for killing track
|
||||
G4double p = 1-inv;
|
||||
// get a random number out of [0,1)
|
||||
G4double r = G4UniformRand();
|
||||
if (r<p) {
|
||||
// kill track
|
||||
nw.fN = 0;
|
||||
nw.fW = 0;
|
||||
if (r<p)
|
||||
{
|
||||
// kill track
|
||||
nw.fN = 0;
|
||||
nw.fW = 0;
|
||||
}
|
||||
else {
|
||||
nw.fN = 1;
|
||||
else
|
||||
{
|
||||
nw.fN = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,13 +129,13 @@ G4ImportanceAlgorithm::Calculate(G4double ipre,
|
||||
return nw;
|
||||
}
|
||||
|
||||
void G4ImportanceAlgorithm::Error(const G4String &msg) const
|
||||
void G4ImportanceAlgorithm::Error(const G4String& msg) const
|
||||
{
|
||||
G4Exception("G4ImportanceAlgorithm::Error()",
|
||||
"GeomBias0002", FatalException, msg);
|
||||
}
|
||||
|
||||
void G4ImportanceAlgorithm::Warning(const G4String &msg) const
|
||||
void G4ImportanceAlgorithm::Warning(const G4String& msg) const
|
||||
{
|
||||
G4Exception("G4ImportanceAlgorithm::Warning()",
|
||||
"GeomBias1001", JustWarning, msg);
|
||||
|
||||
@@ -23,18 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Nsplit_Weight implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4Nsplit_Weight.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
|
||||
std::ostream& operator<<(std::ostream &out,
|
||||
const G4Nsplit_Weight &nw)
|
||||
std::ostream& operator<<(std::ostream& out, const G4Nsplit_Weight& nw)
|
||||
{
|
||||
out << "nw.fN = " << nw.fN << ", nw.fW = " << nw.fW;
|
||||
return out;
|
||||
|
||||
@@ -23,18 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VGCellFinder implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VGCellFinder.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4VGCellFinder.hh"
|
||||
|
||||
G4VGCellFinder::G4VGCellFinder()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4VGCellFinder::~G4VGCellFinder()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VIStore implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VIStore.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4VIStore.hh"
|
||||
|
||||
G4VIStore::G4VIStore()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4VIStore::~G4VIStore()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VImportanceAlgortihm implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VImportanceAlgortihm.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4VImportanceAlgorithm.hh"
|
||||
|
||||
G4VImportanceAlgorithm::G4VImportanceAlgorithm()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4VImportanceAlgorithm::~G4VImportanceAlgorithm()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VImportanceSplitExaminer implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VImportanceSplitExaminer.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4VImportanceSplitExaminer.hh"
|
||||
|
||||
G4VImportanceSplitExaminer::G4VImportanceSplitExaminer()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4VImportanceSplitExaminer::~G4VImportanceSplitExaminer()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,20 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VWeightWindowAlgorithm implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VWeightWindowAlgorithm.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4VWeightWindowAlgorithm.hh"
|
||||
|
||||
G4VWeightWindowAlgorithm::G4VWeightWindowAlgorithm()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4VWeightWindowAlgorithm::~G4VWeightWindowAlgorithm()
|
||||
{}
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VWeightWindowStore implementation
|
||||
//
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4VWeightWindowStore
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4VWeightWindowStore.hh"
|
||||
|
||||
G4VWeightWindowStore::G4VWeightWindowStore(){}
|
||||
G4VWeightWindowStore::~G4VWeightWindowStore(){}
|
||||
G4VWeightWindowStore::G4VWeightWindowStore()
|
||||
{
|
||||
}
|
||||
|
||||
G4VWeightWindowStore::~G4VWeightWindowStore()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,72 +23,63 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4WeightWindowAlgorithm implementation
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4WeightWindowAlgorithm.cc
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
#include "G4WeightWindowAlgorithm.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
|
||||
G4WeightWindowAlgorithm::
|
||||
G4WeightWindowAlgorithm(G4double upperLimitFaktor,
|
||||
G4double survivalFaktor,
|
||||
G4int maxNumberOfSplits) :
|
||||
fUpperLimitFaktor(upperLimitFaktor),
|
||||
fSurvivalFaktor(survivalFaktor),
|
||||
fMaxNumberOfSplits(maxNumberOfSplits)
|
||||
{}
|
||||
G4WeightWindowAlgorithm(G4double upperLimitFactor,
|
||||
G4double survivalFactor,
|
||||
G4int maxNumberOfSplits)
|
||||
: fUpperLimitFactor(upperLimitFactor),
|
||||
fSurvivalFactor(survivalFactor),
|
||||
fMaxNumberOfSplits(maxNumberOfSplits)
|
||||
{
|
||||
}
|
||||
|
||||
G4WeightWindowAlgorithm::~G4WeightWindowAlgorithm()
|
||||
{}
|
||||
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
G4Nsplit_Weight
|
||||
G4WeightWindowAlgorithm::Calculate(G4double init_w,
|
||||
G4double lowerWeightBound) const {
|
||||
|
||||
G4double survivalWeight = lowerWeightBound * fSurvivalFaktor;
|
||||
G4double upperWeight = lowerWeightBound * fUpperLimitFaktor;
|
||||
G4double lowerWeightBound) const
|
||||
{
|
||||
G4double survivalWeight = lowerWeightBound * fSurvivalFactor;
|
||||
G4double upperWeight = lowerWeightBound * fUpperLimitFactor;
|
||||
|
||||
// initialize return value for case weight in window
|
||||
//
|
||||
G4Nsplit_Weight nw;
|
||||
nw.fN = 1;
|
||||
nw.fW = init_w;
|
||||
|
||||
if (init_w > upperWeight) {
|
||||
if (init_w > upperWeight)
|
||||
{
|
||||
// splitting
|
||||
|
||||
//TB G4double wi_ws = init_w/survivalWeight;
|
||||
//TB
|
||||
//
|
||||
G4double temp_wi_ws = init_w/upperWeight;
|
||||
G4int split_i = static_cast<int>(temp_wi_ws);
|
||||
if(split_i != temp_wi_ws) split_i++;
|
||||
G4int split_i = static_cast<G4int>(temp_wi_ws);
|
||||
if(split_i != temp_wi_ws) { ++split_i; }
|
||||
G4double wi_ws = init_w/split_i;
|
||||
|
||||
//TB
|
||||
//TB G4int int_wi_ws = static_cast<int>(wi_ws);
|
||||
|
||||
// values in case integer mode or in csae of double
|
||||
// mode and the lower number of splits will be diced
|
||||
//TB nw.fN = int_wi_ws;
|
||||
//TB nw.fW = survivalWeight;
|
||||
//
|
||||
nw.fN = split_i;
|
||||
nw.fW = wi_ws;
|
||||
nw.fW = wi_ws;
|
||||
|
||||
//TB if (wi_ws <= fMaxNumberOfSplits) {
|
||||
//TB if (wi_ws > int_wi_ws) {
|
||||
//TB // double mode
|
||||
//TB G4double p2 = wi_ws - int_wi_ws;
|
||||
//TB G4double r = G4UniformRand();
|
||||
//TB if (r<p2) {
|
||||
//TB nw.fN = int_wi_ws + 1;
|
||||
//TB }
|
||||
//TB // double mode
|
||||
//TB G4double p2 = wi_ws - int_wi_ws;
|
||||
//TB G4double r = G4UniformRand();
|
||||
//TB if (r<p2) {
|
||||
//TB nw.fN = int_wi_ws + 1;
|
||||
//TB }
|
||||
//TB }
|
||||
//TB }
|
||||
//TB else {
|
||||
@@ -97,23 +88,25 @@ G4WeightWindowAlgorithm::Calculate(G4double init_w,
|
||||
//TB nw.fW = init_w/fMaxNumberOfSplits;
|
||||
//TB }
|
||||
|
||||
|
||||
} else if (init_w < lowerWeightBound) {
|
||||
// Russian roulette
|
||||
}
|
||||
else if (init_w < lowerWeightBound) // Russian roulette
|
||||
{
|
||||
G4double wi_ws = init_w/survivalWeight;
|
||||
G4double p = std::max(wi_ws,1./fMaxNumberOfSplits);
|
||||
G4double r = G4UniformRand();
|
||||
if (r<p){
|
||||
if (r<p)
|
||||
{
|
||||
nw.fW = init_w/p;
|
||||
nw.fN = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
nw.fW = 0;
|
||||
nw.fN = 0;
|
||||
}
|
||||
}
|
||||
// else do nothing
|
||||
|
||||
|
||||
|
||||
return nw;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,15 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4WeightWindowStore implementation
|
||||
//
|
||||
//
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4WeightWindowStore
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4WeightWindowStore.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -42,84 +38,92 @@
|
||||
// ***************************************************************************
|
||||
// Static class variable: ptr to single instance of class
|
||||
// ***************************************************************************
|
||||
G4ThreadLocal G4WeightWindowStore* G4WeightWindowStore::fInstance = 0;
|
||||
G4ThreadLocal G4WeightWindowStore* G4WeightWindowStore::fInstance = nullptr;
|
||||
|
||||
G4WeightWindowStore::
|
||||
G4WeightWindowStore() :
|
||||
fWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()),
|
||||
fGeneralUpperEnergyBounds(),
|
||||
fCellToUpEnBoundLoWePairsMap(),
|
||||
fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end())
|
||||
{}
|
||||
G4WeightWindowStore()
|
||||
: fWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()->GetWorldVolume()),
|
||||
fGeneralUpperEnergyBounds(),
|
||||
fCellToUpEnBoundLoWePairsMap(),
|
||||
fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
|
||||
{
|
||||
}
|
||||
|
||||
G4WeightWindowStore::
|
||||
G4WeightWindowStore(const G4String& ParallelWorldName) :
|
||||
fWorldVolume(G4TransportationManager::GetTransportationManager()->GetParallelWorld(ParallelWorldName)),
|
||||
fGeneralUpperEnergyBounds(),
|
||||
fCellToUpEnBoundLoWePairsMap(),
|
||||
fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end())
|
||||
{}
|
||||
G4WeightWindowStore(const G4String& ParallelWorldName)
|
||||
: fWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetParallelWorld(ParallelWorldName)),
|
||||
fGeneralUpperEnergyBounds(),
|
||||
fCellToUpEnBoundLoWePairsMap(),
|
||||
fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
|
||||
{
|
||||
}
|
||||
|
||||
G4WeightWindowStore::~G4WeightWindowStore()
|
||||
{}
|
||||
G4WeightWindowStore::
|
||||
~G4WeightWindowStore()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4double G4WeightWindowStore::GetLowerWeight(const G4GeometryCell &gCell,
|
||||
G4double partEnergy) const
|
||||
G4double G4WeightWindowStore::
|
||||
GetLowerWeight(const G4GeometryCell& gCell,
|
||||
G4double partEnergy) const
|
||||
{
|
||||
SetInternalIterator(gCell);
|
||||
G4GeometryCellWeight::const_iterator gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator == fCellToUpEnBoundLoWePairsMap.end()) {
|
||||
auto gCellIterator = fCurrentIterator;
|
||||
if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
|
||||
{
|
||||
Error("GetLowerWitgh() - Cell does not exist!");
|
||||
return 0.;
|
||||
}
|
||||
G4UpperEnergyToLowerWeightMap upEnLoWeiPairs =
|
||||
fCurrentIterator->second;
|
||||
G4UpperEnergyToLowerWeightMap upEnLoWeiPairs = fCurrentIterator->second;
|
||||
G4double lowerWeight = -1;
|
||||
G4bool found = false;
|
||||
for (G4UpperEnergyToLowerWeightMap::iterator it =
|
||||
upEnLoWeiPairs.begin(); it != upEnLoWeiPairs.end(); it++) {
|
||||
if (partEnergy < it->first) {
|
||||
for (auto it = upEnLoWeiPairs.cbegin(); it != upEnLoWeiPairs.cend(); ++it)
|
||||
{
|
||||
if (partEnergy < it->first)
|
||||
{
|
||||
lowerWeight = it->second;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (!found)
|
||||
{
|
||||
std::ostringstream err_mess;
|
||||
err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl
|
||||
<< "Energy: " << partEnergy << ".";
|
||||
Error(err_mess.str());
|
||||
}
|
||||
return lowerWeight;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void G4WeightWindowStore::
|
||||
SetInternalIterator(const G4GeometryCell &gCell) const
|
||||
SetInternalIterator(const G4GeometryCell& gCell) const
|
||||
{
|
||||
fCurrentIterator = fCellToUpEnBoundLoWePairsMap.find(gCell);
|
||||
}
|
||||
|
||||
G4bool G4WeightWindowStore::
|
||||
IsInWorld(const G4VPhysicalVolume &aVolume) const
|
||||
IsInWorld(const G4VPhysicalVolume& aVolume) const
|
||||
{
|
||||
G4bool isIn(true);
|
||||
if (!(aVolume == *fWorldVolume)) {
|
||||
if (!(aVolume == *fWorldVolume))
|
||||
{
|
||||
isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
|
||||
}
|
||||
return isIn;
|
||||
}
|
||||
|
||||
|
||||
G4bool G4WeightWindowStore::IsKnown(const G4GeometryCell &gCell) const
|
||||
G4bool G4WeightWindowStore::
|
||||
IsKnown(const G4GeometryCell& gCell) const
|
||||
{
|
||||
G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
|
||||
|
||||
if ( inWorldKnown ) {
|
||||
|
||||
if ( inWorldKnown )
|
||||
{
|
||||
SetInternalIterator(gCell);
|
||||
inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.end());
|
||||
inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
|
||||
}
|
||||
return inWorldKnown;
|
||||
}
|
||||
@@ -132,41 +136,44 @@ void G4WeightWindowStore::Clear()
|
||||
void G4WeightWindowStore::SetWorldVolume()
|
||||
{
|
||||
G4cout << " G4IStore:: SetWorldVolume " << G4endl;
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()->GetWorldVolume();
|
||||
G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
}
|
||||
|
||||
void G4WeightWindowStore::SetParallelWorldVolume(G4String paraName)
|
||||
void G4WeightWindowStore::SetParallelWorldVolume(const G4String& paraName)
|
||||
{
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()->GetParallelWorld(paraName);
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
fWorldVolume = G4TransportationManager::GetTransportationManager()
|
||||
->GetParallelWorld(paraName);
|
||||
// fGeometryCelli = new G4GeometryCellImportance;
|
||||
}
|
||||
|
||||
|
||||
const G4VPhysicalVolume &G4WeightWindowStore::GetWorldVolume() const
|
||||
{
|
||||
return *fWorldVolume;
|
||||
}
|
||||
|
||||
const G4VPhysicalVolume* G4WeightWindowStore::GetParallelWorldVolumePointer() const
|
||||
const G4VPhysicalVolume* G4WeightWindowStore::
|
||||
GetParallelWorldVolumePointer() const
|
||||
{
|
||||
return fWorldVolume;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4WeightWindowStore::
|
||||
AddLowerWeights(const G4GeometryCell & gCell,
|
||||
const std::vector<G4double> &lowerWeights)
|
||||
AddLowerWeights(const G4GeometryCell& gCell,
|
||||
const std::vector<G4double>& lowerWeights)
|
||||
{
|
||||
if (fGeneralUpperEnergyBounds.empty()) {
|
||||
if (fGeneralUpperEnergyBounds.empty())
|
||||
{
|
||||
Error("AddLowerWeights() - No general upper energy limits set!");
|
||||
}
|
||||
if (IsKnown(gCell)) {
|
||||
if (IsKnown(gCell))
|
||||
{
|
||||
Error("AddLowerWeights() - Cell already in the store.");
|
||||
}
|
||||
if (lowerWeights.size() != fGeneralUpperEnergyBounds.size()) {
|
||||
if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
|
||||
{
|
||||
std::ostringstream err_mess;
|
||||
err_mess << "AddLowerWeights() - Mismatch between "
|
||||
<< "number of lower weights (" << lowerWeights.size()
|
||||
@@ -176,50 +183,48 @@ AddLowerWeights(const G4GeometryCell & gCell,
|
||||
}
|
||||
G4UpperEnergyToLowerWeightMap map;
|
||||
G4int i = 0;
|
||||
for (std::set<G4double, std::less<G4double> >::iterator it =
|
||||
fGeneralUpperEnergyBounds.begin();
|
||||
it != fGeneralUpperEnergyBounds.end();
|
||||
it++) {
|
||||
for (auto it = fGeneralUpperEnergyBounds.cbegin();
|
||||
it != fGeneralUpperEnergyBounds.cend(); ++it)
|
||||
{
|
||||
map[*it] = lowerWeights[i];
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
fCellToUpEnBoundLoWePairsMap[gCell] = map;
|
||||
}
|
||||
|
||||
|
||||
void G4WeightWindowStore::
|
||||
AddUpperEboundLowerWeightPairs(const G4GeometryCell &gCell,
|
||||
AddUpperEboundLowerWeightPairs(const G4GeometryCell& gCell,
|
||||
const G4UpperEnergyToLowerWeightMap& enWeMap)
|
||||
{
|
||||
if (IsKnown(gCell)) {
|
||||
if (IsKnown(gCell))
|
||||
{
|
||||
Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
|
||||
}
|
||||
if (IsKnown(gCell)) {
|
||||
if (IsKnown(gCell))
|
||||
{
|
||||
Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
|
||||
}
|
||||
fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void G4WeightWindowStore::
|
||||
SetGeneralUpperEnergyBounds(const std::set<G4double,
|
||||
std::less<G4double> > &enBounds)
|
||||
std::less<G4double> >& enBounds)
|
||||
{
|
||||
if (!fGeneralUpperEnergyBounds.empty()) {
|
||||
if (!fGeneralUpperEnergyBounds.empty())
|
||||
{
|
||||
Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
|
||||
}
|
||||
fGeneralUpperEnergyBounds = enBounds;
|
||||
}
|
||||
|
||||
|
||||
void G4WeightWindowStore::Error(const G4String &msg) const
|
||||
|
||||
void G4WeightWindowStore::Error(const G4String& msg) const
|
||||
{
|
||||
G4Exception("G4WeightWindowStore::Error()",
|
||||
"GeomBias0002", FatalException, msg);
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// Returns the instance of the singleton.
|
||||
// Creates it in case it's called for the first time.
|
||||
@@ -227,7 +232,7 @@ void G4WeightWindowStore::Error(const G4String &msg) const
|
||||
//
|
||||
G4WeightWindowStore* G4WeightWindowStore::GetInstance()
|
||||
{
|
||||
if (!fInstance)
|
||||
if (fInstance == nullptr)
|
||||
{
|
||||
fInstance = new G4WeightWindowStore();
|
||||
}
|
||||
@@ -239,13 +244,16 @@ G4WeightWindowStore* G4WeightWindowStore::GetInstance()
|
||||
// Creates it in case it's called for the first time.
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4WeightWindowStore* G4WeightWindowStore::GetInstance(const G4String& ParallelWorldName)
|
||||
G4WeightWindowStore* G4WeightWindowStore::
|
||||
GetInstance(const G4String& ParallelWorldName)
|
||||
{
|
||||
if (!fInstance)
|
||||
if (fInstance == nullptr)
|
||||
{
|
||||
G4cout << "G4IStore:: Creating new Parallel IStore " << ParallelWorldName << G4endl;
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "G4IStore:: Creating new Parallel IStore "
|
||||
<< ParallelWorldName << G4endl;
|
||||
#endif
|
||||
fInstance = new G4WeightWindowStore(ParallelWorldName);
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user