Commit in lcdd on MAIN
include/G4LimitSet.hh+84added 1.1
       /LimitParamType.hh+64added 1.1
       /LimitSetType.hh+66added 1.1
       /limitset.hh+27added 1.1
       /LCDDProcessor.hh+12-41.15 -> 1.16
       /SensitiveDetectorTypeProcess.hh+2-21.9 -> 1.10
       /StringUtil.hh+12-41.6 -> 1.7
       /limit.hh+4-91.1 -> 1.2
schemas/lcdd/1.0/limits.xsd+1-281.11 -> 1.12
src/G4LimitSet.cc+131added 1.1
   /limitsetProcess.cc+80added 1.1
   /limitsetSubscriber.cc+106added 1.1
   /limitsetrefProcess.cc+47added 1.1
   /LCDDLibLoad.cc+6-51.18 -> 1.19
   /LCDDProcessor.cc+37-211.10 -> 1.11
   /StringUtil.cc+101-331.6 -> 1.7
   /limitProcess.cc+16-261.2 -> 1.3
   /limitrefProcess.cc+5-51.2 -> 1.3
   /volumeExtendedSubscriber.cc+11-91.25 -> 1.26
   /limitSubscriber.cc-1501.4 removed
+812-296
8 added + 1 removed + 11 modified, total 20 files
Added and modified files for limit system revamp.  Can now assign limits by particle names within limit sets.

lcdd/include
G4LimitSet.hh added at 1.1
diff -N G4LimitSet.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ G4LimitSet.hh	9 Jul 2005 00:25:55 -0000	1.1
@@ -0,0 +1,84 @@
+#ifndef G4LimitSet_hh
+#define G4LimitSet_hh 1
+
+#include "G4UserLimits.hh"
+#include "globals.hh"
+
+#include <map>
+#include <string>
+
+/**
+ * G4UserLimits Looks up limits by particle type taken from the G4Track.
+ */
+
+class G4LimitSet : public G4UserLimits
+{
+public:
+  typedef G4String ParticleType;
+  typedef G4String LimitNameType;
+  typedef G4double LimitValueType;
+  typedef std::map<ParticleType, LimitValueType> LimitMap;
+  typedef std::map<LimitNameType, LimitMap> LimitSetMap;
+  typedef const G4String& LimitNameKeyType;
+
+  static const ParticleType ANY_PARTICLE;
+
+  static const LimitValueType LIMIT_NOT_SET;
+
+  static const LimitNameKeyType STEP_LENGTH_MAX_KEY;
+  static const LimitNameKeyType TRACK_LENGTH_MAX_KEY;
+  static const LimitNameKeyType TIME_MAX_KEY;
+  static const LimitNameKeyType EKIN_MIN_KEY;
+  static const LimitNameKeyType RANGE_MIN_KEY;
+
+  static const LimitValueType STEP_LENGTH_MAX_DEFAULT;
+  static const LimitValueType TRACK_LENGTH_MAX_DEFAULT;
+  static const LimitValueType TIME_MAX_DEFAULT;
+  static const LimitValueType EKIN_MIN_DEFAULT;
+  static const LimitValueType RANGE_MIN_DEFAULT;
+
+public:
+  G4LimitSet(const G4String& name);
+  virtual ~G4LimitSet();
+
+public:
+
+  virtual G4double GetMaxAllowedStep(const G4Track&);
+  virtual G4double GetUserMaxTrackLength(const G4Track&) ;
+  virtual G4double GetUserMaxTime (const G4Track&);
+  virtual G4double GetUserMinEkine(const G4Track&);
+  virtual G4double GetUserMinRange(const G4Track&);
+
+  /* Set limits by particle type. */
+  void setLimitForParticle(LimitNameType limitName,
+			   ParticleType particleType,
+			   LimitValueType limitValue);
+
+  void setName(const G4String& n);
+  G4String& getName();
+
+private:
+
+  /**
+   * Get the limit value for a particular particle type.
+   * @param  limitName    The name of the limit type (1 of 5 valid types).
+   * @param  particleType Type, e.g. name, of the Geant4 particle.
+   * @return Value of the limit or LIMIT_NOT_SET if no key exists and ANY_PARTICLE is also not set.
+   */
+  LimitValueType getLimitForParticle(LimitNameType limitName,
+				     ParticleType particleType = ANY_PARTICLE);
+
+  LimitValueType getLimitForParticle(LimitNameType limitName,
+				     const G4Track&);
+
+  const ParticleType getParticleType(const G4Track&);
+
+protected:
+
+  /* Map of ( limitName -> particleName -> limitValue ). */
+  LimitSetMap m_limitsMap;
+
+  G4String m_name;
+};
+
+#endif

lcdd/include
LimitParamType.hh added at 1.1
diff -N LimitParamType.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LimitParamType.hh	9 Jul 2005 00:25:55 -0000	1.1
@@ -0,0 +1,64 @@
+// $Header: /cvs/lcd/lcdd/include/LimitParamType.hh,v 1.1 2005/07/09 00:25:55 jeremy Exp $
+#ifndef LimitParamType_hh
+#define LimitParamType_hh 1
+
+#include <string>
+#include <vector>
+
+class LimitParamType
+{
+public:
+  LimitParamType()
+  {}
+
+  virtual ~LimitParamType()
+  {}
+
+  void set_particles(const std::string& p)
+  {
+    m_particles = p;
+  }
+
+  const std::string& get_particles() const
+  {
+    return m_particles;
+  }
+
+  void set_name(const std::string& n)
+  {
+    m_name = n;
+  }
+
+  const std::string& get_name() const
+  {
+    return m_name;
+  }
+
+  void set_value(const std::string& v)
+  {
+    m_value = v;
+  }
+
+  const std::string& get_value() const
+  {
+    return m_value;
+  }
+
+  void set_unit(const std::string& u)
+  {
+    m_unit = u;
+  }
+
+  const std::string& get_unit() const
+  {
+    return m_unit;
+  }
+
+public:
+  std::string m_particles;
+  std::string m_value;
+  std::string m_name;
+  std::string m_unit;
+};
+
+#endif

lcdd/include
LimitSetType.hh added at 1.1
diff -N LimitSetType.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LimitSetType.hh	9 Jul 2005 00:25:55 -0000	1.1
@@ -0,0 +1,66 @@
+// $Header: /cvs/lcd/lcdd/include/LimitSetType.hh,v 1.1 2005/07/09 00:25:55 jeremy Exp $
+#ifndef LimitSetType_hh
+#define LimitSetType_hh 1
+
+// GDML
+#include "Schema/ContentGroup.h"
+#include "Schema/ReferenceType.h"
+
+// std
+#include <string>
+
+class LimitSetType
+{
+
+public:
+  class limitsetref : public SAXObject, public ReferenceType
+  {
+  public:
+    limitsetref()
+    {}
+
+    virtual ~limitsetref()
+    {}
+
+    virtual SAXObject::Type type()
+    {
+      return SAXObject::element;
+    }
+  };
+
+public:
+
+  LimitSetType()
+  {}
+
+  virtual ~LimitSetType()
+  {}
+
+  void set_name(const std::string& n)
+  {
+    m_name = n;
+  }
+
+  const std::string& get_name() const
+  {
+    return m_name;
+  }
+
+  void add_content( const std::string& tag, SAXObject* so )
+  {
+    ContentGroup::ContentItem ci = {tag, so };
+    m_sequence.add_content( ci );
+  }
+
+  const ContentSequence* get_content() const
+  {
+    return &m_sequence;
+  }
+
+private:
+
+  ContentSequence m_sequence;
+  std::string m_name;
+};
+
+#endif

