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 66892 2013-01-17 10:57:59Z gunter $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file << 29 // GEANT 4 class implementation file 29 // ------------------------------------------- 30 // ------------------------------------------------------------ 30 // 31 // 31 32 32 #include "G4ErrorMessenger.hh" 33 #include "G4ErrorMessenger.hh" 33 #include "G4ErrorStepLengthLimitProcess.hh" 34 #include "G4ErrorStepLengthLimitProcess.hh" 34 #include "G4ErrorMagFieldLimitProcess.hh" 35 #include "G4ErrorMagFieldLimitProcess.hh" 35 #include "G4ErrorEnergyLoss.hh" 36 #include "G4ErrorEnergyLoss.hh" 36 37 37 #include "G4UIdirectory.hh" 38 #include "G4UIdirectory.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithADouble.hh" 40 #include "G4UIcmdWithADouble.hh" 40 #include "globals.hh" 41 #include "globals.hh" 41 42 42 #ifdef G4VERBOSE 43 #ifdef G4VERBOSE 43 # include "G4ErrorPropagatorData.hh" //for v << 44 #include "G4ErrorPropagatorData.hh" //for verbosity checking 44 #endif 45 #endif 45 46 46 //-------------------------------------------- 47 //------------------------------------------------------------------------ 47 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStep << 48 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStepLengthLimitProcess* lengthAct, G4ErrorMagFieldLimitProcess* magAct, G4ErrorEnergyLoss* elossAct) 48 G4ErrorMagF << 49 :StepLengthAction(lengthAct),MagFieldAction(magAct),EnergyLossAction(elossAct) 49 G4ErrorEner << 50 : StepLengthAction(lengthAct) << 51 , MagFieldAction(magAct) << 52 , EnergyLossAction(elossAct) << 53 { 50 { >> 51 54 myDir = new G4UIdirectory("/geant4e/"); 52 myDir = new G4UIdirectory("/geant4e/"); 55 myDir->SetGuidance("GEANT4e control commands 53 myDir->SetGuidance("GEANT4e control commands"); 56 << 54 57 myDirLimits = new G4UIdirectory("/geant4e/li 55 myDirLimits = new G4UIdirectory("/geant4e/limits/"); 58 myDirLimits->SetGuidance("GEANT4e commands t 56 myDirLimits->SetGuidance("GEANT4e commands to limit the step"); 59 57 60 StepLengthLimitCmd = << 58 61 new G4UIcmdWithADoubleAndUnit("/geant4e/li << 59 StepLengthLimitCmd = new G4UIcmdWithADoubleAndUnit("/geant4e/limits/stepLength",this); 62 StepLengthLimitCmd->SetGuidance("Limit the l 60 StepLengthLimitCmd->SetGuidance("Limit the length of an step"); 63 StepLengthLimitCmd->SetDefaultUnit("mm"); 61 StepLengthLimitCmd->SetDefaultUnit("mm"); 64 StepLengthLimitCmd->AvailableForStates(G4Sta << 62 StepLengthLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 65 G4Sta << 66 63 67 MagFieldLimitCmd = new G4UIcmdWithADouble("/ << 64 MagFieldLimitCmd = new G4UIcmdWithADouble("/geant4e/limits/magField",this); 68 MagFieldLimitCmd->SetGuidance("Limit the len 65 MagFieldLimitCmd->SetGuidance("Limit the length of an step"); 69 MagFieldLimitCmd->AvailableForStates(G4State << 66 MagFieldLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 70 G4State << 71 67 72 EnergyLossCmd = new G4UIcmdWithADouble("/gea << 68 EnergyLossCmd = new G4UIcmdWithADouble("/geant4e/limits/energyLoss",this); 73 EnergyLossCmd->SetGuidance("Limit the length 69 EnergyLossCmd->SetGuidance("Limit the length of an step"); 74 EnergyLossCmd->AvailableForStates(G4State_Pr << 70 EnergyLossCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 75 G4State_Ge << 76 } 71 } 77 72 >> 73 78 //-------------------------------------------- 74 //------------------------------------------------------------------------ 79 G4ErrorMessenger::~G4ErrorMessenger() 75 G4ErrorMessenger::~G4ErrorMessenger() 80 { 76 { 81 delete StepLengthLimitCmd; 77 delete StepLengthLimitCmd; 82 delete MagFieldLimitCmd; 78 delete MagFieldLimitCmd; 83 delete EnergyLossCmd; 79 delete EnergyLossCmd; 84 delete myDir; 80 delete myDir; 85 delete myDirLimits; 81 delete myDirLimits; 86 } 82 } 87 83 >> 84 88 //-------------------------------------------- 85 //------------------------------------------------------------------------ 89 void G4ErrorMessenger::SetNewValue(G4UIcommand << 86 void G4ErrorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 90 { << 87 { 91 if(command == StepLengthLimitCmd) << 88 if( command == StepLengthLimitCmd ) { 92 { << 93 #ifdef G4VERBOSE 89 #ifdef G4VERBOSE 94 if(G4ErrorPropagatorData::verbose() >= 3) << 90 if(G4ErrorPropagatorData::verbose() >= 3 ) { 95 { << 91 G4cout << " G4ErrorMessenger::StepLengthAction SetStepLimit " << StepLengthLimitCmd->GetNewDoubleValue(newValue) << G4endl; 96 G4cout << " G4ErrorMessenger::StepLength << 97 << StepLengthLimitCmd->GetNewDoub << 98 } 92 } 99 #endif 93 #endif 100 StepLengthAction->SetStepLimit( << 94 StepLengthAction->SetStepLimit(StepLengthLimitCmd->GetNewDoubleValue(newValue)); 101 StepLengthLimitCmd->GetNewDoubleValue(ne << 95 } else if( command == MagFieldLimitCmd ) { 102 } << 103 else if(command == MagFieldLimitCmd) << 104 { << 105 #ifdef G4VERBOSE 96 #ifdef G4VERBOSE 106 if(G4ErrorPropagatorData::verbose() >= 3) << 97 if(G4ErrorPropagatorData::verbose() >= 3 ) { 107 { << 98 G4cout << " G4ErrorMessenger::MagFieldAction SetStepLimit " << MagFieldLimitCmd->GetNewDoubleValue(newValue) << G4endl; 108 G4cout << " G4ErrorMessenger::MagFieldAc << 109 << MagFieldLimitCmd->GetNewDouble << 110 } 99 } 111 #endif 100 #endif 112 MagFieldAction->SetStepLimit(MagFieldLimit 101 MagFieldAction->SetStepLimit(MagFieldLimitCmd->GetNewDoubleValue(newValue)); 113 } << 102 } else if( command == EnergyLossCmd ) { 114 else if(command == EnergyLossCmd) << 115 { << 116 #ifdef G4VERBOSE 103 #ifdef G4VERBOSE 117 if(G4ErrorPropagatorData::verbose() >= 3) << 104 if(G4ErrorPropagatorData::verbose() >= 3 ) { 118 { << 105 G4cout << " G4ErrorMessenger::EnergyLossAction SetStepLimit " << EnergyLossCmd->GetNewDoubleValue(newValue) << G4endl; 119 G4cout << " G4ErrorMessenger::EnergyLoss << 120 << EnergyLossCmd->GetNewDoubleVal << 121 } 106 } 122 #endif 107 #endif 123 EnergyLossAction->SetStepLimit(EnergyLossC 108 EnergyLossAction->SetStepLimit(EnergyLossCmd->GetNewDoubleValue(newValue)); 124 } 109 } 125 } 110 } >> 111 126 112