GFlashShowerModelMessenger.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: GFlashShowerModelMessenger.cc 69796 2013-05-15 13:26:12Z gcosmo $
00027 //
00028 //
00029 // ------------------------------------------------------------
00030 // GEANT 4 class implementation
00031 //
00032 //      ------------- GFlashShowerModelMessenger -------------
00033 //
00034 // Author: Joanna Weng - 9.11.2004
00035 // ------------------------------------------------------------
00036 
00037 #include <iomanip>                
00038 #include <sstream>
00039 
00040 #include "GFlashShowerModelMessenger.hh"
00041 #include "GFlashShowerModel.hh"
00042 #include "GFlashParticleBounds.hh"
00043 #include "globals.hh"
00044 #include "G4SystemOfUnits.hh"
00045 #include "G4UIdirectory.hh"
00046 #include "G4UIcmdWithAString.hh"
00047 #include "G4UIcmdWithADoubleAndUnit.hh" 
00048 #include "G4UIcmdWithADouble.hh"
00049 #include "G4UIcmdWithAnInteger.hh"
00050 #include "G4Electron.hh"
00051 #include "G4Positron.hh"
00052 
00053 GFlashShowerModelMessenger::
00054 GFlashShowerModelMessenger(GFlashShowerModel * aModel)
00055 { 
00056   myParaDir = new G4UIdirectory("/GFlash/");
00057   myParaDir->SetGuidance("Parametrisation control.");
00058   myModel= aModel;
00059   
00060   FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this);
00061   FlagCmd->SetGuidance("Defines if GFlash is activated");
00062   FlagCmd->SetParameterName("flag",false,false);
00063   
00064   ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this);
00065   ContCmd->SetGuidance("Defines if Containment is checked");
00066   ContCmd->SetParameterName("flag",false,false);
00067   
00068   StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this);
00069   StepInX0Cmd->SetGuidance("Defines step lenghts");
00070   StepInX0Cmd->SetParameterName("flag",false,false);
00071   
00072   EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this);
00073   EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation");
00074   EminCmd->SetParameterName("Emin",false,false);
00075   EminCmd->SetDefaultUnit("GeV");
00076   EminCmd->SetUnitCategory("Energy");
00077   EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00078   
00079   EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this);
00080   EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation");
00081   EmaxCmd->SetParameterName("Emax",false,false);
00082   EmaxCmd->SetDefaultUnit("GeV");
00083   EmaxCmd->SetUnitCategory("Energy");
00084   EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00085   
00086   EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this);
00087   EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed");
00088   EkillCmd->SetParameterName("Ekill",false,false);
00089   EkillCmd->SetDefaultUnit("GeV");
00090   EkillCmd->SetUnitCategory("Energy");
00091   EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00092 }
00093 
00094 
00095 GFlashShowerModelMessenger::~GFlashShowerModelMessenger()
00096 {
00097   delete ContCmd;
00098   delete FlagCmd;
00099   delete StepInX0Cmd;  
00100   delete EminCmd;
00101   delete EmaxCmd;
00102   delete EkillCmd;
00103 }
00104 
00105 
00106 void GFlashShowerModelMessenger::
00107 SetNewValue(G4UIcommand * command,G4String newValues)
00108 { 
00109   
00110   if( command == FlagCmd ) { 
00111     myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues));      
00112     this->GetCurrentValue(command);    
00113   }
00114   if( command == ContCmd ) { 
00115     myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues));      
00116     this->GetCurrentValue(command);    
00117   }
00118   if( command == StepInX0Cmd ) { 
00119     myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues));      
00120     this->GetCurrentValue(command);    
00121   }
00122   
00123   else if( command == EminCmd ) {
00124     myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition(),
00125                                        EminCmd->GetNewDoubleValue(newValues));
00126     this->GetCurrentValue(command);  
00127   }
00128   
00129   else if( command == EmaxCmd ) {
00130     myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(),
00131                                        EmaxCmd->GetNewDoubleValue(newValues));
00132     this->GetCurrentValue(command);      
00133   }
00134   
00135   else if( command == EkillCmd ) {
00136     myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(),
00137                                        EkillCmd->GetNewDoubleValue(newValues));
00138     this->GetCurrentValue(command);  
00139   }
00140   
00141 }
00142 
00143 
00144 G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command)
00145 {
00146   G4String returnValue('\0');
00147   std::ostringstream os;
00148   
00149   if( command == FlagCmd ) { 
00150     os << "/GFlash/flag " << myModel->GetFlagParamType()  << '\0';
00151     returnValue = G4String(os.str());
00152   }
00153   
00154   else if( command == EkillCmd ) {    
00155     os << "/GFlash/Ekill "
00156        << myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV
00157        << " GeV" << '\0';
00158     returnValue = G4String(os.str());
00159   }
00160   
00161   else if( command == EminCmd ) {    
00162     os << "/GFlash/Emin "
00163        << myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV
00164        << " GeV" << '\0';
00165     returnValue = G4String(os.str());  
00166   }
00167   
00168   else if( command == EmaxCmd ) {
00169     os << "/GFlash/Emax "
00170        << myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV
00171        << " GeV" << '\0';
00172     returnValue = G4String(os.str());
00173   }
00174   
00175   return returnValue;
00176 }

Generated on Mon May 27 17:50:29 2013 for Geant4 by  doxygen 1.4.7