lcdd/include
limitset.hh added at 1.1
diff -N limitset.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ limitset.hh	9 Jul 2005 00:25:56 -0000	1.1
@@ -0,0 +1,27 @@
+// $Header: /cvs/lcd/lcdd/include/limitset.hh,v 1.1 2005/07/09 00:25:56 jeremy Exp $
+#ifndef limitset_hh
+#define limitset_hh 1
+
+#include "LimitSetType.hh"
+
+#include "Saxana/SAXObject.h"
+
+/**
+ */
+class limitset : public SAXObject, public LimitSetType
+{
+public:
+
+  limitset()
+  {}
+
+  virtual ~limitset()
+  {}
+
+  virtual SAXObject::Type type()
+  {
+    return SAXObject::element;
+  }
+};
+
+#endif

lcdd/include
LCDDProcessor.hh 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- LCDDProcessor.hh	10 Jun 2005 22:57:01 -0000	1.15
+++ LCDDProcessor.hh	9 Jul 2005 00:25:55 -0000	1.16
@@ -8,6 +8,7 @@
 
 // LCDD
 #include "G4SensitiveDetector.hh"
+#include "G4LimitSet.hh"
 #include "LCDDHeaderRecord.hh"
 
 #include <string>
@@ -30,17 +31,18 @@
 
   static LCDDProcessor* instance();
 
-public:  
+public:
   typedef std::map<std::string, G4SensitiveDetector*> SensitiveDetectors;
   typedef std::map<std::string, G4MagneticField*> MagneticFields;
   typedef std::map<std::string, G4Region*> Regions;
   typedef std::map<std::string, G4VisAttributes*> VisAttributes;
   typedef std::map<std::string, G4UserLimits*> UserLimits;
+  typedef std::map<std::string, G4LimitSet*> LimitSets;
 
 public:
 
   // header
-  const LCDDHeaderRecord* getHeader() 
+  const LCDDHeaderRecord* getHeader()
   {
     return m_header;
   }
@@ -63,7 +65,7 @@
 
   G4SensitiveDetector* getSensitiveDetector(const std::string& name);
   G4SensitiveDetector* getSensitiveDetector(const char* name);
-  
+
   LCDDProcessor::SensitiveDetectors::const_iterator getSensitiveDetectorsBegin();
   LCDDProcessor::SensitiveDetectors::const_iterator getSensitiveDetectorsEnd();
 
@@ -72,7 +74,7 @@
 
   G4MagneticField* getMagneticField(const std::string& name);
   G4MagneticField* getMagneticField(const char* name);
-  
+
   LCDDProcessor::MagneticFields::const_iterator getMagneticFieldsBegin();
   LCDDProcessor::MagneticFields::const_iterator getMagneticFieldsEnd();
 
@@ -98,6 +100,11 @@
   LCDDProcessor::UserLimits::const_iterator getUserLimitsBegin();
   LCDDProcessor::UserLimits::const_iterator getUserLimitsEnd();
 
+  // user limit set
+  void addLimitSet(std::string& name, G4LimitSet* lim);
+  G4LimitSet* getLimitSet(const std::string& name);
+  G4LimitSet* getLimitSet(const char* name);
+
   // Vis Attributes
   void addVisAttributes(std::string& name, G4VisAttributes* vis);
 
@@ -118,6 +125,7 @@
   LCDDProcessor::Regions m_regions;
   LCDDProcessor::VisAttributes m_visAttributes;
   LCDDProcessor::UserLimits m_userLimits;
+  LCDDProcessor::LimitSets m_limitSets;
 
   // was global field setup?
   bool m_globalMagneticFieldIsInitialized;

lcdd/include
SensitiveDetectorTypeProcess.hh 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- SensitiveDetectorTypeProcess.hh	5 Jul 2005 20:35:53 -0000	1.9
+++ SensitiveDetectorTypeProcess.hh	9 Jul 2005 00:25:56 -0000	1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorTypeProcess.hh,v 1.9 2005/07/05 20:35:53 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorTypeProcess.hh,v 1.10 2005/07/09 00:25:56 jeremy Exp $
 
 #ifndef SensitiveDetectorTypeProcess_hh
 #define SensitiveDetectorTypeProcess_hh 1
@@ -76,7 +76,7 @@
 
     // just push all content; could be idspecref or segmentation (for cal)
     sdt->add_content( name, *so);
-}
+  }
 
 protected:
   SAXObject* m_obj;

lcdd/include
StringUtil.hh 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- StringUtil.hh	19 Mar 2005 20:28:42 -0000	1.6
+++ StringUtil.hh	9 Jul 2005 00:25:56 -0000	1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/StringUtil.hh,v 1.6 2005/03/19 20:28:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/StringUtil.hh,v 1.7 2005/07/09 00:25:56 jeremy Exp $
 
 #ifndef StringUtil_hh
 #define StringUtil_hh 1
@@ -35,7 +35,7 @@
   // null string
   static const std::string NULL_STR;
 
-public:    
+public:
   static std::string toString(double d);
   static std::string toString(float f);
   static std::string toString(int i);
@@ -52,12 +52,20 @@
   static bool toBool(std::string& s);
   static bool toBool(const std::string& s);
 
+  /*
   static std::string trimLeft(const std::string& s, const std::string& trimStr = WS_STR);
   static std::string trimRight (const std::string& s, const std::string& trimStr = WS_STR);
-  static std::string trim(const std::string& s, const std::string& trimStr = WS_STR);
+  */
+  //static std::string trim(const std::string& s, const std::string& trimStr = WS_STR);
+  static void trim(std::string& str);
 
-  static std::string concatStrVec(const std::vector<std::string>& s_vec, 
+  static std::string concatStrVec(const std::vector<std::string>& s_vec,
 				  const std::string& sep = " ");
+  /**
+   * split a string from
+   * http://www.codeproject.com/string/stringsplit.asp
+  */
+  static int split(const std::string& input, const std::string& delimiter, std::vector<std::string>& results);
 };
 
 #endif

lcdd/include
limit.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- limit.hh	25 Mar 2005 00:08:49 -0000	1.1
+++ limit.hh	9 Jul 2005 00:25:56 -0000	1.2
@@ -1,19 +1,14 @@
-// $Header: /cvs/lcd/lcdd/include/limit.hh,v 1.1 2005/03/25 00:08:49 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/limit.hh,v 1.2 2005/07/09 00:25:56 jeremy Exp $
 #ifndef limit_hh
 #define limit_hh 1
 
-#include "Saxana/SAXObject.h"
+#include "LimitParamType.hh"
 
-#include "LimitType.hh"
+#include "Saxana/SAXObject.h"
 
