Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm3/src/PrimaryG << 23 // $Id: PrimaryGeneratorMessenger.cc,v 1.2 2004/10/20 14:32:36 maire Exp $ 27 /// \brief Implementation of the PrimaryGenera << 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "PrimaryGeneratorMessenger.hh" 29 #include "PrimaryGeneratorMessenger.hh" 34 30 35 #include "PrimaryGeneratorAction.hh" 31 #include "PrimaryGeneratorAction.hh" 36 << 37 #include "G4UIcmdWithADouble.hh" << 38 #include "G4UIcmdWithoutParameter.hh" << 39 #include "G4UIdirectory.hh" 32 #include "G4UIdirectory.hh" >> 33 #include "G4UIcmdWithoutParameter.hh" >> 34 #include "G4UIcmdWithADouble.hh" 40 35 41 //....oooOO0OOooo........oooOO0OOooo........oo 36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 37 43 PrimaryGeneratorMessenger::PrimaryGeneratorMes << 38 PrimaryGeneratorMessenger::PrimaryGeneratorMessenger( >> 39 PrimaryGeneratorAction* Gun) >> 40 :Action(Gun) 44 { 41 { 45 fGunDir = new G4UIdirectory("/testem/gun/"); << 42 gunDir = new G4UIdirectory("/testem/gun/"); 46 fGunDir->SetGuidance("gun control"); << 43 gunDir->SetGuidance("gun control"); 47 << 44 48 fDefaultCmd = new G4UIcmdWithoutParameter("/ << 45 DefaultCmd = new G4UIcmdWithoutParameter("/testem/gun/setDefault",this); 49 fDefaultCmd->SetGuidance("set/reset kinemati << 46 DefaultCmd->SetGuidance("set/reset kinematic defined in PrimaryGenerator"); 50 fDefaultCmd->AvailableForStates(G4State_PreI << 47 DefaultCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 51 << 48 52 fRndmCmd = new G4UIcmdWithADouble("/testem/g << 49 RndmCmd = new G4UIcmdWithADouble("/testem/gun/rndm",this); 53 fRndmCmd->SetGuidance("random lateral extens << 50 RndmCmd->SetGuidance("random lateral extension on the beam"); 54 fRndmCmd->SetGuidance("in fraction of 0.5*si << 51 RndmCmd->SetGuidance("in fraction of 0.5*sizeYZ"); 55 fRndmCmd->SetParameterName("rBeam", false); << 52 RndmCmd->SetParameterName("rBeam",false); 56 fRndmCmd->SetRange("rBeam>=0.&&rBeam<=1."); << 53 RndmCmd->SetRange("rBeam>=0.&&rBeam<=1."); 57 fRndmCmd->AvailableForStates(G4State_Idle); << 54 RndmCmd->AvailableForStates(G4State_Idle); 58 } 55 } 59 56 60 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 58 62 PrimaryGeneratorMessenger::~PrimaryGeneratorMe 59 PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger() 63 { 60 { 64 delete fDefaultCmd; << 61 delete DefaultCmd; 65 delete fRndmCmd; << 62 delete RndmCmd; 66 delete fGunDir; << 63 delete gunDir; 67 } 64 } 68 65 69 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 67 71 void PrimaryGeneratorMessenger::SetNewValue(G4 << 68 void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, 72 { << 69 G4String newValue) 73 if (command == fDefaultCmd) { << 70 { 74 fAction->SetDefaultKinematic(); << 71 if( command == DefaultCmd ) 75 } << 72 { Action->SetDefaultKinematic();} 76 << 73 77 if (command == fRndmCmd) { << 74 if( command == RndmCmd ) 78 fAction->SetRndmBeam(fRndmCmd->GetNewDoubl << 75 { Action->SetRndmBeam(RndmCmd->GetNewDoubleValue(newValue));} 79 } << 80 } 76 } 81 77 82 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 79 83 80