slic/include
diff -N PhysicsListFactory.hh
--- PhysicsListFactory.hh 27 Nov 2012 19:32:18 -0000 1.16
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-// $Header: /cvs/lcd/slic/include/Attic/PhysicsListFactory.hh,v 1.16 2012/11/27 19:32:18 jeremy Exp $
-#ifndef SLIC_PHYSICSLISTFACTORY_HH
-#define SLIC_PHYSICSLISTFACTORY_HH 1
-
-// lcdd
-#include "Module.hh"
-
-// slic
-#include "PhysicsListBuilder.hh"
-#include "Singleton.hh"
-
-// geant4
-#include "G4VUserPhysicsList.hh"
-
-namespace slic {
-
-class VPhysicsListBuilder;
-
-/**
- * @class PhysicsListFactory
- *
- * Factory to instantiate a Geant4 physics list from the name.
- *
- * Each available list has a header in
- *
- * $G4INSTALL/source/physics_lists/lists/include
- *
- * This version of slic uses the Physics Lists defined in the Geant4 9.4 release.
- */
-class PhysicsListFactory: public Singleton<PhysicsListFactory>, public Module {
-
-public:
- PhysicsListFactory();
-
- virtual ~PhysicsListFactory();
-
-public:
-
- /**
- * Map of list names to builders.
- */
- typedef std::map<G4String, VPhysicsListBuilder*> BuilderMap;
-
-public:
-
- /**
- * Initialize a TPhysicsListBuilder for each supported physics list.
- */
- void initializeBuilders();
-
- /**
- * Add a builder that can instantiate a physics list.
- * @param The VPhysicsListBuilder to add to the PhysicsListFactory .
- */
- void addBuilder(VPhysicsListBuilder*);
-
- /**
- * @param name The name of the physics list to instantiate.
- * @return A G4VUserPhysicsList with a concrete type of @param name, such as LHEP.
- */
- G4VUserPhysicsList* create(const std::string& name);
-
- /**
- * Print the available lists with their descriptions to the log.
- */
- void printAvailableLists();
-
-private:
-
- BuilderMap m_builders;
-};
-}
-
-#endif
-
slic/src
diff -N PhysicsListFactory.cc
--- PhysicsListFactory.cc 27 Nov 2012 19:32:19 -0000 1.31
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-// $Header: /cvs/lcd/slic/src/Attic/PhysicsListFactory.cc,v 1.31 2012/11/27 19:32:19 jeremy Exp $
-#include "PhysicsListFactory.hh"
-
-// Include generated list of Geant4 PhysLists.
-#include "G4PhysicsLists.hh"
-
-// slic
-#include "PhysicsListBuilder.hh"
-
-using namespace std;
-
-/**
- * A macro to add a TPhysicsListBuilder for a single physics list.
- *
- * @param list The class name of the list.
- * @param description A short description of the list.
- */
-#define BUILDER(list,description) this->addBuilder( new TPhysicsListBuilder<list>( #list, description ) );
-
-namespace slic {
-
-PhysicsListFactory::PhysicsListFactory() :
- Module("PhysicsListFactory") {
- initializeBuilders();
-}
-
-PhysicsListFactory::~PhysicsListFactory() {
- for (BuilderMap::const_iterator it = m_builders.begin(); it != m_builders.end(); it++) {
- delete it->second;
- }
- m_builders.clear();
-}
-
-G4VUserPhysicsList* PhysicsListFactory::create(const std::string& name) {
- log().okay("Creating physics list <" + name + ">.");
-
- G4VUserPhysicsList* physicslist = 0;
-
- VPhysicsListBuilder* builder = m_builders[name];
-
- if (builder != 0) {
- physicslist = builder->create();
- } else {
- G4Exception("", "", FatalException, "No builder found for physics list.");
- }
-
- return physicslist;
-}
-
-void PhysicsListFactory::printAvailableLists() {
- log() << LOG::okay << LOG::done;
- log() << LOG::okay << "----GEANT4 PHYSICS LISTS----" << LOG::endl << LOG::done;
- log() << LOG::okay << "NAME DESCRIPTION" << LOG::done;
- log() << LOG::okay << "----------------------------------------------------------------------"
- << LOG::done;
- for (BuilderMap::const_iterator it = m_builders.begin(); it != m_builders.end(); it++) {
- log().width(15);
- log() << LOG::okay << left << it->first;
- log() << LOG::okay << it->second->getDescription() << LOG::done;
- }
-}
-
-/**
- * Initialize all supported builders.
- * Based on lists from Geant4 9.2.p02.
- */
-void PhysicsListFactory::initializeBuilders() {
-// Include generated PhysList builders.
-#include "G4PhysicsBuilders.icc"
-}
-
-void PhysicsListFactory::addBuilder(VPhysicsListBuilder* builder) {
- const G4String& name = builder->getName();
-
- if (m_builders.find(name) != m_builders.end()) {
- log() << LOG::warning << "Ignoring duplicate physics list builder for <" << name << "> ."
- << LOG::done;
- } else {
- m_builders[name] = builder;
- }
-}
-}