Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:51:37

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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0028 
0029 #include "ActionInitializationMessenger.hh"
0030 #include "ActionInitialization.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWithADoubleAndUnit.hh"
0033 #include "G4UIcmdWithAString.hh"
0034 
0035 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0036 
0037 ActionInitializationMessenger::
0038 ActionInitializationMessenger(ActionInitialization* act)
0039   :fAction(act)
0040 {
0041   fActionDir = new G4UIdirectory("/action/");
0042   fActionDir->SetGuidance("Commands for action initialization status");
0043 
0044   fIAEAphspReaderDir = new G4UIdirectory("/action/IAEAphspReader/");
0045   fIAEAphspReaderDir->SetGuidance("Commands to set IAEAphsp reader object.");
0046 
0047   fIAEAphspWriterDir = new G4UIdirectory("/action/IAEAphspWriter/");
0048   fIAEAphspWriterDir->SetGuidance("Commands to set IAEAphsp writer object.");
0049 
0050   fIAEAphspReaderFileCmd =
0051     new G4UIcmdWithAString("/action/IAEAphspReader/fileName",this);
0052   fIAEAphspReaderFileCmd
0053     ->SetGuidance("Set IAEAphsp source file name, including path if needed.");
0054   fIAEAphspReaderFileCmd
0055     ->SetGuidance("(.IAEAphsp or .IAEAheader extension must not be written)");  
0056   fIAEAphspReaderFileCmd->SetParameterName("name",false);
0057   fIAEAphspReaderFileCmd->AvailableForStates(G4State_PreInit);
0058 
0059   fIAEAphspWriterFileCmd =
0060     new G4UIcmdWithAString("/action/IAEAphspWriter/namePrefix",this);
0061   fIAEAphspWriterFileCmd
0062     ->SetGuidance("Set the name prefix of IAEAphsp output files, ");
0063   fIAEAphspWriterFileCmd
0064     ->SetGuidance("including path if needed.");
0065   fIAEAphspWriterFileCmd
0066     ->SetGuidance("Name pattern: \"prefix_zphsp[_runID].IAEA[phsp|header]\".");
0067   fIAEAphspWriterFileCmd->SetGuidance("NOTE:");
0068   fIAEAphspWriterFileCmd
0069     ->SetGuidance("At least ONE zphsp value must be issued.");
0070   fIAEAphspWriterFileCmd->SetParameterName("prefix",false);
0071   fIAEAphspWriterFileCmd->AvailableForStates(G4State_PreInit);
0072 
0073   fIAEAphspWriterZphspCmd =
0074     new G4UIcmdWithADoubleAndUnit("/action/IAEAphspWriter/zphsp", this);
0075   fIAEAphspWriterZphspCmd
0076     ->SetGuidance("Add z-coordinate of output phsp plane.");
0077   fIAEAphspWriterZphspCmd
0078     ->SetGuidance("At least one value is NEEDED to get this writer working.");
0079   fIAEAphspWriterZphspCmd->SetParameterName("zphsp",false);
0080   fIAEAphspWriterZphspCmd->SetDefaultUnit("cm");
0081   fIAEAphspWriterZphspCmd->SetUnitCandidates("cm mm m");
0082   fIAEAphspWriterZphspCmd->AvailableForStates(G4State_PreInit);
0083 }
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0086 
0087 ActionInitializationMessenger::~ActionInitializationMessenger()
0088 {
0089   delete fActionDir;
0090   delete fIAEAphspReaderDir;
0091   delete fIAEAphspWriterDir;
0092   delete fIAEAphspReaderFileCmd;
0093   delete fIAEAphspWriterFileCmd;
0094   delete fIAEAphspWriterZphspCmd;
0095 }
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 void ActionInitializationMessenger::SetNewValue(G4UIcommand* command,
0100                         G4String newValue)
0101 {
0102   if ( command == fIAEAphspReaderFileCmd )
0103     fAction->SetIAEAphspReader(newValue);
0104 
0105   else if ( command == fIAEAphspWriterFileCmd )
0106     fAction->SetIAEAphspWriterPrefix(newValue);
0107 
0108   else if ( command == fIAEAphspWriterZphspCmd )
0109     fAction->AddZphsp(fIAEAphspWriterZphspCmd->GetNewDoubleValue(newValue));
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......