slic/src
diff -u -r1.10 -r1.11
--- EventSourceManager.cc 22 Sep 2005 21:39:05 -0000 1.10
+++ EventSourceManager.cc 28 Sep 2005 21:08:59 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/EventSourceManager.cc,v 1.10 2005/09/22 21:39:05 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/EventSourceManager.cc,v 1.11 2005/09/28 21:08:59 jeremy Exp $
#include "EventSourceManager.hh"
// slic
@@ -12,6 +12,13 @@
// lcdd
#include "StringUtil.hh"
+// std
+#include <iostream>
+
+using std::cout;
+using std::cerr;
+using std::endl;
+
namespace slic
{
@@ -237,29 +244,42 @@
void EventSourceManager::setupEventSource(ESourceType st)
{
- // is new type of source?
- if ( isNewSource(st) ) {
+ // is a known source type?
+ if ( st != eUnknown ) {
- // set new source type
- m_sourceType = st;
+ // is new type of source?
+ if ( isNewSource(st) ) {
- // delete current source
- deleteCurrentEventSource();
+ // set new source type
+ m_sourceType = st;
- // create new source
- m_currentEventSource = createEventSource( m_sourceType );
+ // delete current source
+ deleteCurrentEventSource();
- if ( !m_currentEventSource ) {
- std::cerr << "ERROR: Failed to setup a valid event source." << std::endl;
+ // create new source
+ m_currentEventSource = createEventSource( m_sourceType );
}
+ else {
+ cout << "Type of new event source is same as old -- keeping old source." << endl;
+ }
+ }
+ else {
+ G4Exception("Event Source type is unknown.");
}
}
void EventSourceManager::setupEventSource(const std::string& s)
{
- setupEventSource( getSourceTypeFromName( s ) );
+ ESourceType st = getSourceTypeFromName( s );
+ if ( st != eUnknown ) {
+ setupEventSource( st );
+ }
+ else {
+ cerr << "ERROR: The name <" << s << "> is not a valid event source. New source was NOT created." << endl;
+ }
}
+
EventSource* EventSourceManager::getCurrentSource()
{
return m_currentEventSource;
@@ -271,7 +291,7 @@
* Start the event timer, as generation occurs before EventAction::BeginOfEventAction().
*
* Event generation is the real start of processing for the event.
- */
+ */
EventAction::getEventAction()->startEventTimer();
// begin event action of current source