Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:19

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file radiobiology/src/DoseMessenger.cc
0028 /// \brief Implementation of the RadioBio::DoseMessenger class
0029 
0030 #include "DoseMessenger.hh"
0031 
0032 #include "Dose.hh"
0033 #include <G4UIcmdWithABool.hh>
0034 #include <G4UIcmdWithADouble.hh>
0035 #include <G4UIcmdWithAString.hh>
0036 #include <G4UIcmdWithAnInteger.hh>
0037 #include <G4UIcmdWithoutParameter.hh>
0038 #include <G4UIdirectory.hh>
0039 
0040 namespace RadioBio
0041 {
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 DoseMessenger::DoseMessenger(Dose* dose) : G4UImessenger(), fDose(dose)
0046 {
0047   // Diretory for dose commands
0048   fDoseDir = new G4UIdirectory("/dose/");
0049   fDoseDir->SetGuidance("commands to setup dose calculation");
0050 
0051   // Activate dose calculation
0052   fCalculationCmd = new G4UIcmdWithABool("/dose/calculate", this);
0053   fCalculationCmd->SetGuidance("Whether to enable dose calculation");
0054   fCalculationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0055   fCalculationCmd->SetToBeBroadcasted(false);
0056 
0057   // Set dose verbosity
0058   fVerbosityCmd = new G4UIcmdWithAnInteger("/dose/verbose", this);
0059   fVerbosityCmd->SetGuidance("Set verbosity level of dose");
0060   fVerbosityCmd->SetGuidance("0 = quiet");
0061   fVerbosityCmd->SetGuidance("1 = important messages (~10 per run)");
0062   fVerbosityCmd->SetGuidance("2 = debug");
0063   fVerbosityCmd->SetToBeBroadcasted(false);
0064 
0065   // Reset dose data
0066   fResetCmd = new G4UIcmdWithoutParameter("/dose/reset", this);
0067   fResetCmd->SetGuidance("Reset accumulated data");
0068   fResetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069   fResetCmd->SetToBeBroadcasted(false);
0070 
0071   // Set dose filename
0072   fDosePathCmd = new G4UIcmdWithAString("/dose/fileName", this);
0073   fDosePathCmd->SetGuidance("Set the filename for the dose file");
0074   fDosePathCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075   fDosePathCmd->SetToBeBroadcasted(false);
0076 
0077   // Print Parameters
0078   fPrintCmd = new G4UIcmdWithoutParameter("/dose/print", this);
0079   fPrintCmd->SetGuidance("Print dose parameters");
0080   fPrintCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081   fPrintCmd->SetToBeBroadcasted(false);
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 DoseMessenger::~DoseMessenger()
0087 {
0088   delete fDoseDir;
0089   delete fCalculationCmd;
0090   delete fVerbosityCmd;
0091   delete fResetCmd;
0092   delete fDosePathCmd;
0093   delete fPrintCmd;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 void DoseMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0099 {
0100   if (command == fCalculationCmd) {
0101     fDose->SetCalculationEnabled(fCalculationCmd->GetNewBoolValue(newValue));
0102   }
0103 
0104   if (command == fVerbosityCmd) {
0105     fDose->SetVerboseLevel(fVerbosityCmd->GetNewIntValue(newValue));
0106   }
0107 
0108   if (command == fResetCmd) {
0109     fDose->Reset();
0110   }
0111 
0112   if (command == fDosePathCmd) {
0113     fDose->SetPath(newValue);
0114   }
0115 
0116   if (command == fPrintCmd) {
0117     fDose->PrintParameters();
0118   }
0119 }
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 }  // namespace RadioBio