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