-/**
- * @class limit
- * @brief limit element from schema.
-*/
-class limit : public SAXObject, public LimitType
+class limit : public SAXObject, public LimitParamType
 {
 public:
-
   limit()
   {}
 

lcdd/schemas/lcdd/1.0
limits.xsd 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- limits.xsd	8 Jul 2005 23:38:04 -0000	1.11
+++ limits.xsd	9 Jul 2005 00:25:57 -0000	1.12
@@ -9,7 +9,7 @@
   <xs:complexType name="LimitParamType">
     <xs:annotation>
       <xs:documentation>
-	A single Geant4 user limit parameter.
+	A single Geant4 user limit parameter such as max track length.
       </xs:documentation>
     </xs:annotation>
     <xs:attribute name="name" type="xs:string" use="required" />
@@ -34,39 +34,12 @@
 
   <xs:element name="limitset" type="LimitSetType" />
 
-  <!--
-  <xs:complexType name="UserLimitType">
-    <xs:annotation>
-      <xs:documentation>
-	Mapping to G4UserLimits which are assigned to G4LogicalVolumes.
-      </xs:documentation>
-    </xs:annotation>
-
-    <xs:attribute name="name"             type="xs:ID" />
-    <xs:attribute name="step_length_max"  type="xs:double" default="0.0" />
-    <xs:attribute name="track_length_max" type="xs:double" default="0.0" />
-    <xs:attribute name="time_max"         type="xs:double" default="0.0"/>
-    <xs:attribute name="ekin_min"         type="xs:double" default="0.0"/>
-    <xs:attribute name="range_min"        type="xs:double" default="0.0"/>
-    <xs:attribute name="eunit" type="xs:string" default="MeV" />
-    <xs:attribute name="lunit" type="xs:string" default="mm" />
-    <xs:attribute name="tunit" type="xs:string" default="ns" />
-
-  </xs:complexType>
-  -->
-
-  <!--
-  <xs:element name="limit" type="UserLimitType">
-  </xs:element>
-  -->
-
   <xs:complexType name="UserLimitsType">
     <xs:annotation>
       <xs:documentation>
       </xs:documentation>
     </xs:annotation>
     <xs:sequence>
-<!--      <xs:element ref="limit" minOccurs="0" maxOccurs="unbounded" /> -->
       <xs:element ref="limitset" minOccurs="0" maxOccurs="unbounded" />
     </xs:sequence>
   </xs:complexType>

lcdd/src
G4LimitSet.cc added at 1.1
diff -N G4LimitSet.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ G4LimitSet.cc	9 Jul 2005 00:25:57 -0000	1.1
@@ -0,0 +1,131 @@
+#include "G4LimitSet.hh"
+
+#include "G4Track.hh"
+
+/* Code for any particle. */
+const G4LimitSet::ParticleType G4LimitSet::ANY_PARTICLE = "*";
+
+/* Code for no limit, as -1 is never a valid limit. */
+const G4LimitSet::LimitValueType G4LimitSet::LIMIT_NOT_SET = -1;
+
+/* Keys to limit value maps for each parameter. */
+const G4LimitSet::LimitNameKeyType G4LimitSet::STEP_LENGTH_MAX_KEY = "step_length_max";
+const G4LimitSet::LimitNameKeyType G4LimitSet::TRACK_LENGTH_MAX_KEY = "track_length_max";
+const G4LimitSet::LimitNameKeyType G4LimitSet::TIME_MAX_KEY = "time_max";
+const G4LimitSet::LimitNameKeyType G4LimitSet::EKIN_MIN_KEY = "ekin_min";
+const G4LimitSet::LimitNameKeyType G4LimitSet::RANGE_MIN_KEY = "range_min";
+
+/* Default values for limits.  Taken from G4UserLimit ctor default args. */
+const G4LimitSet::LimitValueType G4LimitSet::STEP_LENGTH_MAX_DEFAULT = DBL_MAX;
+const G4LimitSet::LimitValueType G4LimitSet::TRACK_LENGTH_MAX_DEFAULT = DBL_MAX;
+const G4LimitSet::LimitValueType G4LimitSet::TIME_MAX_DEFAULT = DBL_MAX;
+const G4LimitSet::LimitValueType G4LimitSet::EKIN_MIN_DEFAULT = 0.;
+const G4LimitSet::LimitValueType G4LimitSet::RANGE_MIN_DEFAULT = 0.;
+
+G4LimitSet::G4LimitSet(const G4String& name)
+  : G4UserLimits("G4LimitSet"),
+    m_name(name)
+{
+  m_limitsMap[STEP_LENGTH_MAX_KEY] = LimitMap();
+  m_limitsMap[TRACK_LENGTH_MAX_KEY] = LimitMap();
+  m_limitsMap[TIME_MAX_KEY] = LimitMap();
+  m_limitsMap[EKIN_MIN_KEY] = LimitMap();
+  m_limitsMap[RANGE_MIN_KEY] = LimitMap();
+}
+
+G4LimitSet::~G4LimitSet()
+{}
+
+G4double G4LimitSet::GetMaxAllowedStep(const G4Track& aTrack)
+{
+  double maxStepLength = getLimitForParticle(STEP_LENGTH_MAX_KEY, aTrack);
+  return maxStepLength == LIMIT_NOT_SET ? STEP_LENGTH_MAX_DEFAULT : maxStepLength;
+}
+
+G4double G4LimitSet::GetUserMaxTrackLength(const G4Track& aTrack)
+{
+  double maxTrackLength = getLimitForParticle(TRACK_LENGTH_MAX_KEY, aTrack);
+  return maxTrackLength == LIMIT_NOT_SET ? TRACK_LENGTH_MAX_DEFAULT : maxTrackLength;
+}
+
+G4double G4LimitSet::GetUserMaxTime (const G4Track& aTrack)
+{
+  double maxTime = getLimitForParticle(TIME_MAX_KEY, aTrack);
+  return maxTime == LIMIT_NOT_SET ? TIME_MAX_DEFAULT : maxTime;
+}
+
+G4double G4LimitSet::GetUserMinEkine(const G4Track& aTrack)
+{
+  double minEkine = getLimitForParticle(EKIN_MIN_KEY, aTrack);
+  return minEkine == LIMIT_NOT_SET ? EKIN_MIN_DEFAULT : minEkine;
+}
+
+G4double G4LimitSet::GetUserMinRange(const G4Track& aTrack)
+{
+  double minRange = getLimitForParticle(RANGE_MIN_KEY, aTrack);
+  return minRange == LIMIT_NOT_SET ? RANGE_MIN_DEFAULT : minRange;
+}
+
+const G4LimitSet::ParticleType G4LimitSet::getParticleType(const G4Track& aTrack)
+{
+  return aTrack.GetDefinition()->GetParticleName();
+}
+
+void G4LimitSet::setLimitForParticle(LimitNameType limitName,
+				     ParticleType particleType,
+				     LimitValueType limitValue)
+{
+  if ( m_limitsMap.find(limitName) != m_limitsMap.end() ) {
+    m_limitsMap[limitName][particleType] = limitValue;
+  }
+  else {
+    G4Exception(limitName + " is not a valid limits map.");
+  }
+}
+
+G4LimitSet::LimitValueType G4LimitSet::getLimitForParticle(LimitNameType limitName,
+							   ParticleType particleType)
+{
+  //std::cout << "G4LimitSet::getLimitForParticle()" << std::endl;
+  //std::cout << "limitName, particleType: " << limitName << " " << particleType << std::endl;
+  LimitValueType limitValue = 0;
+  if ( m_limitsMap.find(limitName) != m_limitsMap.end() ) {
+    if ( m_limitsMap[limitName].find(particleType) != m_limitsMap[limitName].end() ) {
+      limitValue = m_limitsMap[limitName][particleType];
+    }
+    else {
+      if ( ( m_limitsMap[limitName].find(ANY_PARTICLE) != m_limitsMap[limitName].end() ) ) {
+	limitValue = m_limitsMap[limitName][ANY_PARTICLE];
+      }
+      else {
+	limitValue = LIMIT_NOT_SET;
+      }
+    }
+  }
+  else {
+    G4Exception(limitName + " is not a valid limits map.");
+  }
+  //std::cout << "limitValue: " << limitValue << std::endl;
+  return limitValue;
+}
+
+G4LimitSet::LimitValueType G4LimitSet::getLimitForParticle(LimitNameType limitName,
+							   const G4Track& aTrack)
+{
+  return getLimitForParticle(limitName, getParticleType(aTrack) );
+}
+
+void G4LimitSet::setName(const G4String& n)
+{
+  m_name = n;
+}
+
+G4String& G4LimitSet::getName()
+{
+  return m_name;
+}
+
+
+
+
+

lcdd/src
limitsetProcess.cc added at 1.1
diff -N limitsetProcess.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ limitsetProcess.cc	9 Jul 2005 00:25:57 -0000	1.1
@@ -0,0 +1,80 @@
+// $Header: /cvs/lcd/lcdd/src/limitsetProcess.cc,v 1.1 2005/07/09 00:25:57 jeremy Exp $
+#include "limitset.hh"
+#include "limit.hh"
+
+// GDML
+#include "Saxana/ProcessingConfigurator.h"
+#include "Saxana/ProcessingContext.h"
+#include "Saxana/SAXProcessor.h"
+#include "Saxana/StateStack.h"
+#include "Saxana/SAXProcessingState.h"
+#include "Saxana/SAXStateProcess.h"
+#include "Saxana/SAXComponentFactory.h"
+
+// Geant4
+#include "globals.hh"
+
+class limitsetProcess : public SAXStateProcess
+{
+public:
+  limitsetProcess(const ProcessingContext* context = 0)
+    : SAXStateProcess(context),
+      m_obj(0)
+  {}
+
+  virtual ~limitsetProcess()
+  {}
+
+  virtual const SAXComponentObject* Build() const
+  {
+    return this;
+  }
+
+  virtual void StartElement(const std::string&, const ASCIIAttributeList& attrs)
+  {
+    SAXObject** obj = Context()->GetTopObject();
+
+    limitset* lim = new limitset;
+    lim->set_name(attrs.getValue("name"));
+
+    m_obj = lim;
+    *obj = lim;
+  }
+
+  virtual void EndElement(const std::string&)
+  {}
+
+  virtual void Characters(const std::string&)
+  {}
+
+  virtual void StackPopNotify(const std::string& name)
+  {
+    if ( name == "limit" ) {
+      SAXObject** so = Context()->GetTopObject();
+      limitset* lim = dynamic_cast<limitset*>( m_obj );
+
+      if ( lim != 0 ) {
+	lim->add_content( name, *so);
+      }
+      else {
+	G4Exception("limitsetProcess::StackPopNotify() - Failed cast to limitset.");
+      }
+    }
+    else {
+      std::cerr << "limitsetProcess::StackPopNotify() - Got limitset content that wasn't limit." << std::endl;
+    }
+  }
+
+  virtual const std::string& State() const
+  {
+    static std::string tag = "limitset";
+    return tag;
+  }
+
+private:
+
+  SAXObject* m_obj;
+
+};
+
+DECLARE_PROCESS_FACTORY(limitsetProcess);

lcdd/src
limitsetSubscriber.cc added at 1.1
diff -N limitsetSubscriber.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ limitsetSubscriber.cc	9 Jul 2005 00:25:57 -0000	1.1
@@ -0,0 +1,106 @@
+// $Header: /cvs/lcd/lcdd/src/limitsetSubscriber.cc,v 1.1 2005/07/09 00:25:57 jeremy Exp $
+
+// GDML
+#include "Saxana/SAXSubscriber.h"
+#include "Saxana/SAXComponentFactory.h"
+
+#include "G4Processor/GDMLProcessor.h"
+#include "G4Processor/GDMLExpressionEvaluator.h"
+
+// LCDD
+#include "limit.hh"
+#include "limitset.hh"
+#include "LCDDProcessor.hh"
+#include "G4LimitSet.hh"
+#include "StringUtil.hh"
+
+#include <string>
+#include <iostream>
+
+using std::string;
+using std::vector;
+
+/**
+ */
+class limitsetSubscriber : virtual public SAXSubscriber
+{
+public:
+  virtual const SAXComponentObject* Build() const
+  {
+    return this;
+  }
+
+public:
+
+  limitsetSubscriber()
+  {
+    Subscribe("limitset");
+  }
+
+  virtual void Activate(const SAXObject* object)
+  {
+    //std::cout << "limitsetSubscriber::Activate()" << std::endl;
+    if ( object != 0 ) {
+
+      GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
+      const limitset* lsobj = dynamic_cast<const limitset*>(object);
+
+      if ( lsobj != 0 ) {
+	//std::cout << "got limitset: " << lsobj->get_name() << std::endl;
+
+	G4LimitSet* ls = new G4LimitSet( lsobj->get_name() );
+
+	const ContentSequence* seq = lsobj->get_content();
+	size_t count = seq->size();
+	for ( size_t i=0; i<count; i++ ) {
+	  if ( seq->content(i).tag == "limit" ) {
+	    limit* param = dynamic_cast<limit*>(seq->content(i).object);
+
+	    if ( param != 0 ) {
+	      //std::cout << "got limit: " << param->get_name() << std::endl;
+
+	      string unit = param->get_unit();
+	      string particles = param->get_particles();
+	      string limitName = param->get_name();
+
+	      string sval = param->get_value();
+	      sval += "*" + unit;
+	      double value = calc->Eval(sval);
+
+	      /* Process the comma-delimited list of particles. */
+	      vector<string> particleList;
+	      StringUtil::split(particles, ",", particleList);
+
+	      /* No specific particles so make an entry for all particles. */
+	      if ( particleList.end() == particleList.begin() ) {
+		//std::cout << "adding limit with name, particle, value: <" << limitName << "> <" << G4LimitSet::ANY_PARTICLE << "> <" << value << ">" << std::endl;
+		ls->setLimitForParticle(limitName, G4LimitSet::ANY_PARTICLE, value);
+	      }
+	      /* Insert the limit once for each particle. */
+	      else {
+		for ( vector<string>::iterator iter = particleList.begin();
+		      iter != particleList.end();
+		      iter++ ) {
+		  string particle = (*iter);
+		  StringUtil::trim(particle);
+		  //std::cout << "adding limit with name, particle, value: <" << limitName << "> <" << particle << "> <" << value << ">" << std::endl;
+		  ls->setLimitForParticle(limitName, particle, value);
+		}
+	      }
+	    }
+	    else {
+	      G4Exception("Failed cast to limit.");
+	    }
+	  }
+	}
+
+	LCDDProcessor::instance()->addLimitSet(ls->getName(), ls);
+      }
+      else {
+	G4Exception("Failed cast to limitset.");
+      }
+    }
+  }
+};
+
+DECLARE_SUBSCRIBER_FACTORY(limitsetSubscriber);

lcdd/src
limitsetrefProcess.cc added at 1.1
diff -N limitsetrefProcess.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ limitsetrefProcess.cc	9 Jul 2005 00:25:58 -0000	1.1
@@ -0,0 +1,47 @@
+// $Header: /cvs/lcd/lcdd/src/limitsetrefProcess.cc,v 1.1 2005/07/09 00:25:58 jeremy Exp $
+
+#include "Processes/ReferenceTypeProcess.h"
+
+#include "LimitSetType.hh"
+
+/**
+   @class limitsetrefProcess
+   @brief SAX process for limitsetref element.
+*/
+class limitsetrefProcess : public ReferenceTypeProcess
+{
+public:
+  limitsetrefProcess(const ProcessingContext* context = 0)
+    : ReferenceTypeProcess(context)
+  {}
+
+  virtual ~limitsetrefProcess()
+  {}
+
+  virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs)
+  {
+    //std::cout << "limitsetrefProcess" << std::endl;
+
+    SAXObject** obj = Context()->GetTopObject();
+
+    LimitSetType::limitsetref* lref = new LimitSetType::limitsetref;
+
+    *obj = lref;
+    m_obj = lref;
+
+    ReferenceTypeProcess::StartElement(name, attrs);
+  }
+
+  virtual void EndElement(const std::string& name)
+  {
+    ReferenceTypeProcess::EndElement(name);
+  }
+
+  virtual const std::string& State() const
+  {
+    static std::string tag = "limitsetref";
+    return tag;
+  }
+};
+
+DECLARE_PROCESS_FACTORY(limitsetrefProcess);

