73 lines
2.5 KiB
C++
73 lines
2.5 KiB
C++
// This code implementation is the intellectual property of
|
|
// the GEANT4 collaboration.
|
|
//
|
|
// By copying, distributing or modifying the Program (or any work
|
|
// based on the Program) you indicate your acceptance of this statement,
|
|
// and all its terms.
|
|
//
|
|
// $Id: Em2RunActionMessenger.cc,v 1.4 2001/02/20 15:58:36 maire Exp $
|
|
// GEANT4 tag $Name: geant4-03-01 $
|
|
//
|
|
//
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
#include "Em2RunActionMessenger.hh"
|
|
|
|
#include "Em2RunAction.hh"
|
|
#include "G4UIdirectory.hh"
|
|
#include "G4UIcmdWithAString.hh"
|
|
#include "G4UIcmdWithAnInteger.hh"
|
|
#include "G4ios.hh"
|
|
#include "globals.hh"
|
|
#include "Randomize.hh"
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
Em2RunActionMessenger::Em2RunActionMessenger(Em2RunAction* run)
|
|
:Em2Run(run)
|
|
{
|
|
RndmDir = new G4UIdirectory("/rndm/");
|
|
RndmDir->SetGuidance("Rndm status control.");
|
|
|
|
RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
|
|
RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
|
|
RndmSaveCmd->SetGuidance("freq = 0 not saved");
|
|
RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
|
|
RndmSaveCmd->SetGuidance("freq > 0 saved on: endOfRun.rndm");
|
|
RndmSaveCmd->SetGuidance("freq = 2 saved on: beginOfEvent.rndm");
|
|
RndmSaveCmd->SetParameterName("frequency",false);
|
|
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
|
|
RndmSaveCmd->AvailableForStates(PreInit,Idle);
|
|
|
|
RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
|
|
RndmReadCmd->SetGuidance("get rndm status from an external file.");
|
|
RndmReadCmd->SetParameterName("fileName",true);
|
|
RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
|
|
RndmReadCmd->AvailableForStates(PreInit,Idle);
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
Em2RunActionMessenger::~Em2RunActionMessenger()
|
|
{
|
|
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
void Em2RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
|
{
|
|
if (command == RndmSaveCmd)
|
|
Em2Run->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue));
|
|
|
|
if (command == RndmReadCmd)
|
|
{ G4cout << "\n---> rndm status restored from file: " << newValue << G4endl;
|
|
HepRandom::restoreEngineStatus(newValue);
|
|
HepRandom::showEngineStatus();
|
|
}
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|