Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file field/field02/src/F02PrimaryGenerato << 27 /// \brief Implementation of the F02PrimaryGen << 28 // 26 // >> 27 // $Id: F02PrimaryGeneratorMessenger.cc,v 1.5 2006/06/29 17:18:17 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-02 $ 29 // 29 // 30 // << 30 // 31 // << 31 32 //....oooOO0OOooo........oooOO0OOooo........oo << 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 33 //....oooOO0OOooo........oooOO0OOooo........oo << 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 34 34 35 #include "F02PrimaryGeneratorMessenger.hh" 35 #include "F02PrimaryGeneratorMessenger.hh" 36 36 37 #include "F02PrimaryGeneratorAction.hh" 37 #include "F02PrimaryGeneratorAction.hh" 38 << 39 #include "G4SystemOfUnits.hh" << 40 #include "G4UIcmdWithADoubleAndUnit.hh" << 41 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAString.hh" >> 39 #include "G4UIcmdWithADoubleAndUnit.hh" 42 40 43 //....oooOO0OOooo........oooOO0OOooo........oo << 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 44 42 45 F02PrimaryGeneratorMessenger::F02PrimaryGenera << 43 F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger(F02PrimaryGeneratorAction* F02Gun) 46 : fAction(action) << 44 : F02Action(F02Gun) 47 { << 45 { 48 fRndmCmd = new G4UIcmdWithAString("/gun/rand << 46 RndmCmd = new G4UIcmdWithAString("/gun/random",this); 49 fRndmCmd->SetGuidance("Shoot randomly the in << 47 RndmCmd->SetGuidance("Shoot randomly the incident particle."); 50 fRndmCmd->SetGuidance(" Choice : on, off(de << 48 RndmCmd->SetGuidance(" Choice : on, off(default)"); 51 fRndmCmd->SetParameterName("choice", true); << 49 RndmCmd->SetParameterName("choice",true); 52 fRndmCmd->SetDefaultValue("off"); << 50 RndmCmd->SetDefaultValue("off"); 53 fRndmCmd->SetCandidates("on off"); << 51 RndmCmd->SetCandidates("on off"); 54 fRndmCmd->AvailableForStates(G4State_PreInit << 52 RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 55 << 53 56 fSetXVertexCmd = new G4UIcmdWithADoubleAndUn << 54 setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this); 57 fSetXVertexCmd->SetGuidance(" Set x coord. o << 55 setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex."); 58 fSetXVertexCmd->SetParameterName("xv", true) << 56 setxvertexCmd->SetParameterName("xv",true); 59 fSetXVertexCmd->SetDefaultValue(0.0 * mm); << 57 setxvertexCmd->SetDefaultValue(0.0*mm) ; 60 fSetXVertexCmd->SetDefaultUnit("mm"); << 58 61 << 59 setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this); 62 fSetYVertexCmd = new G4UIcmdWithADoubleAndUn << 60 setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex."); 63 fSetYVertexCmd->SetGuidance(" Set y coord. o << 61 setyvertexCmd->SetParameterName("yv",true); 64 fSetYVertexCmd->SetParameterName("yv", true) << 62 setyvertexCmd->SetDefaultValue(0.0*mm) ; 65 fSetYVertexCmd->SetDefaultValue(0.0 * mm); << 63 66 fSetYVertexCmd->SetDefaultUnit("mm"); << 64 setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this); 67 << 65 setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex."); 68 fSetZVertexCmd = new G4UIcmdWithADoubleAndUn << 66 setzvertexCmd->SetParameterName("zv",true); 69 fSetZVertexCmd->SetGuidance(" Set z coord. o << 67 setzvertexCmd->SetDefaultValue(0.0*mm) ; 70 fSetZVertexCmd->SetParameterName("zv", true) << 68 71 fSetZVertexCmd->SetDefaultValue(0.0 * mm); << 72 fSetZVertexCmd->SetDefaultUnit("mm"); << 73 } 69 } 74 70 75 //....oooOO0OOooo........oooOO0OOooo........oo << 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 76 72 77 F02PrimaryGeneratorMessenger::~F02PrimaryGener 73 F02PrimaryGeneratorMessenger::~F02PrimaryGeneratorMessenger() 78 { 74 { 79 delete fRndmCmd; << 75 delete RndmCmd; 80 delete fSetXVertexCmd; << 76 delete setxvertexCmd; 81 delete fSetYVertexCmd; << 77 delete setyvertexCmd; 82 delete fSetZVertexCmd; << 78 delete setzvertexCmd; 83 } 79 } 84 80 85 //....oooOO0OOooo........oooOO0OOooo........oo << 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 86 82 87 void F02PrimaryGeneratorMessenger::SetNewValue << 83 void F02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue) 88 { << 84 { 89 if (command == fRndmCmd) { << 85 if( command == RndmCmd ) 90 fAction->SetRndmFlag(newValue); << 86 { F02Action->SetRndmFlag(newValue);} 91 } << 87 if( command == setxvertexCmd) 92 if (command == fSetXVertexCmd) { << 88 { F02Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));} 93 fAction->SetXVertex(fSetXVertexCmd->GetNew << 89 if( command == setyvertexCmd) 94 } << 90 { F02Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));} 95 if (command == fSetYVertexCmd) { << 91 if( command == setzvertexCmd) 96 fAction->SetYVertex(fSetYVertexCmd->GetNew << 92 { F02Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));} 97 } << 98 if (command == fSetZVertexCmd) { << 99 fAction->SetZVertex(fSetZVertexCmd->GetNew << 100 } << 101 } 93 } 102 94 103 //....oooOO0OOooo........oooOO0OOooo........oo << 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 96 104 97