G4ErrorMessenger.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4ErrorMessenger.cc 69766 2013-05-14 14:33:55Z gcosmo $
00027 //
00028 // ------------------------------------------------------------
00029 //      GEANT 4 class implementation file 
00030 // ------------------------------------------------------------
00031 //
00032 
00033 #include "G4ErrorMessenger.hh"
00034 #include "G4ErrorStepLengthLimitProcess.hh"
00035 #include "G4ErrorMagFieldLimitProcess.hh"
00036 #include "G4ErrorEnergyLoss.hh"
00037 
00038 #include "G4UIdirectory.hh"
00039 #include "G4UIcmdWithADoubleAndUnit.hh"
00040 #include "G4UIcmdWithADouble.hh"
00041 #include "globals.hh"
00042 
00043 #ifdef G4VERBOSE
00044 #include "G4ErrorPropagatorData.hh" //for verbosity checking
00045 #endif
00046 
00047 //------------------------------------------------------------------------
00048 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStepLengthLimitProcess* lengthAct, G4ErrorMagFieldLimitProcess* magAct, G4ErrorEnergyLoss* elossAct)
00049   :StepLengthAction(lengthAct),MagFieldAction(magAct),EnergyLossAction(elossAct)
00050 {
00051 
00052   myDir = new G4UIdirectory("/geant4e/");
00053   myDir->SetGuidance("GEANT4e control commands");
00054   
00055   myDirLimits = new G4UIdirectory("/geant4e/limits/");
00056   myDirLimits->SetGuidance("GEANT4e commands to limit the step");
00057 
00058 
00059   StepLengthLimitCmd = new G4UIcmdWithADoubleAndUnit("/geant4e/limits/stepLength",this);  
00060   StepLengthLimitCmd->SetGuidance("Limit the length of an step");
00061   StepLengthLimitCmd->SetDefaultUnit("mm");
00062   StepLengthLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00063 
00064   MagFieldLimitCmd = new G4UIcmdWithADouble("/geant4e/limits/magField",this);  
00065   MagFieldLimitCmd->SetGuidance("Limit the length of an step");
00066   MagFieldLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00067 
00068   EnergyLossCmd = new G4UIcmdWithADouble("/geant4e/limits/energyLoss",this);  
00069   EnergyLossCmd->SetGuidance("Limit the length of an step");
00070   EnergyLossCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00071 }
00072 
00073 
00074 //------------------------------------------------------------------------
00075 G4ErrorMessenger::~G4ErrorMessenger()
00076 {
00077   delete StepLengthLimitCmd;
00078   delete MagFieldLimitCmd;
00079   delete EnergyLossCmd;
00080   delete myDir;
00081   delete myDirLimits;
00082 }
00083 
00084 
00085 //------------------------------------------------------------------------
00086 void G4ErrorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
00087 {   
00088   if( command == StepLengthLimitCmd ) { 
00089 #ifdef G4VERBOSE
00090     if(G4ErrorPropagatorData::verbose() >= 3 ) { 
00091       G4cout << " G4ErrorMessenger::StepLengthAction SetStepLimit " << StepLengthLimitCmd->GetNewDoubleValue(newValue) << G4endl;
00092     }
00093 #endif
00094     StepLengthAction->SetStepLimit(StepLengthLimitCmd->GetNewDoubleValue(newValue));
00095   } else if( command == MagFieldLimitCmd ) { 
00096 #ifdef G4VERBOSE
00097     if(G4ErrorPropagatorData::verbose() >= 3 ) { 
00098       G4cout << " G4ErrorMessenger::MagFieldAction SetStepLimit " << MagFieldLimitCmd->GetNewDoubleValue(newValue) << G4endl;
00099     }
00100 #endif
00101     MagFieldAction->SetStepLimit(MagFieldLimitCmd->GetNewDoubleValue(newValue));
00102   } else if( command == EnergyLossCmd ) { 
00103 #ifdef G4VERBOSE
00104     if(G4ErrorPropagatorData::verbose() >= 3 ) { 
00105       G4cout << " G4ErrorMessenger::EnergyLossAction SetStepLimit " << EnergyLossCmd->GetNewDoubleValue(newValue) << G4endl;
00106     }
00107 #endif
00108     EnergyLossAction->SetStepLimit(EnergyLossCmd->GetNewDoubleValue(newValue));
00109   }
00110 }
00111 

Generated on Mon May 27 17:48:11 2013 for Geant4 by  doxygen 1.4.7