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 // 26 // >> 27 // $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.8 2006/06/29 15:57:01 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-01 $ 27 // ------------------------------------------- 29 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file 30 // GEANT 4 class implementation file 29 // CERN Geneva Switzerland 31 // CERN Geneva Switzerland 30 // 32 // 31 // 33 // 32 // ------------ GammaRayTelPrimaryGenerat 34 // ------------ GammaRayTelPrimaryGeneratorMessenger ------ 33 // by G.Santin, F.Longo & R.Giannitr 35 // by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000) 34 // 36 // 35 // ******************************************* 37 // ************************************************************ 36 38 >> 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 41 37 #include "GammaRayTelPrimaryGeneratorMessenger 42 #include "GammaRayTelPrimaryGeneratorMessenger.hh" 38 #include "GammaRayTelPrimaryGeneratorAction.hh << 39 43 40 #include "G4SystemOfUnits.hh" << 44 #include "GammaRayTelPrimaryGeneratorAction.hh" 41 #include "G4UIcmdWithAnInteger.hh" 45 #include "G4UIcmdWithAnInteger.hh" 42 #include "G4UIcmdWithAString.hh" 46 #include "G4UIcmdWithAString.hh" 43 #include "G4UIcmdWithADoubleAndUnit.hh" 47 #include "G4UIcmdWithADoubleAndUnit.hh" 44 #include "G4UIcmdWithABool.hh" 48 #include "G4UIcmdWithABool.hh" 45 49 46 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 51 48 GammaRayTelPrimaryGeneratorMessenger::GammaRay << 52 GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger 49 rndmCmd = new G4UIcmdWithAString("/gun/rando << 53 (GammaRayTelPrimaryGeneratorAction* GammaRayTelGun) 50 rndmCmd->SetGuidance("Shoot randomly the inc << 54 :GammaRayTelAction(GammaRayTelGun) 51 rndmCmd->SetGuidance("Choice : on(default), << 55 { 52 rndmCmd->SetParameterName("choice", true); << 56 RndmCmd = new G4UIcmdWithAString("/gun/random",this); 53 rndmCmd->SetDefaultValue("on"); << 57 RndmCmd->SetGuidance("Shoot randomly the incident particle."); 54 rndmCmd->SetCandidates("on off"); << 58 RndmCmd->SetGuidance(" Choice : on(default), off"); 55 rndmCmd->AvailableForStates(G4State_PreInit, << 59 RndmCmd->SetParameterName("choice",true); 56 << 60 RndmCmd->SetDefaultValue("on"); 57 sourceTypeCmd = new G4UIcmdWithAnInteger("/g << 61 RndmCmd->SetCandidates("on off"); 58 sourceTypeCmd->SetGuidance("Select the type << 62 RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 59 sourceTypeCmd->SetGuidance("Choice : 0(defau << 63 60 sourceTypeCmd->SetParameterName("choice", tr << 64 SourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType",this); 61 sourceTypeCmd->SetDefaultValue((G4int) 0); << 65 SourceTypeCmd->SetGuidance("Select the type of incident flux."); 62 sourceTypeCmd->AvailableForStates(G4State_Pr << 66 SourceTypeCmd->SetGuidance(" Choice : 0(default), 1(isotropic), 2(wide parallel beam)"); 63 << 67 SourceTypeCmd->SetParameterName("choice",true); 64 vertexRadiusCmd = new G4UIcmdWithADoubleAndU << 68 SourceTypeCmd->SetDefaultValue((G4int)0); 65 vertexRadiusCmd->SetGuidance("Radius (and un << 69 SourceTypeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 66 vertexRadiusCmd->SetParameterName("choice", << 70 67 vertexRadiusCmd->SetDefaultValue((G4double) << 71 VertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius",this); 68 vertexRadiusCmd->AvailableForStates(G4State_ << 72 VertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux."); 69 << 73 VertexRadiusCmd->SetParameterName("choice",true); 70 spectrumTypeCmd = new G4UIcmdWithAnInteger(" << 74 VertexRadiusCmd->SetDefaultValue((G4double)1.*cm); 71 spectrumTypeCmd->SetGuidance("Select the typ << 75 VertexRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 72 spectrumTypeCmd->SetGuidance("Choice : 0(def << 76 73 spectrumTypeCmd->SetParameterName("choice", << 77 SpectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType",this); 74 spectrumTypeCmd->SetDefaultValue((G4int) 0); << 78 SpectrumTypeCmd->SetGuidance("Select the type of incident spectrum."); 75 spectrumTypeCmd->AvailableForStates(G4State_ << 79 SpectrumTypeCmd->SetGuidance(" Choice : 0(default), 1(), 2(E^{-gamma}), 3()"); 76 << 80 SpectrumTypeCmd->SetParameterName("choice",true); 77 sourceGenCmd = new G4UIcmdWithABool("/gun/so << 81 SpectrumTypeCmd->SetDefaultValue((G4int)0); 78 sourceGenCmd->SetGuidance("Select the native << 82 SpectrumTypeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 79 sourceGenCmd->SetGuidance(" Choice : true(n << 83 80 sourceGenCmd->SetParameterName("choice", tru << 84 81 sourceGenCmd->SetDefaultValue((G4bool) true) << 85 SourceGenCmd = new G4UIcmdWithABool("/gun/sourceGen",this); 82 sourceGenCmd->AvailableForStates(G4State_Pre << 86 SourceGenCmd->SetGuidance("Select the native Generation"); >> 87 SourceGenCmd->SetGuidance(" Choice : true(native), false(GPS)"); >> 88 SourceGenCmd->SetParameterName("choice",true); >> 89 SourceGenCmd->SetDefaultValue((G4bool)true); >> 90 SourceGenCmd->AvailableForStates(G4State_PreInit); >> 91 83 } 92 } 84 93 85 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 86 95 87 GammaRayTelPrimaryGeneratorMessenger::~GammaRa << 96 GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger() 88 delete rndmCmd; << 97 { 89 delete sourceTypeCmd; << 98 delete RndmCmd; 90 delete vertexRadiusCmd; << 99 delete SourceTypeCmd; 91 delete spectrumTypeCmd; << 100 delete VertexRadiusCmd; 92 delete sourceGenCmd; << 101 delete SpectrumTypeCmd; >> 102 delete SourceGenCmd; 93 } 103 } 94 104 95 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 96 106 97 void GammaRayTelPrimaryGeneratorMessenger::Set << 107 void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue) 98 if (command == rndmCmd) { << 108 { 99 GammaRayTelAction->SetRndmFlag(newValue); << 109 if( command == RndmCmd ) 100 } else if (command == sourceTypeCmd) { << 110 { GammaRayTelAction->SetRndmFlag(newValue);} 101 GammaRayTelAction->SetSourceType(sourceTyp << 111 102 } else if (command == vertexRadiusCmd) { << 112 if( command == SourceTypeCmd ) 103 GammaRayTelAction->SetVertexRadius(vertexR << 113 { GammaRayTelAction->SetSourceType(SourceTypeCmd->GetNewIntValue(newValue));} 104 } else if (command == spectrumTypeCmd) { << 114 105 GammaRayTelAction->SetSpectrumType(spectru << 115 if( command == VertexRadiusCmd ) 106 } else if (command == sourceGenCmd) { << 116 { GammaRayTelAction->SetVertexRadius(VertexRadiusCmd->GetNewDoubleValue(newValue));} 107 GammaRayTelAction->SetSourceGen(sourceGenC << 117 108 } << 118 if( command == SpectrumTypeCmd ) >> 119 { GammaRayTelAction->SetSpectrumType(SpectrumTypeCmd->GetNewIntValue(newValue));} >> 120 >> 121 if( command == SourceGenCmd ) >> 122 { GammaRayTelAction->SetSourceGen(SourceGenCmd->GetNewBoolValue(newValue));} 109 } 123 } >> 124 >> 125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 126 >> 127 >> 128 >> 129 >> 130 >> 131 >> 132 >> 133 >> 134 >> 135 >> 136 >> 137 110 138