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