lcdd/include
diff -u -r1.3 -r1.4
--- LCDDParser.hh 19 Mar 2005 20:28:42 -0000 1.3
+++ LCDDParser.hh 27 Jun 2005 18:21:44 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/LCDDParser.hh,v 1.3 2005/03/19 20:28:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/LCDDParser.hh,v 1.4 2005/06/27 18:21:44 jeremy Exp $
#ifndef LCDDParser_h
#define LCDDParser_h 1
@@ -12,7 +12,7 @@
@class LCDDParser
@brief Parser for LCDD format.
*/
-class LCDDParser
+class LCDDParser
{
public:
@@ -57,10 +57,12 @@
// set world volume ptr
void setWorld(G4VPhysicalVolume *world);
+ bool isValid();
+
private:
SAXProcessor m_sxp;
- ProcessingConfigurator m_config;
+ ProcessingConfigurator m_config;
std::string m_URI;
std::string m_setupName;
@@ -68,6 +70,7 @@
bool m_initialized;
bool m_constructed;
+ bool m_setURI;
G4VPhysicalVolume* m_world;
lcdd/src
diff -u -r1.3 -r1.4
--- LCDDParser.cc 19 Mar 2005 20:28:43 -0000 1.3
+++ LCDDParser.cc 27 Jun 2005 18:21:44 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/LCDDParser.cc,v 1.3 2005/03/19 20:28:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/LCDDParser.cc,v 1.4 2005/06/27 18:21:44 jeremy Exp $
#include "LCDDParser.hh"
@@ -10,13 +10,14 @@
extern "C" void LCDDLibLoad();
LCDDParser* LCDDParser::m_instance = 0;
-
+
LCDDParser::LCDDParser()
: m_URI(""),
m_setupName(""),
m_version(""),
m_initialized(false),
- m_constructed(false)
+ m_constructed(false),
+ m_setURI(false)
{}
LCDDParser* LCDDParser::instance()
@@ -35,7 +36,7 @@
void LCDDParser::setupParserConfig()
{
- setupParserConfig(m_URI,
+ setupParserConfig(m_URI,
m_setupName,
m_version);
}
@@ -50,12 +51,12 @@
G4cout << "Using default SetupName <" << DefaultSetupName << ">" << G4endl;
m_setupName = DefaultSetupName;
}
-
+
// settings from messenger commands
std::cout << "LCDD URI <" << m_URI << ">" << std::endl;
std::cout << "SetupName <" << m_setupName << ">" << std::endl;
std::cout << "Version <" << m_version << ">" << std::endl;
-
+
// set configuration vals
m_config.SetURI(URI);
m_config.SetSetupName(setupName);
@@ -71,7 +72,7 @@
m_sxp.Initialize();
// load custom LCDD tag handlers
- LCDDLibLoad();
+ LCDDLibLoad();
}
void LCDDParser::initialize()
@@ -88,26 +89,29 @@
// initialize
initialize();
-
+
// set GDML parser params from inst vars
setupParserConfig();
-
+
// run the parser
m_sxp.Run();
-
+
// get world volume from GDML
m_world = (G4VPhysicalVolume*)GDMLProcessor::GetInstance()->GetWorldVolume();
-
+
// die immediately if no world volume
if (m_world == 0) {
- G4Exception("LCDDParser::construct() - NULL World Volume from GDMLProcessor. Check setup or GDML input.");
+ G4Exception("GDML failed to construct the world volume.");
}
// should only happen once
m_constructed = true;
}
-
- return m_world;
+ else {
+ std::cerr << "LCDD geometry was already constructed." << std::endl;
+ }
+
+ return m_world;
}
void LCDDParser::finalize()
@@ -118,6 +122,7 @@
void LCDDParser::setURI(std::string URI)
{
m_URI = URI;
+ m_setURI = true;
}
void LCDDParser::setSetupName(std::string setupName)
@@ -144,8 +149,19 @@
{
return m_version;
}
-
+
void LCDDParser::setWorld(G4VPhysicalVolume *world)
{
m_world = world;
}
+
+bool LCDDParser::isValid()
+{
+ bool valid = true;
+
+ if ( !m_setURI ) {
+ valid = false;
+ }
+
+ return valid;
+}