lcdd/include
diff -u -r1.4 -r1.5
--- G4StoreManager.hh 22 Sep 2005 22:02:33 -0000 1.4
+++ G4StoreManager.hh 9 Dec 2005 01:55:55 -0000 1.5
@@ -1,20 +1,9 @@
-// $Header: /cvs/lcd/lcdd/include/G4StoreManager.hh,v 1.4 2005/09/22 22:02:33 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4StoreManager.hh,v 1.5 2005/12/09 01:55:55 jeremy Exp $
#ifndef G4StoreManager_h
#define G4StoreManager_h 1
-// G4
-#include "G4TouchableHandle.hh"
-#include "globals.hh"
-
-// std
-#include <string>
-#include <ostream>
-
-class G4LogicalVolume;
-class G4VSolid;
-class G4VPhysicalVolume;
-class G4Region;
+// FIXME: This class actually needs to do something besides just creating "/stores/" cmd dir.
/**
@class G4StoreManager G4StoreManager.hh
@@ -22,9 +11,6 @@
G4 solids, LV, PV and regions from stores.
@note Can also dumps/clear G4 stores.
*/
-
-class G4StoreMessenger;
-
class G4StoreManager
{
@@ -40,40 +26,8 @@
// get singleton instance
static G4StoreManager* instance();
- // fetch G4 objects from their stores
- static G4VSolid* findSolid(const G4String &sname);
- static G4LogicalVolume* findLogicalVolume(const G4String &lvname);
- static G4Region* findRegion(const G4String &rname);
- static G4VPhysicalVolume* findPhysicalVolume(const G4String &pvname);
-
- // dump G4 stores
- static void dumpSolidStore(std::ostream &os);
- 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();
- static void clearLogicalVolumeStore();
- static void clearRegionStore();
- static void clearPhysicalVolumeStore();
- static void clearG4Stores(); // clear all
-
- // check if ptr is in the appropriate G4 store
- static bool isValid(const G4VSolid *s);
- static bool isValid(const G4LogicalVolume *lv);
- static bool isValid(const G4Region *reg);
- static bool isValid(const G4VPhysicalVolume *pv);
-
- // stream operators for obj dumps
- friend std::ostream& operator<<(std::ostream &os, G4LogicalVolume &lv);
- friend std::ostream& operator<<(std::ostream &os, G4VPhysicalVolume &pv);
- friend std::ostream& operator<<(std::ostream &os, G4Region ®);
-
private:
static G4StoreManager *_instance;
- G4StoreMessenger* m_messenger;
};
#endif
lcdd/include
diff -N G4StoreMessenger.hh
--- G4StoreMessenger.hh 4 Mar 2005 22:51:01 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-// $Header: /cvs/lcd/lcdd/include/Attic/G4StoreMessenger.hh,v 1.2 2005/03/04 22:51:01 jeremy Exp $
-
-#ifndef G4StoreMessenger_hh
-#define G4StoreMessenger_hh 1
-
-#include "G4UImessenger.hh"
-#include "G4UIdirectory.hh"
-#include "G4UIcommand.hh"
-
-class G4StoreManager;
-
-/**
- @class G4StoreMessenger
- @brief G4UImessenger to print info on G4 stores.
-*/
-class G4StoreMessenger : public G4UImessenger
-{
-public:
- G4StoreMessenger(G4StoreManager*);
- virtual ~G4StoreMessenger();
-public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
-
-private:
-
- void defineCommands();
-
-private:
-
- G4StoreManager* m_mgr;
-
- G4UIdirectory* m_storesDir;
- G4UIcommand* m_printCmd;
-};
-
-#endif
lcdd/src
diff -u -r1.5 -r1.6
--- G4StoreManager.cc 9 Nov 2005 08:45:39 -0000 1.5
+++ G4StoreManager.cc 9 Dec 2005 01:55:55 -0000 1.6
@@ -1,31 +1,16 @@
-// $Header: /cvs/lcd/lcdd/src/G4StoreManager.cc,v 1.5 2005/11/09 08:45:39 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4StoreManager.cc,v 1.6 2005/12/09 01:55:55 jeremy Exp $
// lcdd
#include "G4StoreManager.hh"
-#include "G4StoreMessenger.hh"
-
-// geant4
-#include "G4LogicalVolume.hh"
-#include "G4LogicalVolumeStore.hh"
-#include "G4VSolid.hh"
-#include "G4SolidStore.hh"
-#include "G4Material.hh" // for streaming LV info
-#include "G4VPhysicalVolume.hh"
-#include "G4PhysicalVolumeStore.hh"
-#include "G4Region.hh"
-#include "G4ProductionCuts.hh"
-#include "G4RegionStore.hh"
-#include "G4NavigationHistory.hh"
-#include "G4Material.hh"
-#include "G4MaterialTable.hh"
-
-using std::endl;
+#include "G4UIdirectory.hh"
G4StoreManager *G4StoreManager::_instance = 0;
G4StoreManager::G4StoreManager()
{
- m_messenger = new G4StoreMessenger( this );
+ G4UIdirectory* m_storesDir;
+ m_storesDir = new G4UIdirectory( "/stores/" );
+ m_storesDir->SetGuidance( "Commands to inspect the Geant4 object stores. [LCDD]" );
}
G4StoreManager::~G4StoreManager()
@@ -41,218 +26,3 @@
return _instance;
}
-
-G4VSolid* G4StoreManager::findSolid(const G4String &sname)
-{
- G4SolidStore *store = G4SolidStore::GetInstance();
- G4VSolid *solid = 0;
- for (G4SolidStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter)->GetName() == sname) {
- solid = (*iter);
- break;
- }
- }
- return solid;
-}
-
-G4LogicalVolume* G4StoreManager::findLogicalVolume(const G4String &lvname)
-{
- G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
- G4LogicalVolume *lv = 0;
- for (G4LogicalVolumeStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter)->GetName() == lvname) {
- lv = (*iter);
- break;
- }
- }
- return lv;
-}
-
-G4Region* G4StoreManager::findRegion(const G4String &rname)
-{
- G4RegionStore *store = G4RegionStore::GetInstance();
- G4Region *reg = 0;
- for (G4RegionStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter)->GetName() == rname) {
- reg = (*iter);
- break;
- }
- }
- return reg;
-}
-
-G4VPhysicalVolume* G4StoreManager::findPhysicalVolume(const G4String &pvname)
-{
- G4PhysicalVolumeStore *store = G4PhysicalVolumeStore::GetInstance();
- G4VPhysicalVolume *pv = 0;
- for (G4PhysicalVolumeStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter)->GetName() == pvname) {
- pv = (*iter);
- break;
- }
- }
- return pv;
-}
-
-void G4StoreManager::dumpSolidStore(std::ostream &os)
-{
- 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 << endl;
-}
-
-void G4StoreManager::dumpLogicalVolumeStore(std::ostream &os)
-{
- os << "Dumping LogicalVolumeStore..." << endl;
- G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
- os << "size <" << store->size() << ">" << endl;
- for (G4LogicalVolumeStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- // friend streamer
- os << (**iter) << endl;
- }
- os << endl;
-}
-
-void G4StoreManager::dumpRegionStore(std::ostream &os)
-{
- os << "Dumping RegionStore..." << endl;
- G4RegionStore *store = G4RegionStore::GetInstance();
- os << "size <" << store->size() << ">" << endl;
- for (G4RegionStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- // friend streamer
- os << (**iter) << endl;
- }
- os << endl;
-}
-
-void G4StoreManager::dumpPhysicalVolumeStore(std::ostream &os)
-{
- os << "Dumping PhysicalVolumeStore..." << endl;
- G4PhysicalVolumeStore *store = G4PhysicalVolumeStore::GetInstance();
- os << "size <" << store->size() << ">" << endl;
- for (G4PhysicalVolumeStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- // friend streamer
- os << (**iter) << 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();
- for (G4SolidStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter) == s) {
- return true;
- }
- }
- return false;
-}
-
-bool G4StoreManager::isValid(const G4LogicalVolume *lv)
-{
- if (!lv) { return false; }
-
- G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
- for (G4LogicalVolumeStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter) == lv) {
- return true;
- }
- }
- return false;
-}
-
-bool G4StoreManager::isValid(const G4Region *reg)
-{
- if (!reg) { return false; }
-
- G4RegionStore *store = G4RegionStore::GetInstance();
- for (G4RegionStore::const_iterator iter = store->begin();
- iter != store->end();
- iter++) {
- if ((*iter) == reg) {
- return true;
- }
- }
- return false;
-}
-
-bool G4StoreManager::isValid(const G4VPhysicalVolume *pv)
-{
- if (!pv) { return false; }
-
- 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()
- << endl;
-
- return os;
-}
-
-std::ostream& operator<<(std::ostream &os, G4VPhysicalVolume &pv)
-{
- os << pv.GetName() << '\t'
- << pv.GetCopyNo() << '\t'
- << pv.GetObjectTranslation() << '\t'
- << pv.GetObjectRotation() << '\t' // prints rot pntr
- << endl;
-
- return os;
-}
-
-std::ostream& operator<<(std::ostream &os, G4Region ®)
-{
- os << reg.GetName() << endl;
- os << "production cut <" << reg.GetProductionCuts()->GetProductionCut(0) << ">" << endl;
- return os;
-}