Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:51:52

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 /// \file LETMessenger.cc
0027 /// \brief Implementation of the RadioBio::LETMessenger class
0028 
0029 #include "LETMessenger.hh"
0030 
0031 #include "LET.hh"
0032 #include <G4UIcmdWithABool.hh>
0033 #include <G4UIcmdWithAString.hh>
0034 #include <G4UIcmdWithAnInteger.hh>
0035 #include <G4UIcmdWithoutParameter.hh>
0036 #include <G4UIdirectory.hh>
0037 
0038 namespace RadioBio
0039 {
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 LETMessenger::LETMessenger(LET* LET) : G4UImessenger(), fLET(LET)
0044 {
0045   // Directory for LET commands
0046   fLETDir = new G4UIdirectory("/LET/");
0047   fLETDir->SetGuidance("commands to setup LET calculation");
0048 
0049   // Activate LET calculation
0050   fCalculationCmd = new G4UIcmdWithABool("/LET/calculate", this);
0051   fCalculationCmd->SetGuidance("Whether to enable LET calculation");
0052   fCalculationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0053   fCalculationCmd->SetToBeBroadcasted(false);
0054 
0055   // Set LET verbosity
0056   fVerbosityCmd = new G4UIcmdWithAnInteger("/LET/verbose", this);
0057   fVerbosityCmd->SetGuidance("Set verbosity level of LET");
0058   fVerbosityCmd->SetGuidance("0 = quiet");
0059   fVerbosityCmd->SetGuidance("1 = important messages (~10 per run)");
0060   fVerbosityCmd->SetGuidance("2 = debug");
0061   fVerbosityCmd->SetToBeBroadcasted(false);
0062 
0063   // Reset LET data
0064   fResetCmd = new G4UIcmdWithoutParameter("/LET/reset", this);
0065   fResetCmd->SetGuidance("Reset accumulated data");
0066   fResetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067   fResetCmd->SetToBeBroadcasted(false);
0068 
0069   // Set LET filename
0070   fLETPathCmd = new G4UIcmdWithAString("/LET/fileName", this);
0071   fLETPathCmd->SetGuidance("Set the filename for the LET file");
0072   fLETPathCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0073   fLETPathCmd->SetToBeBroadcasted(false);
0074 
0075   // Print Parameters
0076   fPrintCmd = new G4UIcmdWithoutParameter("/LET/print", this);
0077   fPrintCmd->SetGuidance("Print LET parameters");
0078   fPrintCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0079   fPrintCmd->SetToBeBroadcasted(false);
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 LETMessenger::~LETMessenger()
0085 {
0086   delete fLETDir;
0087   delete fCalculationCmd;
0088   delete fVerbosityCmd;
0089   delete fResetCmd;
0090   delete fLETPathCmd;
0091   delete fPrintCmd;
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void LETMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0097 {
0098   if (command == fCalculationCmd) {
0099     fLET->SetCalculationEnabled(fCalculationCmd->GetNewBoolValue(newValue));
0100   }
0101 
0102   if (command == fVerbosityCmd) {
0103     fLET->SetVerboseLevel(fVerbosityCmd->GetNewIntValue(newValue));
0104   }
0105 
0106   if (command == fResetCmd) {
0107     fLET->Reset();
0108   }
0109 
0110   if (command == fLETPathCmd) {
0111     fLET->SetPath(newValue);
0112   }
0113 
0114   if (command == fPrintCmd) {
0115     fLET->PrintParameters();
0116   }
0117 }
0118 
0119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0120 
0121 }  // namespace RadioBio