lcdd/include
diff -u -r1.3 -r1.4
--- G4StoreManager.hh 19 Mar 2005 20:28:42 -0000 1.3
+++ G4StoreManager.hh 22 Sep 2005 22:02:33 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4StoreManager.hh,v 1.3 2005/03/19 20:28:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4StoreManager.hh,v 1.4 2005/09/22 22:02:33 jeremy Exp $
#ifndef G4StoreManager_h
#define G4StoreManager_h 1
@@ -16,15 +16,15 @@
class G4VPhysicalVolume;
class G4Region;
-/**
- @class G4StoreManager G4StoreManager.hh
- @brief Singleton manager class for retrieval of
+/**
+ @class G4StoreManager G4StoreManager.hh
+ @brief Singleton manager class for retrieval of
G4 solids, LV, PV and regions from stores.
@note Can also dumps/clear G4 stores.
*/
class G4StoreMessenger;
-
+
class G4StoreManager
{
@@ -51,6 +51,7 @@
static void dumpLogicalVolumeStore(std::ostream &os);
static void dumpRegionStore(std::ostream &os);
static void dumpPhysicalVolumeStore(std::ostream &os);
+ static void dumpMaterialStore(std::ostream& os);
// clear G4 stores
static void clearSolidStore();
lcdd/src
diff -u -r1.3 -r1.4
--- G4StoreManager.cc 5 Apr 2005 23:54:33 -0000 1.3
+++ G4StoreManager.cc 22 Sep 2005 22:02:33 -0000 1.4
@@ -1,8 +1,10 @@
-// $Header: /cvs/lcd/lcdd/src/G4StoreManager.cc,v 1.3 2005/04/05 23:54:33 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4StoreManager.cc,v 1.4 2005/09/22 22:02:33 jeremy Exp $
+// lcdd
#include "G4StoreManager.hh"
#include "G4StoreMessenger.hh"
+// geant4
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4VSolid.hh"
@@ -13,6 +15,8 @@
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4NavigationHistory.hh"
+#include "G4Material.hh"
+#include "G4MaterialTable.hh"
using std::endl;
@@ -22,7 +26,7 @@
{
m_messenger = new G4StoreMessenger( this );
}
-
+
G4StoreManager::~G4StoreManager()
{}
@@ -36,7 +40,7 @@
return _instance;
}
-
+
G4VSolid* G4StoreManager::findSolid(const G4String &sname)
{
G4SolidStore *store = G4SolidStore::GetInstance();
@@ -99,72 +103,83 @@
void G4StoreManager::dumpSolidStore(std::ostream &os)
{
- os << "Dumping SolidStore..." << std::endl;
- G4SolidStore *store = G4SolidStore::GetInstance();
- os << "size <" << store->size() << ">" << std::endl;
+ os << "Dumping SolidStore..." << endl;
+ G4SolidStore *store = G4SolidStore::GetInstance();
+ os << "size <" << store->size() << ">" << endl;
for (G4SolidStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
// G4's streamer
os << (**iter) << endl;
}
- os << std::endl;
+ os << endl;
}
void G4StoreManager::dumpLogicalVolumeStore(std::ostream &os)
{
- os << "Dumping LogicalVolumeStore..." << std::endl;
+ os << "Dumping LogicalVolumeStore..." << endl;
G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
- os << "size <" << store->size() << ">" << std::endl;
+ os << "size <" << store->size() << ">" << endl;
for (G4LogicalVolumeStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
// friend streamer
os << (**iter) << endl;
}
- os << std::endl;
+ os << endl;
}
-
+
void G4StoreManager::dumpRegionStore(std::ostream &os)
{
- os << "Dumping RegionStore..." << std::endl;
+ os << "Dumping RegionStore..." << endl;
G4RegionStore *store = G4RegionStore::GetInstance();
- os << "size <" << store->size() << ">" << std::endl;
+ os << "size <" << store->size() << ">" << endl;
for (G4RegionStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
// friend streamer
os << (**iter) << endl;
}
- os << std::endl;
+ os << endl;
}
void G4StoreManager::dumpPhysicalVolumeStore(std::ostream &os)
{
- os << "Dumping PhysicalVolumeStore..." << std::endl;
+ os << "Dumping PhysicalVolumeStore..." << endl;
G4PhysicalVolumeStore *store = G4PhysicalVolumeStore::GetInstance();
- os << "size <" << store->size() << ">" << std::endl;
+ os << "size <" << store->size() << ">" << endl;
for (G4PhysicalVolumeStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
// friend streamer
os << (**iter) << endl;
}
- os << std::endl;
+ os << endl;
+}
+
+void G4StoreManager::dumpMaterialStore(std::ostream& os)
+{
+ os << "Dumping G4MaterialTable..." << endl;
+ const G4MaterialTable* materials = G4Material::GetMaterialTable();
+ for ( G4MaterialTable::const_iterator it = materials->begin();
+ it != materials->end();
+ it++ ) {
+ os << *(*it) << endl;
+ }
}
bool G4StoreManager::isValid(const G4VSolid *s)
{
if (!s) { return false; }
- G4SolidStore *store = G4SolidStore::GetInstance();
+ G4SolidStore *store = G4SolidStore::GetInstance();
for (G4SolidStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
if ((*iter) == s) {
return true;
}
- }
+ }
return false;
}
@@ -172,14 +187,14 @@
{
if (!lv) { return false; }
- G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
+ G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
for (G4LogicalVolumeStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
if ((*iter) == lv) {
return true;
}
- }
+ }
return false;
}
@@ -187,14 +202,14 @@
{
if (!reg) { return false; }
- G4RegionStore *store = G4RegionStore::GetInstance();
+ G4RegionStore *store = G4RegionStore::GetInstance();
for (G4RegionStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
if ((*iter) == reg) {
return true;
}
- }
+ }
return false;
}
@@ -202,22 +217,22 @@
{
if (!pv) { return false; }
- G4PhysicalVolumeStore *store = G4PhysicalVolumeStore::GetInstance();
+ G4PhysicalVolumeStore *store = G4PhysicalVolumeStore::GetInstance();
for (G4PhysicalVolumeStore::const_iterator iter = store->begin();
iter != store->end();
iter++) {
if ((*iter) == pv) {
return true;
}
- }
+ }
return false;
}
std::ostream& operator<<(std::ostream &os, G4LogicalVolume &lv)
{
- os << lv.GetName() << '\t'
- << lv.GetSolid()->GetName() << '\t'
- << lv.GetMaterial()->GetName()
+ os << lv.GetName() << '\t'
+ << lv.GetSolid()->GetName() << '\t'
+ << lv.GetMaterial()->GetName()
<< endl;
return os;
lcdd/src
diff -u -r1.2 -r1.3
--- G4StoreMessenger.cc 5 Apr 2005 23:54:33 -0000 1.2
+++ G4StoreMessenger.cc 22 Sep 2005 22:02:33 -0000 1.3
@@ -7,20 +7,20 @@
#include <sstream>
-G4StoreMessenger::G4StoreMessenger(G4StoreManager* mgr)
+G4StoreMessenger::G4StoreMessenger(G4StoreManager* mgr)
{
m_mgr = mgr;
defineCommands();
}
-G4StoreMessenger::~G4StoreMessenger()
+G4StoreMessenger::~G4StoreMessenger()
{
delete m_storesDir;
delete m_printCmd;
}
-void G4StoreMessenger::SetNewValue(G4UIcommand* cmd, G4String newVals)
+void G4StoreMessenger::SetNewValue(G4UIcommand* cmd, G4String newVals)
{
std::istringstream is ( ( const char* ) newVals );
@@ -31,7 +31,7 @@
if ( cmd == m_printCmd ) {
- if ( s == "region" ) {
+ if ( s == "region" || s == "regions" ) {
m_mgr->dumpRegionStore( G4cout );
}
else if ( s == "lv" ) {
@@ -40,9 +40,12 @@
else if ( s == "pv" ) {
m_mgr->dumpPhysicalVolumeStore( G4cout );
}
- else if ( s == "solid" ) {
+ else if ( s == "solid" || s == "solids" ) {
m_mgr->dumpSolidStore( G4cout );
}
+ else if ( s == "material" || s == "mat" || s == "materials" ) {
+ m_mgr->dumpMaterialStore( G4cout );
+ }
else {
G4cout << "Dumping all Geant4 Stores..." << G4endl << G4endl;
@@ -56,10 +59,10 @@
}
else {
G4cout << "Unknown command!" << G4endl;
- }
+ }
}
-void G4StoreMessenger::defineCommands()
+void G4StoreMessenger::defineCommands()
{
G4UIparameter* p;
@@ -69,7 +72,8 @@
// print a store
m_printCmd = new G4UIcommand( "/stores/print", this );
- m_printCmd->SetGuidance( "Print contents of Geant4 store: region, lv, pv or solid." );
+ m_printCmd->SetGuidance( "Print contents of Geant4 store." );
+ m_printCmd->SetGuidance( "Parameter is one of these: region, lv, pv, material, or solid." );
p = new G4UIparameter( "StoreName", 's', true );
m_printCmd->SetParameter( p );
}