lcdd/src
LCDDLibLoad.cc 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- LCDDLibLoad.cc	5 Jul 2005 20:35:54 -0000	1.18
+++ LCDDLibLoad.cc	9 Jul 2005 00:25:57 -0000	1.19
@@ -13,16 +13,15 @@
     LOAD_COMPONENT(generatorProcess);
     LOAD_COMPONENT(commentProcess);
 
-    // volume extended and related refs
+    // volume extended
     LOAD_COMPONENT(volumeExtendedProcess);
-    LOAD_COMPONENT(sdrefProcess);
-    LOAD_COMPONENT(regionrefProcess);
     LOAD_COMPONENT(physvolidProcess);
 
     // SDs
     LOAD_COMPONENT(calorimeterProcess);
     LOAD_COMPONENT(trackerProcess);
     LOAD_COMPONENT(scorerProcess);
+    LOAD_COMPONENT(sdrefProcess);
 
     // segmentations
     LOAD_COMPONENT(grid_xyzProcess);
@@ -42,6 +41,7 @@
 
     // region
     LOAD_COMPONENT(regionProcess);
+    LOAD_COMPONENT(regionrefProcess);
 
     // display
     LOAD_COMPONENT(visProcess);
@@ -49,8 +49,9 @@
     LOAD_COMPONENT(colorProcess);
 
     // limit
