90 lines
3.7 KiB
C++
90 lines
3.7 KiB
C++
//
|
|
// ********************************************************************
|
|
// * DISCLAIMER *
|
|
// * *
|
|
// * The following disclaimer summarizes all the specific disclaimers *
|
|
// * of contributors to this software. The specific disclaimers,which *
|
|
// * govern, are listed with their locations in: *
|
|
// * http://cern.ch/geant4/license *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. *
|
|
// * *
|
|
// * 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: F02RunMessenger.cc,v 1.4 2002/12/05 01:06:57 asaim Exp $
|
|
// GEANT4 tag $Name: geant4-05-00 $
|
|
//
|
|
//
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
#include "F02RunMessenger.hh"
|
|
|
|
#include "F02RunAction.hh"
|
|
#include "G4UIdirectory.hh"
|
|
#include "G4UIcmdWithAnInteger.hh"
|
|
#include "G4UIcmdWithAString.hh"
|
|
#include "G4ios.hh"
|
|
#include "globals.hh"
|
|
#include "Randomize.hh"
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
F02RunMessenger::F02RunMessenger(F02RunAction* RA)
|
|
:runAction (RA)
|
|
{
|
|
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 = 1 saved on: endOfRun.rndm");
|
|
RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
|
|
RndmSaveCmd->SetParameterName("frequency",false);
|
|
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
|
|
RndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_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(G4State_PreInit,G4State_Idle);
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
F02RunMessenger::~F02RunMessenger()
|
|
{
|
|
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
void F02RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
|
{
|
|
if (command == RndmSaveCmd)
|
|
runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
|
|
|
|
if (command == RndmReadCmd)
|
|
{ G4cout << "\n---> rndm status restored from file: "
|
|
<< newValues << G4endl;
|
|
HepRandom::restoreEngineStatus(newValues);
|
|
HepRandom::showEngineStatus();
|
|
}
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|