Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: G4ErrorMessenger.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $ >> 27 // GEANT4 tag $Name: geant4-09-02 $ 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file << 30 // GEANT 4 class implementation file 29 // ------------------------------------------- 31 // ------------------------------------------------------------ 30 // 32 // 31 33 32 #include "G4ErrorMessenger.hh" 34 #include "G4ErrorMessenger.hh" 33 #include "G4ErrorStepLengthLimitProcess.hh" 35 #include "G4ErrorStepLengthLimitProcess.hh" 34 #include "G4ErrorMagFieldLimitProcess.hh" 36 #include "G4ErrorMagFieldLimitProcess.hh" 35 #include "G4ErrorEnergyLoss.hh" 37 #include "G4ErrorEnergyLoss.hh" 36 38 37 #include "G4UIdirectory.hh" 39 #include "G4UIdirectory.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 40 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithADouble.hh" 41 #include "G4UIcmdWithADouble.hh" 40 #include "globals.hh" 42 #include "globals.hh" 41 43 42 #ifdef G4VERBOSE 44 #ifdef G4VERBOSE 43 # include "G4ErrorPropagatorData.hh" //for v << 45 #include "G4ErrorPropagatorData.hh" //for verbosity checking 44 #endif 46 #endif 45 47 46 //-------------------------------------------- 48 //------------------------------------------------------------------------ 47 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStep << 49 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStepLengthLimitProcess* lengthAct, G4ErrorMagFieldLimitProcess* magAct, G4ErrorEnergyLoss* elossAct) 48 G4ErrorMagF << 50 :StepLengthAction(lengthAct),MagFieldAction(magAct),EnergyLossAction(elossAct) 49 G4ErrorEner << 50 : StepLengthAction(lengthAct) << 51 , MagFieldAction(magAct) << 52 , EnergyLossAction(elossAct) << 53 { 51 { >> 52 54 myDir = new G4UIdirectory("/geant4e/"); 53 myDir = new G4UIdirectory("/geant4e/"); 55 myDir->SetGuidance("GEANT4e control commands 54 myDir->SetGuidance("GEANT4e control commands"); 56 << 55 57 myDirLimits = new G4UIdirectory("/geant4e/li 56 myDirLimits = new G4UIdirectory("/geant4e/limits/"); 58 myDirLimits->SetGuidance("GEANT4e commands t 57 myDirLimits->SetGuidance("GEANT4e commands to limit the step"); 59 58 60 StepLengthLimitCmd = << 59 61 new G4UIcmdWithADoubleAndUnit("/geant4e/li << 60 StepLengthLimitCmd = new G4UIcmdWithADoubleAndUnit("/geant4e/limits/stepLength",this); 62 StepLengthLimitCmd->SetGuidance("Limit the l 61 StepLengthLimitCmd->SetGuidance("Limit the length of an step"); 63 StepLengthLimitCmd->SetDefaultUnit("mm"); 62 StepLengthLimitCmd->SetDefaultUnit("mm"); 64 StepLengthLimitCmd->AvailableForStates(G4Sta << 63 StepLengthLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 65 G4Sta << 66 64 67 MagFieldLimitCmd = new G4UIcmdWithADouble("/ << 65 MagFieldLimitCmd = new G4UIcmdWithADouble("/geant4e/limits/magField",this); 68 MagFieldLimitCmd->SetGuidance("Limit the len 66 MagFieldLimitCmd->SetGuidance("Limit the length of an step"); 69 MagFieldLimitCmd->AvailableForStates(G4State << 67 MagFieldLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 70 G4State << 71 68 72 EnergyLossCmd = new G4UIcmdWithADouble("/gea << 69 EnergyLossCmd = new G4UIcmdWithADouble("/geant4e/limits/energyLoss",this); 73 EnergyLossCmd->SetGuidance("Limit the length 70 EnergyLossCmd->SetGuidance("Limit the length of an step"); 74 EnergyLossCmd->AvailableForStates(G4State_Pr << 71 EnergyLossCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 75 G4State_Ge << 76 } 72 } 77 73 >> 74 78 //-------------------------------------------- 75 //------------------------------------------------------------------------ 79 G4ErrorMessenger::~G4ErrorMessenger() 76 G4ErrorMessenger::~G4ErrorMessenger() 80 { 77 { 81 delete StepLengthLimitCmd; 78 delete StepLengthLimitCmd; 82 delete MagFieldLimitCmd; 79 delete MagFieldLimitCmd; 83 delete EnergyLossCmd; 80 delete EnergyLossCmd; 84 delete myDir; 81 delete myDir; 85 delete myDirLimits; 82 delete myDirLimits; 86 } 83 } 87 84 >> 85 88 //-------------------------------------------- 86 //------------------------------------------------------------------------ 89 void G4ErrorMessenger::SetNewValue(G4UIcommand << 87 void G4ErrorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 90 { << 88 { 91 if(command == StepLengthLimitCmd) << 89 if( command == StepLengthLimitCmd ) { 92 { << 93 #ifdef G4VERBOSE 90 #ifdef G4VERBOSE 94 if(G4ErrorPropagatorData::verbose() >= 3) << 91 if(G4ErrorPropagatorData::verbose() >= 3 ) { 95 { << 92 G4cout << " G4ErrorMessenger::StepLengthAction SetStepLimit " << StepLengthLimitCmd->GetNewDoubleValue(newValue) << G4endl; 96 G4cout << " G4ErrorMessenger::StepLength << 97 << StepLengthLimitCmd->GetNewDoub << 98 } 93 } 99 #endif 94 #endif 100 StepLengthAction->SetStepLimit( << 95 StepLengthAction->SetStepLimit(StepLengthLimitCmd->GetNewDoubleValue(newValue)); 101 StepLengthLimitCmd->GetNewDoubleValue(ne << 96 } else if( command == MagFieldLimitCmd ) { 102 } << 103 else if(command == MagFieldLimitCmd) << 104 { << 105 #ifdef G4VERBOSE 97 #ifdef G4VERBOSE 106 if(G4ErrorPropagatorData::verbose() >= 3) << 98 if(G4ErrorPropagatorData::verbose() >= 3 ) { 107 { << 99 G4cout << " G4ErrorMessenger::MagFieldAction SetStepLimit " << MagFieldLimitCmd->GetNewDoubleValue(newValue) << G4endl; 108 G4cout << " G4ErrorMessenger::MagFieldAc << 109 << MagFieldLimitCmd->GetNewDouble << 110 } 100 } 111 #endif 101 #endif 112 MagFieldAction->SetStepLimit(MagFieldLimit 102 MagFieldAction->SetStepLimit(MagFieldLimitCmd->GetNewDoubleValue(newValue)); 113 } << 103 } else if( command == EnergyLossCmd ) { 114 else if(command == EnergyLossCmd) << 115 { << 116 #ifdef G4VERBOSE 104 #ifdef G4VERBOSE 117 if(G4ErrorPropagatorData::verbose() >= 3) << 105 if(G4ErrorPropagatorData::verbose() >= 3 ) { 118 { << 106 G4cout << " G4ErrorMessenger::EnergyLossAction SetStepLimit " << EnergyLossCmd->GetNewDoubleValue(newValue) << G4endl; 119 G4cout << " G4ErrorMessenger::EnergyLoss << 120 << EnergyLossCmd->GetNewDoubleVal << 121 } 107 } 122 #endif 108 #endif 123 EnergyLossAction->SetStepLimit(EnergyLossC 109 EnergyLossAction->SetStepLimit(EnergyLossCmd->GetNewDoubleValue(newValue)); 124 } 110 } 125 } 111 } >> 112 126 113