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 // 26 // << 23 // Created by Joanna Weng, 9.11.04 27 // << 28 // ------------------------------------------- << 29 // GEANT 4 class implementation << 30 // << 31 // ------------- GFlashShowerModelMesseng << 32 // << 33 // Author: Joanna Weng - 9.11.2004 << 34 // ------------------------------------------- << 35 24 36 #include "GFlashShowerModelMessenger.hh" 25 #include "GFlashShowerModelMessenger.hh" 37 << 26 #include "GFlashShowerModel.hh" 38 #include "G4Electron.hh" << 27 #include "GFlashParticleBounds.hh" 39 #include "G4Positron.hh" << 28 #include "G4UIdirectory.hh" 40 #include "G4SystemOfUnits.hh" << 41 #include "G4UIcmdWithADouble.hh" << 42 #include "G4UIcmdWithADoubleAndUnit.hh" << 43 #include "G4UIcmdWithAString.hh" 29 #include "G4UIcmdWithAString.hh" >> 30 #include "G4UIcmdWithADoubleAndUnit.hh" >> 31 #include "G4UIcmdWithADouble.hh" 44 #include "G4UIcmdWithAnInteger.hh" 32 #include "G4UIcmdWithAnInteger.hh" 45 #include "G4UIdirectory.hh" << 33 #include "G4Electron.hh" >> 34 #include "G4Positron.hh" 46 #include "globals.hh" 35 #include "globals.hh" 47 36 48 #include "GFlashParticleBounds.hh" << 37 #include <iomanip> 49 #include "GFlashShowerModel.hh" << 38 #include <strstream> 50 39 51 #include <iomanip> << 52 #include <sstream> << 53 40 54 GFlashShowerModelMessenger::GFlashShowerModelM << 41 55 { << 42 GFlashShowerModelMessenger::GFlashShowerModelMessenger(GFlashShowerModel * aModel) 56 myParaDir = new G4UIdirectory("/GFlash/"); << 43 { 57 myParaDir->SetGuidance("Parametrisation cont << 44 myParaDir = new G4UIdirectory("/GFlash/"); 58 myModel = aModel; << 45 myParaDir->SetGuidance("Parametrisation control."); 59 << 46 myModel= aModel; 60 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/ << 47 61 FlagCmd->SetGuidance("Defines if GFlash is a << 48 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this); 62 FlagCmd->SetParameterName("flag", false, fal << 49 FlagCmd->SetGuidance("Defines if GFlash is activated"); 63 << 50 FlagCmd->SetParameterName("flag",false,false); 64 ContCmd = new G4UIcmdWithAnInteger("/GFlash/ << 51 65 ContCmd->SetGuidance("Defines if Containment << 52 ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this); 66 ContCmd->SetParameterName("flag", false, fal << 53 ContCmd->SetGuidance("Defines if Containment is checked"); 67 << 54 ContCmd->SetParameterName("flag",false,false); 68 StepInX0Cmd = new G4UIcmdWithADouble("/GFlas << 55 69 StepInX0Cmd->SetGuidance("Defines step lengh << 56 StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this); 70 StepInX0Cmd->SetParameterName("flag", false, << 57 StepInX0Cmd->SetGuidance("Defines step lenghts"); 71 << 58 StepInX0Cmd->SetParameterName("flag",false,false); 72 EminCmd = new G4UIcmdWithADoubleAndUnit("/GF << 59 73 EminCmd->SetGuidance("Set minimum kinetic en << 60 EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this); 74 EminCmd->SetParameterName("Emin", false, fal << 61 EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation"); 75 EminCmd->SetDefaultUnit("GeV"); << 62 EminCmd->SetParameterName("Emin",false,false); 76 EminCmd->SetUnitCategory("Energy"); << 63 EminCmd->SetDefaultUnit("GeV"); 77 EminCmd->AvailableForStates(G4State_PreInit, << 64 EminCmd->SetUnitCategory("Energy"); 78 << 65 EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 79 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GF << 66 80 EmaxCmd->SetGuidance("Set maximum kinetic en << 67 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this); 81 EmaxCmd->SetParameterName("Emax", false, fal << 68 EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation"); 82 EmaxCmd->SetDefaultUnit("GeV"); << 69 EmaxCmd->SetParameterName("Emax",false,false); 83 EmaxCmd->SetUnitCategory("Energy"); << 70 EmaxCmd->SetDefaultUnit("GeV"); 84 EmaxCmd->AvailableForStates(G4State_PreInit, << 71 EmaxCmd->SetUnitCategory("Energy"); 85 << 72 EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 86 EkillCmd = new G4UIcmdWithADoubleAndUnit("/G << 73 87 EkillCmd->SetGuidance("Set maximum kinetic e << 74 EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this); 88 EkillCmd->SetParameterName("Ekill", false, f << 75 EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed"); 89 EkillCmd->SetDefaultUnit("GeV"); << 76 EkillCmd->SetParameterName("Ekill",false,false); 90 EkillCmd->SetUnitCategory("Energy"); << 77 EkillCmd->SetDefaultUnit("GeV"); 91 EkillCmd->AvailableForStates(G4State_PreInit << 78 EkillCmd->SetUnitCategory("Energy"); >> 79 EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 92 } 80 } 93 81 >> 82 94 GFlashShowerModelMessenger::~GFlashShowerModel 83 GFlashShowerModelMessenger::~GFlashShowerModelMessenger() 95 { 84 { 96 delete ContCmd; << 85 delete ContCmd; 97 delete FlagCmd; << 86 delete FlagCmd; 98 delete StepInX0Cmd; << 87 delete StepInX0Cmd; 99 delete EminCmd; << 88 delete EminCmd; 100 delete EmaxCmd; << 89 delete EmaxCmd; 101 delete EkillCmd; << 90 delete EkillCmd; 102 } 91 } 103 92 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 << 119 else if (command == EminCmd) { << 120 myModel->PBound->SetMinEneToParametrise(*G << 121 Em << 122 this->GetCurrentValue(command); << 123 } << 124 << 125 else if (command == EmaxCmd) { << 126 myModel->PBound->SetMaxEneToParametrise(*G << 127 Em << 128 this->GetCurrentValue(command); << 129 } << 130 << 131 else if (command == EkillCmd) { << 132 myModel->PBound->SetEneToKill(*G4Electron: << 133 EkillCmd->Ge << 134 this->GetCurrentValue(command); << 135 } << 136 } << 137 93 138 G4String GFlashShowerModelMessenger::GetCurren << 94 void GFlashShowerModelMessenger::SetNewValue(G4UIcommand * command,G4String newValues) 139 { << 95 { 140 G4String returnValue(1, '\0'); << 96 141 std::ostringstream os; << 97 if( command == FlagCmd ) { >> 98 myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues)); >> 99 this->GetCurrentValue(command); >> 100 } >> 101 if( command == ContCmd ) { >> 102 myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues)); >> 103 this->GetCurrentValue(command); >> 104 } >> 105 if( command == StepInX0Cmd ) { >> 106 myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues)); >> 107 this->GetCurrentValue(command); >> 108 } >> 109 >> 110 else if( command == EminCmd ) { >> 111 myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition() ,EminCmd->GetNewDoubleValue(newValues)); >> 112 this->GetCurrentValue(command); >> 113 } >> 114 >> 115 else if( command == EmaxCmd ) { >> 116 myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(), EmaxCmd->GetNewDoubleValue(newValues)); >> 117 this->GetCurrentValue(command); >> 118 } >> 119 >> 120 else if( command == EkillCmd ) { >> 121 myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(), EkillCmd->GetNewDoubleValue(newValues)); >> 122 this->GetCurrentValue(command); >> 123 } >> 124 >> 125 } 142 126 143 if (command == FlagCmd) { << 144 os << "/GFlash/flag " << myModel->GetFlagP << 145 returnValue = G4String(os.str()); << 146 } << 147 << 148 else if (command == EkillCmd) { << 149 os << "/GFlash/Ekill " << myModel->PBound- << 150 << " GeV" << '\0'; << 151 returnValue = G4String(os.str()); << 152 } << 153 << 154 else if (command == EminCmd) { << 155 os << "/GFlash/Emin " << 156 << myModel->PBound->GetMinEneToParametr << 157 << '\0'; << 158 returnValue = G4String(os.str()); << 159 } << 160 << 161 else if (command == EmaxCmd) { << 162 os << "/GFlash/Emax " << 163 << myModel->PBound->GetMaxEneToParametr << 164 << '\0'; << 165 returnValue = G4String(os.str()); << 166 } << 167 127 168 return returnValue; << 128 G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command) >> 129 { >> 130 G4String returnValue('\0'); >> 131 char line[255]; >> 132 std::ostrstream os(line,255); >> 133 >> 134 if( command == FlagCmd ) { >> 135 os <<"/GFlash/flag " << myModel->GetFlagParamType() << '\0'; >> 136 returnValue = G4String(line); >> 137 } >> 138 >> 139 else if( command == EkillCmd ) { >> 140 os <<"/GFlash/Ekill "<< myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0'; >> 141 returnValue = G4String(line); >> 142 } >> 143 >> 144 else if( command == EminCmd ) { >> 145 os <<"/GFlash/Emin "<< myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0'; >> 146 returnValue = G4String(line); >> 147 } >> 148 >> 149 else if( command == EmaxCmd ) { >> 150 os <<"/GFlash/Emax " <<myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0'; >> 151 returnValue = G4String(line); >> 152 } >> 153 >> 154 return returnValue; 169 } 155 } >> 156 170 157