4 added + 3 modified, total 7 files
slic/include
diff -N FieldMessenger.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FieldMessenger.hh 10 Sep 2005 00:24:28 -0000 1.1
@@ -0,0 +1,38 @@
+// $Header: /cvs/lcd/slic/include/FieldMessenger.hh,v 1.1 2005/09/10 00:24:28 jeremy Exp $
+#ifndef FieldMessenger_hh
+#define FieldMessenger_hh 1
+
+#include "G4UImessenger.hh"
+
+class G4UIcmdWithADoubleAndUnit;
+class G4UIcommand;
+class G4UIdirectory;
+
+namespace slic
+{
+ /**
+ * @class FieldMessenger
+ * @brief G4UImessenger to G4FieldManager (and related).
+ */
+ class FieldMessenger : public G4UImessenger
+ {
+ public:
+ FieldMessenger();
+ virtual ~FieldMessenger();
+
+ public:
+ virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ private:
+ void defineCommands();
+
+ private:
+ G4UIdirectory* m_fieldDir;
+
+ G4UIcommand* m_selectStepperCmd;
+ G4UIcmdWithADoubleAndUnit* m_setDeltaOneStepCmd;
+ G4UIcmdWithADoubleAndUnit* m_setDeltaIntersectionCmd;
+ };
+}
+
+#endif
slic/include
diff -N G4MagIntegratorStepperFactory.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ G4MagIntegratorStepperFactory.hh 10 Sep 2005 00:24:28 -0000 1.1
@@ -0,0 +1,35 @@
+// $Header: /cvs/lcd/slic/include/G4MagIntegratorStepperFactory.hh,v 1.1 2005/09/10 00:24:28 jeremy Exp $
+
+#include <string>
+
+class G4MagIntegratorStepper;
+class G4Mag_EqRhs;
+class G4FieldManager;
+class G4MagneticField;
+
+namespace slic
+{
+ class G4MagIntegratorStepperFactory
+ {
+ public:
+
+ static G4MagIntegratorStepperFactory* instance();
+ virtual ~G4MagIntegratorStepperFactory();
+
+ protected:
+
+ G4MagIntegratorStepperFactory();
+
+ public:
+ void setupG4MagIntegratorStepper(std::string name);
+
+ private:
+ G4MagIntegratorStepper* createG4MagIntegratorStepper(std::string name);
+
+ private:
+ G4Mag_EqRhs* m_fieldEquations;
+ G4FieldManager* m_fieldMgr;
+ G4MagneticField* m_field;
+ static G4MagIntegratorStepperFactory* m_instance;
+ };
+}
slic/include
diff -u -r1.30 -r1.31
--- G4Application.hh 7 Sep 2005 22:23:33 -0000 1.30
+++ G4Application.hh 10 Sep 2005 00:24:28 -0000 1.31
@@ -1,10 +1,9 @@
-// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.30 2005/09/07 22:23:33 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.31 2005/09/10 00:24:28 jeremy Exp $
#ifndef slic_G4Application_hh
#define slic_G4Application_hh 1
// SLIC
#include "RunManager.hh"
-
#include "StringUtil.hh"
// G4
@@ -26,13 +25,14 @@
{
class G4ApplicationMessenger;
+ class FieldMessenger;
/**
* @class G4Application
* @brief Singleton class for an extendable Geant4 application.
- * @note Instantiates a number of global static manager classes,
- * including user actions, G4RunManager, CmdManager, and
- * GeneratorManager and PhysicsListManager.
+ * @note Instantiates manager and messenger classes, including
+ * user actions, G4RunManager, CmdManager, GeneratorManager
+ * and PhysicsListManager.
*/
class G4Application
{
@@ -77,50 +77,6 @@
os << "/log/filename" << std::endl;
}
- // application ID strings to be overridden in user app
- // virtual const std::string& getVersionString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getAuthorString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getNameString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getAbbrevString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getInstitutionString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // app should return CVS Date keyword
- // virtual const std::string& getChangeDateString() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getWWW() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // virtual const std::string& getEmail() const
- // {
- // return StringUtil::NULL_STR;
- // }
-
- // std::string getFullApplicationString() const;
-
void printSplashScreen(std::ostream& os) const;
ReturnCodeType getReturnCode() const
@@ -197,6 +153,9 @@
// app messenger
G4ApplicationMessenger* m_appMessenger;
+ // field messenger
+ FieldMessenger* m_fieldMessenger;
+
// application run mode: batch or interactive
ERunMode m_mode;
slic/src
diff -N FieldMessenger.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FieldMessenger.cc 10 Sep 2005 00:24:29 -0000 1.1
@@ -0,0 +1,74 @@
+// $Header: /cvs/lcd/slic/src/FieldMessenger.cc,v 1.1 2005/09/10 00:24:29 jeremy Exp $
+#include "FieldMessenger.hh"
+
+// G4
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4FieldManager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4TransportationManager.hh"
+#include "G4ApplicationState.hh"
+
+// slic
+#include "G4MagIntegratorStepperFactory.hh"
+
+namespace slic
+{
+
+ FieldMessenger::FieldMessenger()
+ {
+ defineCommands();
+ }
+
+ FieldMessenger::~FieldMessenger()
+ {
+ delete m_fieldDir;
+ delete m_selectStepperCmd;
+ delete m_setDeltaOneStepCmd;
+ delete m_setDeltaIntersectionCmd;
+ }
+
+ void FieldMessenger::SetNewValue(G4UIcommand* cmd, G4String newVals)
+ {
+ G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
+
+ if (cmd==m_selectStepperCmd) {
+ G4MagIntegratorStepperFactory::instance()->setupG4MagIntegratorStepper(newVals);
+ }
+ else if (cmd==m_setDeltaOneStepCmd) {
+ double deltaOneStep = m_setDeltaOneStepCmd->GetNewDoubleValue(newVals);
+ fieldMgr->SetDeltaOneStep(deltaOneStep);
+ }
+ else if (cmd==m_setDeltaIntersectionCmd) {
+ double deltaIntersection = m_setDeltaIntersectionCmd->GetNewDoubleValue(newVals);
+ fieldMgr->SetDeltaIntersection(deltaIntersection);
+ }
+ else {
+ G4Exception("Unknown command " + cmd->GetCommandName() );
+ }
+ }
+
+ void FieldMessenger::defineCommands()
+ {
+ G4UIparameter *p;
+
+ m_fieldDir = new G4UIdirectory("/field");
+ m_fieldDir->SetGuidance("Magnetic field customization commands.");
+
+ m_selectStepperCmd = new G4UIcommand("/field/selectStepper", this);
+ m_selectStepperCmd->SetGuidance("Select the G4MagIntegratorStepper.");
+ p = new G4UIparameter("stepper", 's', false );
+ m_selectStepperCmd->SetParameter(p);
+ m_selectStepperCmd->AvailableForStates(G4State_Init, G4State_Idle);
+
+ m_setDeltaOneStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep", this);
+ m_setDeltaOneStepCmd->SetGuidance("Set the delta of one step.");
+ m_setDeltaOneStepCmd->SetDefaultUnit("mm");
+ m_setDeltaOneStepCmd->AvailableForStates(G4State_Init, G4State_Idle);
+
+ m_setDeltaIntersectionCmd = new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection", this);
+ m_setDeltaIntersectionCmd->SetGuidance("Set the delta of intersection.");
+ m_setDeltaIntersectionCmd->SetDefaultUnit("mm");
+ m_setDeltaIntersectionCmd->AvailableForStates(G4State_Init, G4State_Idle);
+ }
+}
slic/src
diff -N G4MagIntegratorStepperFactory.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ G4MagIntegratorStepperFactory.cc 10 Sep 2005 00:24:29 -0000 1.1
@@ -0,0 +1,110 @@
+// $Header: /cvs/lcd/slic/src/G4MagIntegratorStepperFactory.cc,v 1.1 2005/09/10 00:24:29 jeremy Exp $
+#include "G4MagIntegratorStepperFactory.hh"
+
+// G4
+#include "G4Mag_UsualEqRhs.hh"
+#include "G4ChordFinder.hh"
+#include "G4MagIntegratorStepper.hh"
+#include "G4ClassicalRK4.hh"
+#include "G4ExplicitEuler.hh"
+#include "G4HelixExplicitEuler.hh"
+#include "G4HelixHeum.hh"
+#include "G4HelixImplicitEuler.hh"
+#include "G4HelixSimpleRunge.hh"
+#include "G4ImplicitEuler.hh"
+#include "G4RKG3_Stepper.hh"
+#include "G4SimpleHeum.hh"
+#include "G4SimpleRunge.hh"
+#include "G4MagneticField.hh"
+#include "G4FieldManager.hh"
+#include "G4TransportationManager.hh"
+
+using std::string;
+
+namespace slic
+{
+ G4MagIntegratorStepperFactory* G4MagIntegratorStepperFactory::m_instance = 0;
+
+ G4MagIntegratorStepperFactory* G4MagIntegratorStepperFactory::instance()
+ {
+ if ( m_instance == 0 ) {
+ m_instance = new G4MagIntegratorStepperFactory();
+ }
+ return m_instance;
+ }
+
+ G4MagIntegratorStepperFactory::G4MagIntegratorStepperFactory()
+ {
+ m_fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
+
+ if ( m_fieldMgr == 0 ) {
+ G4Exception("G4FieldManager is null.");
+ }
+
+ m_field = static_cast<G4MagneticField*>(const_cast<G4Field*>(m_fieldMgr->GetDetectorField()));
+
+ if ( m_field == 0 ) {
+ std::cerr << "Command refused. Detector has no G4MagneticField." << std::endl;
+ }
+ else {
+ m_fieldEquations = new G4Mag_UsualEqRhs(m_field);
+ }
+ }
+
+ G4MagIntegratorStepperFactory::~G4MagIntegratorStepperFactory()
+ {
+ delete m_fieldEquations;
+ }
+
+ void G4MagIntegratorStepperFactory::setupG4MagIntegratorStepper(std::string name)
+ {
+ std::cout << "Setting up new G4MagIntegratorStepper <" << name << ">" << std::endl;
+
+ G4ChordFinder* oldChordFinder = m_fieldMgr->GetChordFinder();
+ if (oldChordFinder != 0) {
+ delete oldChordFinder;
+ }
+
+ G4MagIntegratorStepper* stepper = createG4MagIntegratorStepper(name);
+ m_fieldMgr->SetChordFinder(new G4ChordFinder(m_field, 1E-2*mm, stepper));
+ }
+
+ G4MagIntegratorStepper* G4MagIntegratorStepperFactory::createG4MagIntegratorStepper(string name)
+ {
+ if (name=="G4ClassicalRK4") {
+ return new G4ClassicalRK4(m_fieldEquations);
+ }
+ else if (name=="G4ExlicitEuler") {
+ return new G4ExplicitEuler(m_fieldEquations);
+ }
+ else if (name=="G4HelixExplicitEuler") {
+ return new G4HelixExplicitEuler(m_fieldEquations);
+ }
+ else if (name=="G4HelixHeum") {
+ return new G4HelixHeum(m_fieldEquations);
+ }
+ else if (name=="G4HelixImplicitEuler") {
+ return new G4HelixImplicitEuler(m_fieldEquations);
+ }
+ else if (name=="G4G4HelixSimpleRunge") {
+ return new G4HelixSimpleRunge(m_fieldEquations);
+ }
+ else if (name=="G4ImplicitEuler") {
+ return new G4ImplicitEuler(m_fieldEquations);
+ }
+ else if (name=="G4RKG3_Stepper") {
+ return new G4RKG3_Stepper(m_fieldEquations);
+ }
+ else if (name=="G4SimpleHeum") {
+ return new G4SimpleHeum(m_fieldEquations);
+ }
+ else if (name=="G4SimpleRunge") {
+ return new G4SimpleRunge(m_fieldEquations);
+ }
+ else {
+ G4Exception("Unknown G4MagIntegratorStepper " + name);
+ }
+
+ return 0;
+ }
+}
slic/src
diff -u -r1.45 -r1.46
--- G4Application.cc 7 Sep 2005 22:23:33 -0000 1.45
+++ G4Application.cc 10 Sep 2005 00:24:29 -0000 1.46
@@ -1,9 +1,9 @@
-// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.45 2005/09/07 22:23:33 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.46 2005/09/10 00:24:29 jeremy Exp $
#include "G4Application.hh"
// SLIC
-
#include "PackageInfo.hh"
+#include "FieldMessenger.hh"
// managers to init
#include "G4ApplicationMessenger.hh"
@@ -69,6 +69,9 @@
// init app messenger
m_appMessenger = new G4ApplicationMessenger(this);
+ // init field messenger
+ m_fieldMessenger = new FieldMessenger();
+
// init log manager
LogManager::instance();
slic/src
diff -u -r1.4 -r1.5
--- LcioMcpMessenger.cc 27 Jun 2005 18:48:52 -0000 1.4
+++ LcioMcpMessenger.cc 10 Sep 2005 00:24:29 -0000 1.5
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpMessenger.cc,v 1.4 2005/06/27 18:48:52 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpMessenger.cc,v 1.5 2005/09/10 00:24:29 jeremy Exp $
#include "LcioMcpMessenger.hh"
#include "LcioManager.hh"
@@ -57,7 +57,7 @@
// Mcp dir
m_mcpDir = new G4UIdirectory( "/mcp/" );
- m_mcpDir->SetGuidance( "Lcio Monte Carlo Particle commands." );
+ m_mcpDir->SetGuidance( "LCIO Monte Carlo Particle commands." );
// minimumTrackingDistance
m_minTrackingDistanceCmd = new G4UIcmdWithADoubleAndUnit( "/mcp/minimumTrackingDistance", this );
CVSspam 0.2.8