Files
geant4/examples/extended/electromagnetic/TestEm3/src/Em3PrimaryGeneratorMessenger.cc
T
2016-06-08 16:39:52 +02:00

78 lines
3.2 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: Em3PrimaryGeneratorMessenger.cc,v 1.5 2001/10/22 10:58:57 maire Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "Em3PrimaryGeneratorMessenger.hh"
#include "Em3PrimaryGeneratorAction.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Em3PrimaryGeneratorMessenger::Em3PrimaryGeneratorMessenger(
Em3PrimaryGeneratorAction* Em3Gun)
:Em3Action(Em3Gun)
{
DefaultCmd = new G4UIcmdWithoutParameter("/gun/setDefault",this);
DefaultCmd->SetGuidance("set/reset kinematic defined in PrimaryGenerator");
DefaultCmd->AvailableForStates(PreInit,Idle);
RndmCmd = new G4UIcmdWithADouble("/gun/rndm",this);
RndmCmd->SetGuidance("random lateral extension on the beam");
RndmCmd->SetGuidance("in fraction of 0.5*sizeYZ");
RndmCmd->SetParameterName("rBeam",false);
RndmCmd->SetRange("rBeam>=0.&&rBeam<=1.");
RndmCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Em3PrimaryGeneratorMessenger::~Em3PrimaryGeneratorMessenger()
{
delete DefaultCmd;
delete RndmCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Em3PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == DefaultCmd )
{ Em3Action->SetDefaultKinematic();}
if( command == RndmCmd )
{ Em3Action->SetRndmBeam(RndmCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......