Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // $Id: GFlashShowerModelMessenger.cc,v 1.5 2005/11/28 18:09:26 gcosmo Exp $ >> 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 26 // 25 // 27 // 26 // 28 // ------------------------------------------- 27 // ------------------------------------------------------------ 29 // GEANT 4 class implementation 28 // GEANT 4 class implementation 30 // 29 // 31 // ------------- GFlashShowerModelMesseng 30 // ------------- GFlashShowerModelMessenger ------------- 32 // 31 // 33 // Author: Joanna Weng - 9.11.2004 32 // Author: Joanna Weng - 9.11.2004 34 // ------------------------------------------- 33 // ------------------------------------------------------------ 35 34 36 #include "GFlashShowerModelMessenger.hh" 35 #include "GFlashShowerModelMessenger.hh" 37 << 36 #include "GFlashShowerModel.hh" 38 #include "G4Electron.hh" << 37 #include "GFlashParticleBounds.hh" 39 #include "G4Positron.hh" << 38 #include "G4UIdirectory.hh" 40 #include "G4SystemOfUnits.hh" << 41 #include "G4UIcmdWithADouble.hh" << 42 #include "G4UIcmdWithADoubleAndUnit.hh" << 43 #include "G4UIcmdWithAString.hh" 39 #include "G4UIcmdWithAString.hh" >> 40 #include "G4UIcmdWithADoubleAndUnit.hh" >> 41 #include "G4UIcmdWithADouble.hh" 44 #include "G4UIcmdWithAnInteger.hh" 42 #include "G4UIcmdWithAnInteger.hh" 45 #include "G4UIdirectory.hh" << 43 #include "G4Electron.hh" >> 44 #include "G4Positron.hh" 46 #include "globals.hh" 45 #include "globals.hh" 47 46 48 #include "GFlashParticleBounds.hh" << 47 #include <iomanip> 49 #include "GFlashShowerModel.hh" << 50 << 51 #include <iomanip> << 52 #include <sstream> 48 #include <sstream> 53 49 54 GFlashShowerModelMessenger::GFlashShowerModelM << 50 GFlashShowerModelMessenger:: 55 { << 51 GFlashShowerModelMessenger(GFlashShowerModel * aModel) >> 52 { 56 myParaDir = new G4UIdirectory("/GFlash/"); 53 myParaDir = new G4UIdirectory("/GFlash/"); 57 myParaDir->SetGuidance("Parametrisation cont 54 myParaDir->SetGuidance("Parametrisation control."); 58 myModel = aModel; << 55 myModel= aModel; 59 << 56 60 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/ << 57 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this); 61 FlagCmd->SetGuidance("Defines if GFlash is a 58 FlagCmd->SetGuidance("Defines if GFlash is activated"); 62 FlagCmd->SetParameterName("flag", false, fal << 59 FlagCmd->SetParameterName("flag",false,false); 63 << 60 64 ContCmd = new G4UIcmdWithAnInteger("/GFlash/ << 61 ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this); 65 ContCmd->SetGuidance("Defines if Containment 62 ContCmd->SetGuidance("Defines if Containment is checked"); 66 ContCmd->SetParameterName("flag", false, fal << 63 ContCmd->SetParameterName("flag",false,false); 67 << 64 68 StepInX0Cmd = new G4UIcmdWithADouble("/GFlas << 65 StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this); 69 StepInX0Cmd->SetGuidance("Defines step lengh 66 StepInX0Cmd->SetGuidance("Defines step lenghts"); 70 StepInX0Cmd->SetParameterName("flag", false, << 67 StepInX0Cmd->SetParameterName("flag",false,false); 71 << 68 72 EminCmd = new G4UIcmdWithADoubleAndUnit("/GF << 69 EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this); 73 EminCmd->SetGuidance("Set minimum kinetic en 70 EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation"); 74 EminCmd->SetParameterName("Emin", false, fal << 71 EminCmd->SetParameterName("Emin",false,false); 75 EminCmd->SetDefaultUnit("GeV"); 72 EminCmd->SetDefaultUnit("GeV"); 76 EminCmd->SetUnitCategory("Energy"); 73 EminCmd->SetUnitCategory("Energy"); 77 EminCmd->AvailableForStates(G4State_PreInit, << 74 EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 78 << 75 79 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GF << 76 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this); 80 EmaxCmd->SetGuidance("Set maximum kinetic en 77 EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation"); 81 EmaxCmd->SetParameterName("Emax", false, fal << 78 EmaxCmd->SetParameterName("Emax",false,false); 82 EmaxCmd->SetDefaultUnit("GeV"); 79 EmaxCmd->SetDefaultUnit("GeV"); 83 EmaxCmd->SetUnitCategory("Energy"); 80 EmaxCmd->SetUnitCategory("Energy"); 84 EmaxCmd->AvailableForStates(G4State_PreInit, << 81 EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 85 << 82 86 EkillCmd = new G4UIcmdWithADoubleAndUnit("/G << 83 EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this); 87 EkillCmd->SetGuidance("Set maximum kinetic e 84 EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed"); 88 EkillCmd->SetParameterName("Ekill", false, f << 85 EkillCmd->SetParameterName("Ekill",false,false); 89 EkillCmd->SetDefaultUnit("GeV"); 86 EkillCmd->SetDefaultUnit("GeV"); 90 EkillCmd->SetUnitCategory("Energy"); 87 EkillCmd->SetUnitCategory("Energy"); 91 EkillCmd->AvailableForStates(G4State_PreInit << 88 EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 92 } 89 } 93 90 >> 91 94 GFlashShowerModelMessenger::~GFlashShowerModel 92 GFlashShowerModelMessenger::~GFlashShowerModelMessenger() 95 { 93 { 96 delete ContCmd; 94 delete ContCmd; 97 delete FlagCmd; 95 delete FlagCmd; 98 delete StepInX0Cmd; << 96 delete StepInX0Cmd; 99 delete EminCmd; 97 delete EminCmd; 100 delete EmaxCmd; 98 delete EmaxCmd; 101 delete EkillCmd; 99 delete EkillCmd; 102 } 100 } 103 101 104 void GFlashShowerModelMessenger::SetNewValue(G << 105 { << 106 if (command == FlagCmd) { << 107 myModel->SetFlagParamType(FlagCmd->GetNewI << 108 this->GetCurrentValue(command); << 109 } << 110 if (command == ContCmd) { << 111 myModel->SetFlagParticleContainment(ContCm << 112 this->GetCurrentValue(command); << 113 } << 114 if (command == StepInX0Cmd) { << 115 myModel->SetStepInX0(StepInX0Cmd->GetNewDo << 116 this->GetCurrentValue(command); << 117 } << 118 102 119 else if (command == EminCmd) { << 103 void GFlashShowerModelMessenger:: >> 104 SetNewValue(G4UIcommand * command,G4String newValues) >> 105 { >> 106 >> 107 if( command == FlagCmd ) { >> 108 myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues)); >> 109 this->GetCurrentValue(command); >> 110 } >> 111 if( command == ContCmd ) { >> 112 myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues)); >> 113 this->GetCurrentValue(command); >> 114 } >> 115 if( command == StepInX0Cmd ) { >> 116 myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues)); >> 117 this->GetCurrentValue(command); >> 118 } >> 119 >> 120 else if( command == EminCmd ) { 120 myModel->PBound->SetMinEneToParametrise(*G 121 myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition(), 121 Em << 122 EminCmd->GetNewDoubleValue(newValues)); 122 this->GetCurrentValue(command); << 123 this->GetCurrentValue(command); 123 } 124 } 124 << 125 125 else if (command == EmaxCmd) { << 126 else if( command == EmaxCmd ) { 126 myModel->PBound->SetMaxEneToParametrise(*G 127 myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(), 127 Em << 128 EmaxCmd->GetNewDoubleValue(newValues)); 128 this->GetCurrentValue(command); << 129 this->GetCurrentValue(command); 129 } 130 } 130 << 131 131 else if (command == EkillCmd) { << 132 else if( command == EkillCmd ) { 132 myModel->PBound->SetEneToKill(*G4Electron: 133 myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(), 133 EkillCmd->Ge << 134 EkillCmd->GetNewDoubleValue(newValues)); 134 this->GetCurrentValue(command); << 135 this->GetCurrentValue(command); 135 } 136 } >> 137 136 } 138 } 137 139 138 G4String GFlashShowerModelMessenger::GetCurren << 140 >> 141 G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command) 139 { 142 { 140 G4String returnValue(1, '\0'); << 143 G4String returnValue('\0'); 141 std::ostringstream os; 144 std::ostringstream os; 142 << 145 143 if (command == FlagCmd) { << 146 if( command == FlagCmd ) { 144 os << "/GFlash/flag " << myModel->GetFlagP << 147 os << "/GFlash/flag " << myModel->GetFlagParamType() << '\0'; 145 returnValue = G4String(os.str()); 148 returnValue = G4String(os.str()); 146 } 149 } 147 << 150 148 else if (command == EkillCmd) { << 151 else if( command == EkillCmd ) { 149 os << "/GFlash/Ekill " << myModel->PBound- << 152 os << "/GFlash/Ekill " >> 153 << myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV 150 << " GeV" << '\0'; 154 << " GeV" << '\0'; 151 returnValue = G4String(os.str()); 155 returnValue = G4String(os.str()); 152 } 156 } 153 << 157 154 else if (command == EminCmd) { << 158 else if( command == EminCmd ) { 155 os << "/GFlash/Emin " 159 os << "/GFlash/Emin " 156 << myModel->PBound->GetMinEneToParametr << 160 << myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV 157 << '\0'; << 161 << " GeV" << '\0'; 158 returnValue = G4String(os.str()); << 162 returnValue = G4String(os.str()); 159 } 163 } 160 << 164 161 else if (command == EmaxCmd) { << 165 else if( command == EmaxCmd ) { 162 os << "/GFlash/Emax " 166 os << "/GFlash/Emax " 163 << myModel->PBound->GetMaxEneToParametr << 167 << myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV 164 << '\0'; << 168 << " GeV" << '\0'; 165 returnValue = G4String(os.str()); 169 returnValue = G4String(os.str()); 166 } 170 } 167 << 171 168 return returnValue; 172 return returnValue; 169 } 173 } 170 174