[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 27 | // File: CCalPrimaryGeneratorMessenger.cc |
---|
| 28 | // Description: CCalPrimaryGeneratorMessenger adds new commands for |
---|
| 29 | // primary generator action |
---|
| 30 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 31 | #include "CCalPrimaryGeneratorMessenger.hh" |
---|
| 32 | #include "CCalPrimaryGeneratorAction.hh" |
---|
| 33 | |
---|
| 34 | #include "G4UImanager.hh" |
---|
| 35 | #include "G4UIcmdWithAString.hh" |
---|
| 36 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 37 | #include "G4UIcmdWithADouble.hh" |
---|
| 38 | #include "G4UIcmdWithABool.hh" |
---|
| 39 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 40 | #include "globals.hh" |
---|
| 41 | |
---|
| 42 | CCalPrimaryGeneratorMessenger::CCalPrimaryGeneratorMessenger(CCalPrimaryGeneratorAction* myGun) : myAction(myGun) { |
---|
| 43 | |
---|
| 44 | verboseCmd = new G4UIcmdWithAnInteger("/CCal/generator/verbose",this); |
---|
| 45 | verboseCmd->SetGuidance("set Verbosity level "); |
---|
| 46 | verboseCmd->SetParameterName("value",true); |
---|
| 47 | verboseCmd->SetDefaultValue(0); |
---|
| 48 | verboseCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 49 | |
---|
| 50 | rndmCmd = new G4UIcmdWithAString("/CCal/generator/random",this); |
---|
| 51 | rndmCmd->SetGuidance("Choose randomly energy and direction of the incident particle."); |
---|
| 52 | rndmCmd->SetGuidance(" Choice : on,off(default)"); |
---|
| 53 | rndmCmd->SetParameterName("choice",true); |
---|
| 54 | rndmCmd->SetDefaultValue("off"); |
---|
| 55 | rndmCmd->SetCandidates("on off ON OFF"); |
---|
| 56 | rndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 57 | |
---|
| 58 | scanCmd = new G4UIcmdWithAString("/CCal/generator/scan",this); |
---|
| 59 | scanCmd->SetGuidance("Scan eta and phi ranges with single incident particle"); |
---|
| 60 | scanCmd->SetGuidance(" Choice : on,off(default)"); |
---|
| 61 | scanCmd->SetGuidance(" Ranges : etamin/max, phimin/max are set by other commands "); |
---|
| 62 | scanCmd->SetParameterName("choice",true); |
---|
| 63 | scanCmd->SetDefaultValue("off"); |
---|
| 64 | scanCmd->SetCandidates("on off ON OFF"); |
---|
| 65 | scanCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 66 | |
---|
| 67 | minEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minEnergy",this); |
---|
| 68 | minEnergyCmd->SetGuidance("Set minimum Energy for the incident particle."); |
---|
| 69 | minEnergyCmd->SetParameterName("value",true); |
---|
| 70 | minEnergyCmd->SetDefaultValue(1.); |
---|
| 71 | minEnergyCmd->SetDefaultUnit("GeV"); |
---|
| 72 | minEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 73 | |
---|
| 74 | maxEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxEnergy",this); |
---|
| 75 | maxEnergyCmd->SetGuidance("Set maximum Energy for the incident particle."); |
---|
| 76 | maxEnergyCmd->SetParameterName("value",true); |
---|
| 77 | maxEnergyCmd->SetDefaultValue(1.); |
---|
| 78 | maxEnergyCmd->SetDefaultUnit("TeV"); |
---|
| 79 | maxEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 80 | |
---|
| 81 | minPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minPhi",this); |
---|
| 82 | minPhiCmd->SetGuidance("Set minimum Phi angle for the incident particle direction"); |
---|
| 83 | minPhiCmd->SetGuidance(" Choice : from 0 to 2*pi "); |
---|
| 84 | minPhiCmd->SetParameterName("value",true); |
---|
| 85 | minPhiCmd->SetDefaultValue(0); |
---|
| 86 | minPhiCmd->SetDefaultUnit("radian"); |
---|
| 87 | minPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 88 | |
---|
| 89 | maxPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxPhi",this); |
---|
| 90 | maxPhiCmd->SetGuidance("Set maximum Phi angle for the incident particle direction"); |
---|
| 91 | maxPhiCmd->SetGuidance(" Choice : from 0 to 2*pi "); |
---|
| 92 | maxPhiCmd->SetParameterName("value",true); |
---|
| 93 | maxPhiCmd->SetDefaultValue(2.*pi); |
---|
| 94 | maxPhiCmd->SetDefaultUnit("radian"); |
---|
| 95 | maxPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 96 | |
---|
| 97 | stepsPhiCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsPhi",this); |
---|
| 98 | stepsPhiCmd->SetGuidance("number of steps along Phi for scan "); |
---|
| 99 | stepsPhiCmd->SetParameterName("value",true); |
---|
| 100 | stepsPhiCmd->SetDefaultValue(1); |
---|
| 101 | stepsPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 102 | |
---|
| 103 | minEtaCmd = new G4UIcmdWithADouble("/CCal/generator/minEta",this); |
---|
| 104 | minEtaCmd->SetGuidance("Set minimum Eta angle for the incident particle direction"); |
---|
| 105 | minEtaCmd->SetGuidance(" Choice : from 0 to infinity"); |
---|
| 106 | minEtaCmd->SetParameterName("value",true); |
---|
| 107 | minEtaCmd->SetDefaultValue(0); |
---|
| 108 | minEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 109 | |
---|
| 110 | maxEtaCmd = new G4UIcmdWithADouble("/CCal/generator/maxEta",this); |
---|
| 111 | maxEtaCmd->SetGuidance("Set maximum Eta angle for the incident particle direction"); |
---|
| 112 | maxEtaCmd->SetGuidance(" Choice : from 0 to infinity"); |
---|
| 113 | maxEtaCmd->SetParameterName("value",true); |
---|
| 114 | maxEtaCmd->SetDefaultValue(3.5); |
---|
| 115 | maxEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 116 | |
---|
| 117 | stepsEtaCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsEta",this); |
---|
| 118 | stepsEtaCmd->SetGuidance("number of steps along Eta for scan "); |
---|
| 119 | stepsEtaCmd->SetParameterName("value",true); |
---|
| 120 | stepsEtaCmd->SetDefaultValue(1); |
---|
| 121 | stepsEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 122 | |
---|
| 123 | runNoCmd = new G4UIcmdWithAnInteger("/CCal/generator/runNo",this); |
---|
| 124 | runNoCmd->SetGuidance("set the run number "); |
---|
| 125 | runNoCmd->SetParameterName("value",true); |
---|
| 126 | runNoCmd->SetDefaultValue(0); |
---|
| 127 | runNoCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 128 | |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | CCalPrimaryGeneratorMessenger::~CCalPrimaryGeneratorMessenger() { |
---|
| 132 | |
---|
| 133 | if (verboseCmd) |
---|
| 134 | delete verboseCmd; |
---|
| 135 | if (scanCmd) |
---|
| 136 | delete rndmCmd; |
---|
| 137 | if (scanCmd) |
---|
| 138 | delete scanCmd; |
---|
| 139 | if (minEnergyCmd) |
---|
| 140 | delete minEnergyCmd; |
---|
| 141 | if (maxEnergyCmd) |
---|
| 142 | delete maxEnergyCmd; |
---|
| 143 | if (minPhiCmd) |
---|
| 144 | delete minPhiCmd; |
---|
| 145 | if (maxPhiCmd) |
---|
| 146 | delete maxPhiCmd; |
---|
| 147 | if (stepsPhiCmd) |
---|
| 148 | delete stepsPhiCmd; |
---|
| 149 | if (minEtaCmd) |
---|
| 150 | delete minEtaCmd; |
---|
| 151 | if (maxEtaCmd) |
---|
| 152 | delete maxEtaCmd; |
---|
| 153 | if (stepsEtaCmd) |
---|
| 154 | delete stepsEtaCmd; |
---|
| 155 | if (runNoCmd) |
---|
| 156 | delete runNoCmd; |
---|
| 157 | |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | void CCalPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command, |
---|
| 161 | G4String newValues) { |
---|
| 162 | if (command == verboseCmd) |
---|
| 163 | myAction->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues)); |
---|
| 164 | else if (command == rndmCmd) |
---|
| 165 | myAction->SetRandom(newValues); |
---|
| 166 | else if (command == scanCmd) |
---|
| 167 | myAction->SetScan(newValues); |
---|
| 168 | else if (command == minEnergyCmd) |
---|
| 169 | myAction->SetMinimumEnergy(minEnergyCmd->GetNewDoubleValue(newValues)); |
---|
| 170 | else if (command == maxEnergyCmd) |
---|
| 171 | myAction->SetMaximumEnergy(maxEnergyCmd->GetNewDoubleValue(newValues)); |
---|
| 172 | else if (command == minPhiCmd) |
---|
| 173 | myAction->SetMinimumPhi(minPhiCmd->GetNewDoubleValue(newValues)); |
---|
| 174 | else if (command == maxPhiCmd) |
---|
| 175 | myAction->SetMaximumPhi(maxPhiCmd->GetNewDoubleValue(newValues)); |
---|
| 176 | else if (command == stepsPhiCmd) |
---|
| 177 | myAction->SetStepsPhi(stepsPhiCmd->GetNewIntValue(newValues)); |
---|
| 178 | else if (command == minEtaCmd) |
---|
| 179 | myAction->SetMinimumEta(minEtaCmd->GetNewDoubleValue(newValues)); |
---|
| 180 | else if (command == maxEtaCmd) |
---|
| 181 | myAction->SetMaximumEta(maxEtaCmd->GetNewDoubleValue(newValues)); |
---|
| 182 | else if (command == stepsEtaCmd) |
---|
| 183 | myAction->SetStepsEta(stepsEtaCmd->GetNewIntValue(newValues)); |
---|
| 184 | else if (command == runNoCmd) |
---|
| 185 | myAction->SetRunNo(runNoCmd->GetNewIntValue(newValues)); |
---|
| 186 | |
---|
| 187 | } |
---|