+    LOAD_COMPONENT(limitsetProcess);
+    LOAD_COMPONENT(limitsetrefProcess);
     LOAD_COMPONENT(limitProcess);
-    LOAD_COMPONENT(limitrefProcess);
   }
 
   void LCDDLoadSubscribers()
@@ -80,7 +81,7 @@
     LOAD_COMPONENT(visSubscriber);
 
     // limit
-    LOAD_COMPONENT(limitSubscriber);
+    LOAD_COMPONENT(limitsetSubscriber);
   }
 
   void LCDDLibLoad() {

lcdd/src
LCDDProcessor.cc 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- LCDDProcessor.cc	25 Mar 2005 00:08:49 -0000	1.10
+++ LCDDProcessor.cc	9 Jul 2005 00:25:57 -0000	1.11
@@ -10,7 +10,7 @@
 LCDDProcessor* LCDDProcessor::sInstance = 0;
 
 LCDDProcessor::LCDDProcessor()
-  : m_header(0), 
+  : m_header(0),
     m_globalMagneticFieldIsInitialized(0)
 {}
 
@@ -26,29 +26,29 @@
   if (sInstance == 0) {
     sInstance = new LCDDProcessor;
   }
-  
+
   return sInstance;
 }
 
-void LCDDProcessor::addSensitiveDetector(std::string& name, 
+void LCDDProcessor::addSensitiveDetector(std::string& name,
 					 G4SensitiveDetector* sd)
 {
   //std::cout << "adding SD: " << name << std::endl;
   m_sensitiveDetectors[name] = sd;
 }
 
-G4SensitiveDetector* LCDDProcessor::getSensitiveDetector(const std::string& name) 
+G4SensitiveDetector* LCDDProcessor::getSensitiveDetector(const std::string& name)
 {
   return m_sensitiveDetectors[name];
 }
 
-G4SensitiveDetector* LCDDProcessor::getSensitiveDetector(const char* name) 
+G4SensitiveDetector* LCDDProcessor::getSensitiveDetector(const char* name)
 {
   std::string key = name;
   return getSensitiveDetector(key);
 }
 
-LCDDProcessor::SensitiveDetectors::const_iterator LCDDProcessor::getSensitiveDetectorsBegin() 
+LCDDProcessor::SensitiveDetectors::const_iterator LCDDProcessor::getSensitiveDetectorsBegin()
 {
   return m_sensitiveDetectors.begin();
 }
@@ -63,35 +63,35 @@
   m_magneticFields[name] = mag;
 }
 
-G4MagneticField* LCDDProcessor::getMagneticField(const std::string& name) 
+G4MagneticField* LCDDProcessor::getMagneticField(const std::string& name)
 {
   return m_magneticFields[name];
 }
 
-G4MagneticField* LCDDProcessor::getMagneticField(const char* name) 
+G4MagneticField* LCDDProcessor::getMagneticField(const char* name)
 {
   std::string key = name;
   return getMagneticField( key );
 }
 
-LCDDProcessor::MagneticFields::const_iterator LCDDProcessor::getMagneticFieldsBegin() 
+LCDDProcessor::MagneticFields::const_iterator LCDDProcessor::getMagneticFieldsBegin()
 {
   return m_magneticFields.begin();
 }
 
