Commit in lcdd on MAIN
include/LCDDProcessor.hh+31.20 -> 1.21
src/G4Dipole.cc+3-11.1 -> 1.2
   /G4Solenoid.cc+3-11.5 -> 1.6
   /LCDDFieldManager.cc+22-31.1 -> 1.2
   /LCDDProcessor.cc+51.14 -> 1.15
   /MagneticFieldOverlay.cc+3-11.2 -> 1.3
   /global_fieldSubscriber.cc+3-141.9 -> 1.10
+42-20
7 modified files


lcdd/include
LCDDProcessor.hh 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- LCDDProcessor.hh	4 May 2006 20:48:44 -0000	1.20
+++ LCDDProcessor.hh	4 May 2006 22:22:17 -0000	1.21
@@ -64,6 +64,9 @@
   LCDDProcessor::MagneticFields::const_iterator getMagneticFieldsBegin();
   LCDDProcessor::MagneticFields::const_iterator getMagneticFieldsEnd();
 
+  // Passes mag through to LCDDFieldManager.
+  void addGlobalField(G4MagneticField* mag);
+
   // Regions
   void addRegion(std::string& name, G4Region* reg);
 

lcdd/src
G4Dipole.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- G4Dipole.cc	21 Apr 2006 23:50:53 -0000	1.1
+++ G4Dipole.cc	4 May 2006 22:22:18 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4Dipole.cc,v 1.1 2006/04/21 23:50:53 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4Dipole.cc,v 1.2 2006/05/04 22:22:18 jeremy Exp $
 
 #include "G4Dipole.hh"
 
