Commit in slic/include on MAIN
PhysicsListBuilder.hh+71added 1.1
JM: New class for building Geant4 physics lists.

slic/include
PhysicsListBuilder.hh added at 1.1
diff -N PhysicsListBuilder.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PhysicsListBuilder.hh	18 Dec 2006 23:04:28 -0000	1.1
@@ -0,0 +1,71 @@
+#ifndef SLIC_PHYSICSLISTBUILDER_HH
+#define SLIC_PHYSICSLISTBUILDER_HH 1
+
+#include "G4VUserPhysicsList.hh"
+
+namespace slic
+{
+
+  /**
+   * Abstract class for building a single physics list such as LHEP or LCPhys.
+   */
+  class VPhysicsListBuilder
+  {
+
+  public:
+    VPhysicsListBuilder( const G4String& name,
+			 const G4String& description)
+      : m_name( name ),
+	m_description( description )
+    {}
+
+    virtual ~VPhysicsListBuilder() 
+    {;}
+
+  public:
+
+    const G4String& getName()
+    {
+      return m_name;
+    }
+
+    const G4String& getDescription()
+    {
+      return m_description;
+    }
+
+    virtual G4VUserPhysicsList* create() const = 0;
+
+  private:
+
+    G4String m_name;
+    G4String m_description;
+
+  };
+
+  /**
+   * Templated VPhysicsListBuilder for returning a concrete
+   * physics list object, such as LHEP or LCPhys.
+   */
+  template < class T >
+  class TPhysicsListBuilder : public VPhysicsListBuilder
+  {
+  public:
+    TPhysicsListBuilder( const G4String& name,
+			 const G4String& description )
+      : VPhysicsListBuilder( name, description )    
+    {}
+
+    virtual ~TPhysicsListBuilder()
+    {;}
+
+  public:
+
+    virtual G4VUserPhysicsList* create() const
+    {
+      return new T();
+    }
+  };
+} // namespace slic
+
+#endif
CVSspam 0.2.8