-LCDDProcessor::MagneticFields::const_iterator LCDDProcessor::getMagneticFieldsEnd() 
+LCDDProcessor::MagneticFields::const_iterator LCDDProcessor::getMagneticFieldsEnd()
 {
   return m_magneticFields.end();
 }
 
 void LCDDProcessor::setGlobalMagneticField(G4MagneticField *mag)
 {
-  if( m_globalMagneticFieldIsInitialized == false )  {   
-    G4FieldManager* fieldMgr = 
+  if( m_globalMagneticFieldIsInitialized == false )  {
+    G4FieldManager* fieldMgr =
       G4TransportationManager::GetTransportationManager()->GetFieldManager();
     fieldMgr->SetDetectorField(mag);
     fieldMgr->CreateChordFinder(mag);
-    m_globalMagneticFieldIsInitialized = true; 
+    m_globalMagneticFieldIsInitialized = true;
   }
   else {
     std::cerr << "Global MagneticField is already initialized!" << std::endl;
@@ -121,7 +121,7 @@
   m_regions[name] = reg;
 }
 
-G4Region* LCDDProcessor::getRegion(const std::string& name) 
+G4Region* LCDDProcessor::getRegion(const std::string& name)
 {
   return m_regions[name];
 }
@@ -132,38 +132,38 @@
   return getRegion(name);
 }
 
-LCDDProcessor::Regions::const_iterator LCDDProcessor::getRegionsBegin() 
+LCDDProcessor::Regions::const_iterator LCDDProcessor::getRegionsBegin()
 {
   return m_regions.begin();
 }
 
-LCDDProcessor::Regions::const_iterator LCDDProcessor::getRegionsEnd() 
+LCDDProcessor::Regions::const_iterator LCDDProcessor::getRegionsEnd()
 {
   return m_regions.end();
 }
 
-void LCDDProcessor::addVisAttributes(std::string& name, G4VisAttributes* vis) 
+void LCDDProcessor::addVisAttributes(std::string& name, G4VisAttributes* vis)
 {
   m_visAttributes[name] = vis;
 }
 
-G4VisAttributes* LCDDProcessor::getVisAttributes(const std::string& name) 
+G4VisAttributes* LCDDProcessor::getVisAttributes(const std::string& name)
 {
   return m_visAttributes[name];
 }
 
-G4VisAttributes* LCDDProcessor::getVisAttributes(const char* name) 
+G4VisAttributes* LCDDProcessor::getVisAttributes(const char* name)
 {
   std::string key = name;
   return getVisAttributes(key);
 }
 
-LCDDProcessor::VisAttributes::const_iterator LCDDProcessor::getVisAttributesBegin() 
+LCDDProcessor::VisAttributes::const_iterator LCDDProcessor::getVisAttributesBegin()
 {
   return m_visAttributes.begin();
 }
 
-LCDDProcessor::VisAttributes::const_iterator LCDDProcessor::getVisAttributesEnd() 
+LCDDProcessor::VisAttributes::const_iterator LCDDProcessor::getVisAttributesEnd()
 {
   return m_visAttributes.end();
 }
@@ -194,3 +194,19 @@
 {
   return m_userLimits.end();
 }
+
+void LCDDProcessor::addLimitSet(std::string& name, G4LimitSet* lim)
+{
+  m_limitSets[name] = lim;
+}
+
+G4LimitSet* LCDDProcessor::getLimitSet(const std::string& name)
+{
+  return m_limitSets[name];
+}
+
+G4LimitSet* LCDDProcessor::getLimitSet(const char* name)
+{
+  std::string key = name;
+  return getLimitSet(key);
+}

lcdd/src
StringUtil.cc 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- StringUtil.cc	19 Mar 2005 20:28:43 -0000	1.6
+++ StringUtil.cc	9 Jul 2005 00:25:57 -0000	1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/StringUtil.cc,v 1.6 2005/03/19 20:28:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/StringUtil.cc,v 1.7 2005/07/09 00:25:57 jeremy Exp $
 
 #include "StringUtil.hh"
 
@@ -6,27 +6,33 @@
 #include <iostream>
 #include <algorithm>
 #include <sstream>
+#include <vector>
 
 const std::string StringUtil::ALPHA_STR="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 const std::string StringUtil::NUM_STR="1234567890";
 const std::string StringUtil::WS_STR="\x20\x09\x0A\x0B\x0C\x0D";
 const std::string StringUtil::NULL_STR="";
 
-std::string StringUtil::toString(double d)
+using std::string;
+using std::stringstream;
+using std::istringstream;
+using std::vector;
+
+string StringUtil::toString(double d)
 {
-  std::stringstream ostr;
+  stringstream ostr;
   ostr << d;
   return ostr.str();
 }
 
-std::string StringUtil::toString(float f)
+string StringUtil::toString(float f)
 {
-  std::stringstream ostr;
+  stringstream ostr;
   ostr << f;
   return ostr.str();
 }
 
-std::string StringUtil::toString(bool b)
+string StringUtil::toString(bool b)
 {
   if ( b ) {
     return "1";
@@ -35,25 +41,25 @@
   return "0";
 }
 
-std::string StringUtil::toString(int i)
+string StringUtil::toString(int i)
 {
-  std::stringstream ostr;
+  stringstream ostr;
   ostr << i;
   return ostr.str();
 }
 
-std::string& StringUtil::toLower(std::string& s) 
+string& StringUtil::toLower(string& s)
 {
   std::transform( s.begin(), s.end(), s.begin(), tolower );
   return s;
 }
 
-std::string& StringUtil::toLower(const std::string& s)
+string& StringUtil::toLower(const string& s)
 {
-  return StringUtil::toLower( const_cast<std::string&> ( s ) );
+  return StringUtil::toLower( const_cast<string&> ( s ) );
 }
 
-double StringUtil::toDouble(std::string& s) 
+double StringUtil::toDouble(string& s)
 {
   std::istringstream is( s.c_str() );
   double d;
@@ -61,7 +67,7 @@
   return d;
 }
 
-int StringUtil::toInt(std::string& s)
+int StringUtil::toInt(string& s)
 {
   std::istringstream is( s.c_str() );
   int i;
@@ -69,7 +75,7 @@
   return i;
 }
 
-bool StringUtil::toBool(std::string& s)
+bool StringUtil::toBool(string& s)
 {
   if ( StringUtil::toLower( s ) == "true" || s == "1" ) {
     return true;
@@ -79,28 +85,29 @@
   }
 }
 
-bool StringUtil::toBool(const std::string& s)
+bool StringUtil::toBool(const string& s)
 {
-  return StringUtil::toBool( const_cast<std::string&> ( s ) );
+  return StringUtil::toBool( const_cast<string&> ( s ) );
 }
 
-double StringUtil::toDouble(const std::string& s) {
-  return StringUtil::toDouble( const_cast<std::string&> ( s ) );
+double StringUtil::toDouble(const string& s) {
+  return StringUtil::toDouble( const_cast<string&> ( s ) );
 }
 
-std::string StringUtil::trimLeft(const std::string& s, const std::string& trimStr)
+/*
+string StringUtil::trimLeft(const string& s, const string& trimStr)
 {
-  std::string str = s;
+  string str = s;
   size_t firstCh = str.find_first_not_of(trimStr);
-      
+
   if ( (firstCh != 0) && (firstCh != str.npos) )
     str.erase (0, firstCh-1);
   return str;
-}    
+}
 
-std::string StringUtil::trimRight (const std::string& s, const std::string& trimStr)
+string StringUtil::trimRight (const string& s, const string& trimStr)
 {
-  std::string str = s;
+  string str = s;
   size_t lastCh = str.find_last_not_of(trimStr);
 
   if (lastCh != str.npos)
@@ -111,26 +118,40 @@
     if(first_ch == str.npos)
       str.erase(str.begin(), str.end());
   }
-  return str;    
-} 
+  return str;
+}
+*/
+
+void StringUtil::trim(string& str)
+{
+  string::size_type pos = str.find_last_not_of(' ');
+  if(pos != string::npos) {
+    str.erase(pos + 1);
+    pos = str.find_first_not_of(' ');
+    if(pos != string::npos) str.erase(0, pos);
+  }
+  else str.erase(str.begin(), str.end());
+}
 
-std::string StringUtil::trim(const std::string& s, const std::string& trimStr )
+/*
+string StringUtil::trim(const string& s, const string& trimStr )
 {
-  std::string ret;
+  string ret;
   ret = trimLeft(s, trimStr);
   ret = trimRight(ret, trimStr);
   return ret;
 }
+*/
 
-std::string StringUtil::concatStrVec(const std::vector<std::string>& s_vec, const std::string& sep)
+string StringUtil::concatStrVec(const vector<string>& s_vec, const string& sep)
 {
-  std::string r;
-  
+  string r;
+
   // concat w/ a space in between
-  for ( std::vector<std::string>::const_iterator iter = s_vec.begin();
+  for ( vector<string>::const_iterator iter = s_vec.begin();
         iter != s_vec.end();
 	iter++ ) {
-    r += (*iter) + std::string( sep );
+    r += (*iter) + string( sep );
   }
 
   // lop off dangling space
@@ -139,3 +160,50 @@
   return r;
 }
 
+int StringUtil::split(const string& input, const string& delimiter, vector<string>& results)
+{
+  int iPos = 0;
+  int newPos = -1;
+  int sizeS2 = delimiter.size();
+  int isize = input.size();
+
+  vector<int> positions;
+
+  newPos = input.find (delimiter, 0);
+
+  if( newPos < 0 ) { return 0; }
+
+  int numFound = 0;
+
+  while( newPos > iPos )
+  {
+    numFound++;
+    positions.push_back(newPos);
+    iPos = newPos;
+    newPos = input.find (delimiter, iPos+sizeS2+1);
+  }
+
+  for( int i=0; i <= (int)positions.size(); i++ )
+  {
+    string s;
+    if( i == 0 ) { s = input.substr( i, positions[i] ); }
+    int offset = positions[i-1] + sizeS2;
+    if( offset < isize )
+    {
+      if( i == (int)positions.size() )
+      {
+        s = input.substr(offset);
+      }
+      else if( i > 0 )
+      {
+        s = input.substr( positions[i-1] + sizeS2,
+          positions[i] - positions[i-1] - sizeS2 );
+      }
+    }
+    if( s.size() > 0 )
+    {
+      results.push_back(s);
+    }
+  }
+  return numFound;
+}

lcdd/src
limitProcess.cc 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- limitProcess.cc	25 Mar 2005 00:31:01 -0000	1.2
+++ limitProcess.cc	9 Jul 2005 00:25:57 -0000	1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/limitProcess.cc,v 1.2 2005/03/25 00:31:01 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/limitProcess.cc,v 1.3 2005/07/09 00:25:57 jeremy Exp $
 #include "Saxana/ProcessingConfigurator.h"
 #include "Saxana/ProcessingContext.h"
 #include "Saxana/SAXProcessor.h"
@@ -6,19 +6,16 @@
 #include "Saxana/SAXProcessingState.h"
 #include "Saxana/SAXStateProcess.h"
 #include "Saxana/SAXComponentFactory.h"
-#include "Saxana/SAXObject.h"
 
 #include "limit.hh"
 
-#include <iostream>
-
 /**
- * @class limitProcess
- * @brief SAX process for limit element.
-*/
+ *
+ */
 
 class limitProcess : public SAXStateProcess
 {
+
 public:
   limitProcess(const ProcessingContext* context = 0)
     : SAXStateProcess(context),
@@ -36,32 +33,25 @@
   virtual void StartElement(const std::string&, const ASCIIAttributeList& attrs)
   {
     SAXObject** obj = Context()->GetTopObject();
-    
-    limit* l = new limit;    
 
-    l->set_name( attrs.getValue( "name" ) );
-    
-    l->set_step_length_max( attrs.getValue( "step_length_max" ) );
-    l->set_track_length_max( attrs.getValue( "track_length_max" ) );
-    l->set_time_max( attrs.getValue( "time_max" ) );
-    l->set_ekin_min( attrs.getValue( "ekin_min" ) );
-    l->set_range_min( attrs.getValue( "range_min" ) );
-
-    l->set_eunit( attrs.getValue( "eunit" ) );
-    l->set_lunit( attrs.getValue( "lunit" ) );
-    l->set_tunit( attrs.getValue( "tunit" ) );
+    limit* lim = new limit;
+
+    lim->set_name(attrs.getValue("name"));
+    lim->set_value(attrs.getValue("value"));
+    lim->set_particles(attrs.getValue("particles"));
+    lim->set_unit(attrs.getValue("unit"));
 
-    *obj = l;
-    m_obj = l;
+    m_obj = lim;
+    *obj = lim;
   }
 
   virtual void EndElement(const std::string&)
   {}
 
-  virtual void Characters(const std::string&)
+  virtual void StackPopNotify(const std::string&)
   {}
 
-  virtual void StackPopNotify(const std::string&)
+  virtual void Characters(const std::string&)
   {}
 
   virtual const std::string& State() const
@@ -71,9 +61,9 @@
   }
 
 private:
+
   SAXObject* m_obj;
+
 };
 
 DECLARE_PROCESS_FACTORY(limitProcess);
-
-

lcdd/src
limitrefProcess.cc 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- limitrefProcess.cc	26 Mar 2005 00:27:53 -0000	1.2
+++ limitrefProcess.cc	9 Jul 2005 00:25:57 -0000	1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/limitrefProcess.cc,v 1.2 2005/03/26 00:27:53 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/limitrefProcess.cc,v 1.3 2005/07/09 00:25:57 jeremy Exp $
 
 #include "Processes/ReferenceTypeProcess.h"
 
@@ -12,10 +12,10 @@
 {
 public:
   limitrefProcess(const ProcessingContext* context = 0)
-    : ReferenceTypeProcess(context) 
+    : ReferenceTypeProcess(context)
   {}
 
-  virtual ~limitrefProcess() 
+  virtual ~limitrefProcess()
   {}
 
   virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs)
@@ -37,11 +37,11 @@
     ReferenceTypeProcess::EndElement(name);
   }
 
-  virtual const std::string& State() const 
+  virtual const std::string& State() const
   {
     static std::string tag = "limitref";
     return tag;
   }
 };
 
-DECLARE_PROCESS_FACTORY(limitrefProcess);
+//DECLARE_PROCESS_FACTORY(limitrefProcess);

lcdd/src
volumeExtendedSubscriber.cc 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- volumeExtendedSubscriber.cc	27 Jun 2005 20:40:35 -0000	1.25
+++ volumeExtendedSubscriber.cc	9 Jul 2005 00:25:58 -0000	1.26
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/volumeExtendedSubscriber.cc,v 1.25 2005/06/27 20:40:35 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/volumeExtendedSubscriber.cc,v 1.26 2005/07/09 00:25:58 jeremy Exp $
 
 // GDML
 #include "Saxana/SAXSubscriber.h"
@@ -19,12 +19,14 @@
 #include "physvolidElem.hh"
 #include "VisType.hh"
 #include "limit.hh"
+#include "G4LimitSet.hh"
+#include "LimitSetType.hh"
 
 // G4
 #include "G4LogicalVolume.hh"
 #include "G4Region.hh"
 #include "G4VisAttributes.hh"
-#include "G4UserLimits.hh"
+//#include "G4UserLimits.hh"
 
 // std
 #include <iostream>
@@ -121,21 +123,21 @@
 		G4Exception( "volumeExtendedSubscriber::Activate() - Invalid regionref.");
 	      }
 	    }