@@ -10,6 +10,8 @@
  */
 void G4Dipole::GetFieldValue( const double Point[3], double* Bfield ) const
 {
+  //std::cout << "G4Dipole::GetFieldValue" << std::endl;
+
   double bx = 0;
   double z = Point[2];
 

lcdd/src
G4Solenoid.cc 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- G4Solenoid.cc	21 Apr 2006 23:51:27 -0000	1.5
+++ G4Solenoid.cc	4 May 2006 22:22:18 -0000	1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4Solenoid.cc,v 1.5 2006/04/21 23:51:27 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4Solenoid.cc,v 1.6 2006/05/04 22:22:18 jeremy Exp $
 
 #include "G4Solenoid.hh"
 
@@ -24,6 +24,8 @@
 // TODO: use inner/outer Z
 void G4Solenoid::GetFieldValue( const double Point[3], double* Bfield ) const
 {
+  //std::cout << "G4Solenoid::GetFieldValue" << std::endl;
+
   double this_radius = sqrt( Point[0] * Point[0] + Point[1] * Point[1] );
 
   if ( this_radius < _innerR ) {

lcdd/src
LCDDFieldManager.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- LCDDFieldManager.cc	4 May 2006 20:48:45 -0000	1.1
+++ LCDDFieldManager.cc	4 May 2006 22:22:18 -0000	1.2
@@ -26,13 +26,32 @@
 
 void LCDDFieldManager::setup()
 {
+  // Pointer to the field which will be passed to Geant4.
   G4MagneticField* field = 0;
+
+  // Setup only the global fields specified in global_field.
   if (m_globalfields.size() != 0) {
+    // Use specific list of global fields registered with LCDDFieldManager.
     field = setup(m_globalfields);
   }
-  else if (m_allfields.size() != 0) {
-    field = setup(m_allfields);
+  // No global fields, so treat all fields registered with LCDDProcessor
+  // as global.
+  else {
+
+    // Build a list of fields that were registered with the LCDDProcessor.
+    std::vector<G4MagneticField*> fields;
+    LCDDProcessor* proc = LCDDProcessor::instance();
+    for (LCDDProcessor::MagneticFields::const_iterator iter = proc->getMagneticFieldsBegin();
+	 iter != proc->getMagneticFieldsEnd();
+	 iter++) {
+      fields.push_back(iter->second);
+    }
+
+    // Setup fields from LCDDProcessor.
+    field = setup(fields);
   }
+
+  // Initialize the single or overlay field with Geant4.
   initialize(field);
 }
 
@@ -40,7 +59,7 @@
 {
   G4MagneticField* field = 0;
   if (fields.size() == 0) {
-    G4cerr << "ERROR - No fields to setup." << G4endl;
+    G4cerr << "LCDDFieldManager - No magnetic fields to setup." << G4endl;
   }
   else if (fields.size() == 1) {
     field = fields[0];

lcdd/src
LCDDProcessor.cc 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- LCDDProcessor.cc	4 May 2006 20:48:45 -0000	1.14
+++ LCDDProcessor.cc	4 May 2006 22:22:18 -0000	1.15
@@ -66,6 +66,11 @@
   m_magneticFields[name] = mag;
 }
 
+void LCDDProcessor::addGlobalField(G4MagneticField* mag)
+{
+  LCDDFieldManager::instance()->addGlobalField(mag);
+}
+
 G4MagneticField* LCDDProcessor::getMagneticField(const std::string& name)
 {
   return m_magneticFields[name];

lcdd/src
MagneticFieldOverlay.cc 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MagneticFieldOverlay.cc	4 May 2006 20:48:45 -0000	1.2
+++ MagneticFieldOverlay.cc	4 May 2006 22:22:18 -0000	1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/MagneticFieldOverlay.cc,v 1.2 2006/05/04 20:48:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/MagneticFieldOverlay.cc,v 1.3 2006/05/04 22:22:18 jeremy Exp $
 #include "MagneticFieldOverlay.hh"
 
 #include <iostream>
@@ -21,6 +21,8 @@
  */
 void MagneticFieldOverlay::GetFieldValue( const double Point[3], double *Bfield ) const
 {
+  //std::cout << "MagneticFieldOverlay::GetFieldValue" << std::endl;
+
   Bfield[0] = Bfield[1] = Bfield[2] = 0.;
   for(std::vector<G4MagneticField*>::const_iterator iter = m_fields.begin();
       iter != m_fields.end();

lcdd/src
global_fieldSubscriber.cc 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- global_fieldSubscriber.cc	4 May 2006 20:48:45 -0000	1.9
+++ global_fieldSubscriber.cc	4 May 2006 22:22:18 -0000	1.10
@@ -1,8 +1,7 @@
-// $Id: global_fieldSubscriber.cc,v 1.9 2006/05/04 20:48:45 jeremy Exp $
+// $Id: global_fieldSubscriber.cc,v 1.10 2006/05/04 22:22:18 jeremy Exp $
 
 // lcdd
 #include "LCDDProcessor.hh"
-#include "LCDDFieldManager.hh"
 #include "global_field.hh"
 #include "FieldType.hh"
 
@@ -60,22 +59,11 @@
 	    FieldType::fieldref* fref =
 	      dynamic_cast<FieldType::fieldref*>( seq->content(i).object );
 
-	    //std::cout << "fieldref: " << fref->get_ref() << std::endl;
-
 	    mag = proc->getMagneticField( fref->get_ref() );
 
 	    if (mag != 0) {
-	      LCDDFieldManager::instance()->addGlobalField(mag);
+	      LCDDProcessor::instance()->addGlobalField(mag);
 	    }
-
-	    //if ( mag ) {
-	    //  proc->setGlobalMagneticField( mag );
-	    //}
-	    /* FATAL ERROR: field was not found */
-	    //else {
-	    //  std::cerr << "Unknown field reference: " << fref->get_ref() << std::endl;
-	    //  G4Exception("Failed to setup specified global field.");
-	    //}
 	  }
 	}
 
@@ -89,3 +77,4 @@
 
 DECLARE_SUBSCRIBER_FACTORY(global_fieldSubscriber)
 
+
CVSspam 0.2.8