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 field/field02/src/F02PrimaryGenerato << 27 /// \brief Implementation of the F02PrimaryGen << 28 // 23 // >> 24 // $Id: F02PrimaryGeneratorMessenger.cc,v 1.4 2002/12/05 01:06:57 asaim Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 29 // 26 // 30 // << 27 // 31 // << 28 32 //....oooOO0OOooo........oooOO0OOooo........oo << 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 33 //....oooOO0OOooo........oooOO0OOooo........oo << 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 34 31 35 #include "F02PrimaryGeneratorMessenger.hh" 32 #include "F02PrimaryGeneratorMessenger.hh" 36 33 37 #include "F02PrimaryGeneratorAction.hh" 34 #include "F02PrimaryGeneratorAction.hh" 38 << 39 #include "G4SystemOfUnits.hh" << 40 #include "G4UIcmdWithADoubleAndUnit.hh" << 41 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithAString.hh" >> 36 #include "G4UIcmdWithADoubleAndUnit.hh" 42 37 43 //....oooOO0OOooo........oooOO0OOooo........oo << 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 44 39 45 F02PrimaryGeneratorMessenger::F02PrimaryGenera << 40 F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger(F02PrimaryGeneratorAction* F02Gun) 46 : fAction(action) << 41 : F02Action(F02Gun) 47 { << 42 { 48 fRndmCmd = new G4UIcmdWithAString("/gun/rand << 43 RndmCmd = new G4UIcmdWithAString("/gun/random",this); 49 fRndmCmd->SetGuidance("Shoot randomly the in << 44 RndmCmd->SetGuidance("Shoot randomly the incident particle."); 50 fRndmCmd->SetGuidance(" Choice : on, off(de << 45 RndmCmd->SetGuidance(" Choice : on, off(default)"); 51 fRndmCmd->SetParameterName("choice", true); << 46 RndmCmd->SetParameterName("choice",true); 52 fRndmCmd->SetDefaultValue("off"); << 47 RndmCmd->SetDefaultValue("off"); 53 fRndmCmd->SetCandidates("on off"); << 48 RndmCmd->SetCandidates("on off"); 54 fRndmCmd->AvailableForStates(G4State_PreInit << 49 RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 55 << 50 56 fSetXVertexCmd = new G4UIcmdWithADoubleAndUn << 51 setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this); 57 fSetXVertexCmd->SetGuidance(" Set x coord. o << 52 setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex."); 58 fSetXVertexCmd->SetParameterName("xv", true) << 53 setxvertexCmd->SetParameterName("xv",true); 59 fSetXVertexCmd->SetDefaultValue(0.0 * mm); << 54 setxvertexCmd->SetDefaultValue(0.0*mm) ; 60 fSetXVertexCmd->SetDefaultUnit("mm"); << 55 61 << 56 setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this); 62 fSetYVertexCmd = new G4UIcmdWithADoubleAndUn << 57 setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex."); 63 fSetYVertexCmd->SetGuidance(" Set y coord. o << 58 setyvertexCmd->SetParameterName("yv",true); 64 fSetYVertexCmd->SetParameterName("yv", true) << 59 setyvertexCmd->SetDefaultValue(0.0*mm) ; 65 fSetYVertexCmd->SetDefaultValue(0.0 * mm); << 60 66 fSetYVertexCmd->SetDefaultUnit("mm"); << 61 setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this); 67 << 62 setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex."); 68 fSetZVertexCmd = new G4UIcmdWithADoubleAndUn << 63 setzvertexCmd->SetParameterName("zv",true); 69 fSetZVertexCmd->SetGuidance(" Set z coord. o << 64 setzvertexCmd->SetDefaultValue(0.0*mm) ; 70 fSetZVertexCmd->SetParameterName("zv", true) << 65 71 fSetZVertexCmd->SetDefaultValue(0.0 * mm); << 72 fSetZVertexCmd->SetDefaultUnit("mm"); << 73 } 66 } 74 67 75 //....oooOO0OOooo........oooOO0OOooo........oo << 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 76 69 77 F02PrimaryGeneratorMessenger::~F02PrimaryGener 70 F02PrimaryGeneratorMessenger::~F02PrimaryGeneratorMessenger() 78 { 71 { 79 delete fRndmCmd; << 72 delete RndmCmd; 80 delete fSetXVertexCmd; << 73 delete setxvertexCmd; 81 delete fSetYVertexCmd; << 74 delete setyvertexCmd; 82 delete fSetZVertexCmd; << 75 delete setzvertexCmd; 83 } 76 } 84 77 85 //....oooOO0OOooo........oooOO0OOooo........oo << 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 86 79 87 void F02PrimaryGeneratorMessenger::SetNewValue << 80 void F02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue) 88 { << 81 { 89 if (command == fRndmCmd) { << 82 if( command == RndmCmd ) 90 fAction->SetRndmFlag(newValue); << 83 { F02Action->SetRndmFlag(newValue);} 91 } << 84 if( command == setxvertexCmd) 92 if (command == fSetXVertexCmd) { << 85 { F02Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));} 93 fAction->SetXVertex(fSetXVertexCmd->GetNew << 86 if( command == setyvertexCmd) 94 } << 87 { F02Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));} 95 if (command == fSetYVertexCmd) { << 88 if( command == setzvertexCmd) 96 fAction->SetYVertex(fSetYVertexCmd->GetNew << 89 { F02Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));} 97 } << 98 if (command == fSetZVertexCmd) { << 99 fAction->SetZVertex(fSetZVertexCmd->GetNew << 100 } << 101 } 90 } 102 91 103 //....oooOO0OOooo........oooOO0OOooo........oo << 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 93 104 94