-	    // handle limitref
-	    else if ( seq->content(i).tag == "limitref" ) {
+	    // handle limitsetref
+	    else if ( seq->content(i).tag == "limitsetref" ) {
 
-	      LimitType::limitref* limitref =
-		dynamic_cast<LimitType::limitref*> ( seq->content(i).object );
+	      LimitSetType::limitsetref* limitsetref =
+		dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
 
 	      G4UserLimits* ulim =
-		dynamic_cast<G4UserLimits*> ( proc->getUserLimits( limitref->get_ref() ) );
+		dynamic_cast<G4LimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
 
 	      if ( ulim ) {
 		lv->SetUserLimits( ulim );
 	      }
 	      else {
-		std::cerr << "FATAL ERROR: limit element not found - " << limitref->get_ref() << std::endl;
-		G4Exception( "limitref not found." );
+		std::cerr << "FATAL ERROR: limit element not found - " << limitsetref->get_ref() << std::endl;
+		G4Exception( "limitsetref not found." );
 	      }
 
 	    }

lcdd/src
limitSubscriber.cc removed after 1.4
diff -N limitSubscriber.cc
--- limitSubscriber.cc	28 Mar 2005 21:58:03 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,150 +0,0 @@
-// $Header: /cvs/lcd/lcdd/src/Attic/limitSubscriber.cc,v 1.4 2005/03/28 21:58:03 jeremy Exp $
-
-// GDML
-#include "Saxana/SAXSubscriber.h"
-#include "Saxana/SAXComponentFactory.h"
-
-#include "G4Processor/GDMLProcessor.h"
-#include "G4Processor/GDMLExpressionEvaluator.h"
-
-// LCDD
-#include "LCDDProcessor.hh"
-#include "limit.hh"
-
-// G4
-#include "G4UserLimits.hh"
-
-/**
- * @class limitSubscriber
- * @brief SAX subscriber for limit element to create G4UserLimits.
-*/
-class limitSubscriber : virtual public SAXSubscriber
-{
-public:
-  virtual const SAXComponentObject* Build() const
-  {
-    return this;
-  }
-
-public:
-  limitSubscriber()
-  {
-    Subscribe("limit");
-  }
-
-  virtual ~limitSubscriber()
-  {}
-
-  virtual void Activate(const SAXObject* object)
-  {
-    GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
-
-    if ( object ) {
-      const limit* lim = dynamic_cast<const limit*> ( object );
-
-      if ( lim ) {
-	std::string name = lim->get_name();
-
-	std::string sslmx = lim->get_step_length_max();
-	std::string strklmx = lim->get_track_length_max();
-	std::string stmx = lim->get_time_max();
-	std::string sekmn = lim->get_ekin_min();
-	std::string srmn = lim->get_range_min();
-
-	std::string eu = lim->get_eunit();
-	std::string lu = lim->get_lunit();
-	std::string tu = lim->get_tunit();
-	
-	// print limit settings from element
-	std::cout << "limit settings (element)" << std::endl;
-	std::cout << "name: " << name << std::endl;
-	std::cout << "sslmx: " << sslmx << std::endl;
-	std::cout << "strklmx: " << strklmx << std::endl;
-	std::cout << "stmx: " << stmx << std::endl;
-	std::cout << "sekmn: " << sekmn << std::endl;
-	std::cout << "srmn: " << srmn << std::endl;
-	std::cout << "eu: " << eu << std::endl;	
-	std::cout << "lu: " << lu << std::endl;
-	std::cout << "tu: " << tu << std::endl;
-	std::cout << std::endl;
-	//
-
-	double slmx;
-	double trklmx;
-	double tmx;
-	double ekmn;
-	double rmn;
-	slmx = trklmx = tmx = ekmn = rmn = 0;
-
-	std::string sval;
-
-	// step length max
-	sval = sslmx;
-	sval += "*" + lu;
-	slmx = calc->Eval( sval );
-
-	if ( 0 == slmx ) {
-	  slmx = DBL_MAX;
-	}
-
-	// track length max
-	sval = strklmx;
-	sval += "*" + lu;
-	trklmx = calc->Eval( sval );
-
-	if ( 0 == trklmx ) {
-	  std::cout << "trklmx from default" << std::endl;
-	  trklmx = DBL_MAX;
-	}
-
-	// time max
-	sval = stmx;
-	sval += "*" + tu;
-	tmx = calc->Eval( sval );
-
-	if ( 0 == tmx ) {
-	  std::cout << "tmx from default" << std::endl;
-	  tmx = DBL_MAX;
-	}
-	
-	// energy max
-	sval = sekmn;
-	sval += "*" + eu;
-	ekmn = calc->Eval( sval );	
-	// 0 default is ok
-
-	// range min
-	sval = srmn;
-	sval += "*" + lu;
-	rmn = calc->Eval( sval );
-	// 0 default is ok
-	
-	std::cout << "limit settings (computed)" << std::endl;
-	std::cout << "slmx: " << slmx << std::endl;
-	std::cout << "trklmx: " << trklmx << std::endl;
-	std::cout << "tmx: " << tmx << std::endl;
-	std::cout << "ekmn: " << ekmn << std::endl;
-	std::cout << "rmn: " << rmn << std::endl;
-	std::cout << std::endl;
-
-	G4UserLimits* g4ulim = new G4UserLimits(name,
-						slmx,
-						trklmx,
-						tmx,
-						ekmn,
-						rmn);
-
-	LCDDProcessor::instance()->addUserLimits( name, g4ulim );	
-      }
-      else {
-	G4Exception( "Failed cast to limit." );
-      }
-    }
-    else {
-      G4Exception( "SAXObject is null!" );
-    }   
-  }
-
-};
-
-DECLARE_SUBSCRIBER_FACTORY(limitSubscriber);
CVSspam 0.2.8