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10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/composite_calorimeter/src/CCalPrimaryGeneratorMessenger.cc (Version 11.3.0) and /examples/advanced/composite_calorimeter/src/CCalPrimaryGeneratorMessenger.cc (Version 9.6)


  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 // File: CCalPrimaryGeneratorMessenger.cc          27 // File: CCalPrimaryGeneratorMessenger.cc
 28 // Description: CCalPrimaryGeneratorMessenger      28 // Description: CCalPrimaryGeneratorMessenger adds new commands for
 29 //              primary generator action           29 //              primary generator action
 30 //////////////////////////////////////////////     30 ///////////////////////////////////////////////////////////////////////////////
 31 #include "CCalPrimaryGeneratorMessenger.hh"        31 #include "CCalPrimaryGeneratorMessenger.hh"
 32 #include "CCalPrimaryGeneratorAction.hh"           32 #include "CCalPrimaryGeneratorAction.hh"
 33                                                    33 
 34 #include "globals.hh"                              34 #include "globals.hh"
 35 #include "G4PhysicalConstants.hh"                  35 #include "G4PhysicalConstants.hh"
 36 #include "G4UImanager.hh"                          36 #include "G4UImanager.hh"
 37 #include "G4UIcmdWithAString.hh"                   37 #include "G4UIcmdWithAString.hh"
 38 #include "G4UIcmdWithADoubleAndUnit.hh"            38 #include "G4UIcmdWithADoubleAndUnit.hh"
 39 #include "G4UIcmdWithADouble.hh"                   39 #include "G4UIcmdWithADouble.hh"
 40 #include "G4UIcmdWithABool.hh"                     40 #include "G4UIcmdWithABool.hh"
 41 #include "G4UIcmdWithAnInteger.hh"                 41 #include "G4UIcmdWithAnInteger.hh"
 42                                                    42 
 43 CCalPrimaryGeneratorMessenger::CCalPrimaryGene     43 CCalPrimaryGeneratorMessenger::CCalPrimaryGeneratorMessenger(CCalPrimaryGeneratorAction* myGun) : myAction(myGun) {
 44                                                    44 
 45   verboseCmd = new G4UIcmdWithAnInteger("/CCal     45   verboseCmd = new G4UIcmdWithAnInteger("/CCal/generator/verbose",this);
 46   verboseCmd->SetGuidance("set Verbosity level     46   verboseCmd->SetGuidance("set Verbosity level ");
 47   verboseCmd->SetParameterName("value",true);      47   verboseCmd->SetParameterName("value",true);
 48   verboseCmd->SetDefaultValue(0);                  48   verboseCmd->SetDefaultValue(0);
 49   verboseCmd->AvailableForStates(G4State_PreIn     49   verboseCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 50                                                    50 
 51   rndmCmd = new G4UIcmdWithAString("/CCal/gene     51   rndmCmd = new G4UIcmdWithAString("/CCal/generator/random",this);
 52   rndmCmd->SetGuidance("Choose randomly energy     52   rndmCmd->SetGuidance("Choose randomly energy and direction of the incident particle.");
 53   rndmCmd->SetGuidance("  Choice : on,off(defa     53   rndmCmd->SetGuidance("  Choice : on,off(default)");
 54   rndmCmd->SetParameterName("choice",true);        54   rndmCmd->SetParameterName("choice",true);
 55   rndmCmd->SetDefaultValue("off");                 55   rndmCmd->SetDefaultValue("off");
 56   rndmCmd->SetCandidates("on off ON OFF");         56   rndmCmd->SetCandidates("on off ON OFF");
 57   rndmCmd->AvailableForStates(G4State_PreInit,     57   rndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 58                                                    58 
 59   scanCmd = new G4UIcmdWithAString("/CCal/gene     59   scanCmd = new G4UIcmdWithAString("/CCal/generator/scan",this);
 60   scanCmd->SetGuidance("Scan eta and phi range     60   scanCmd->SetGuidance("Scan eta and phi ranges with single incident particle");
 61   scanCmd->SetGuidance("  Choice : on,off(defa     61   scanCmd->SetGuidance("  Choice : on,off(default)");
 62   scanCmd->SetGuidance("  Ranges : etamin/max,     62   scanCmd->SetGuidance("  Ranges : etamin/max, phimin/max are set by other commands ");
 63   scanCmd->SetParameterName("choice",true);        63   scanCmd->SetParameterName("choice",true);
 64   scanCmd->SetDefaultValue("off");                 64   scanCmd->SetDefaultValue("off");
 65   scanCmd->SetCandidates("on off ON OFF");         65   scanCmd->SetCandidates("on off ON OFF");
 66   scanCmd->AvailableForStates(G4State_PreInit,     66   scanCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 67                                                    67 
 68   minEnergyCmd = new G4UIcmdWithADoubleAndUnit     68   minEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minEnergy",this);
 69   minEnergyCmd->SetGuidance("Set minimum Energ     69   minEnergyCmd->SetGuidance("Set minimum Energy for the incident particle.");
 70   minEnergyCmd->SetParameterName("value",true)     70   minEnergyCmd->SetParameterName("value",true);
 71   minEnergyCmd->SetDefaultValue(1.);               71   minEnergyCmd->SetDefaultValue(1.);
 72   minEnergyCmd->SetDefaultUnit("GeV");             72   minEnergyCmd->SetDefaultUnit("GeV");
 73   minEnergyCmd->AvailableForStates(G4State_Pre     73   minEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 74                                                    74   
 75   maxEnergyCmd = new G4UIcmdWithADoubleAndUnit     75   maxEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxEnergy",this);
 76   maxEnergyCmd->SetGuidance("Set maximum Energ     76   maxEnergyCmd->SetGuidance("Set maximum Energy for the incident particle.");
 77   maxEnergyCmd->SetParameterName("value",true)     77   maxEnergyCmd->SetParameterName("value",true);
 78   maxEnergyCmd->SetDefaultValue(1.);               78   maxEnergyCmd->SetDefaultValue(1.);
 79   maxEnergyCmd->SetDefaultUnit("TeV");             79   maxEnergyCmd->SetDefaultUnit("TeV");
 80   maxEnergyCmd->AvailableForStates(G4State_Pre     80   maxEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 81                                                    81 
 82   minPhiCmd = new G4UIcmdWithADoubleAndUnit("/     82   minPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minPhi",this);
 83   minPhiCmd->SetGuidance("Set minimum Phi angl     83   minPhiCmd->SetGuidance("Set minimum Phi angle for the incident particle direction");
 84   minPhiCmd->SetGuidance("  Choice : from 0 to     84   minPhiCmd->SetGuidance("  Choice : from 0 to 2*pi ");
 85   minPhiCmd->SetParameterName("value",true);       85   minPhiCmd->SetParameterName("value",true);
 86   minPhiCmd->SetDefaultValue(0);                   86   minPhiCmd->SetDefaultValue(0);
 87   minPhiCmd->SetDefaultUnit("radian");             87   minPhiCmd->SetDefaultUnit("radian");
 88   minPhiCmd->AvailableForStates(G4State_PreIni     88   minPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 89                                                    89 
 90   maxPhiCmd = new G4UIcmdWithADoubleAndUnit("/     90   maxPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxPhi",this);
 91   maxPhiCmd->SetGuidance("Set maximum Phi angl     91   maxPhiCmd->SetGuidance("Set maximum Phi angle for the incident particle direction");
 92   maxPhiCmd->SetGuidance("  Choice : from 0 to     92   maxPhiCmd->SetGuidance("  Choice : from 0 to 2*pi ");
 93   maxPhiCmd->SetParameterName("value",true);       93   maxPhiCmd->SetParameterName("value",true);
 94   maxPhiCmd->SetDefaultValue(2.*pi);               94   maxPhiCmd->SetDefaultValue(2.*pi);
 95   maxPhiCmd->SetDefaultUnit("radian");             95   maxPhiCmd->SetDefaultUnit("radian");
 96   maxPhiCmd->AvailableForStates(G4State_PreIni     96   maxPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 97                                                    97 
 98   stepsPhiCmd = new G4UIcmdWithAnInteger("/CCa     98   stepsPhiCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsPhi",this);
 99   stepsPhiCmd->SetGuidance("number of steps al     99   stepsPhiCmd->SetGuidance("number of steps along Phi for scan ");
100   stepsPhiCmd->SetParameterName("value",true);    100   stepsPhiCmd->SetParameterName("value",true);
101   stepsPhiCmd->SetDefaultValue(1);                101   stepsPhiCmd->SetDefaultValue(1);
102   stepsPhiCmd->AvailableForStates(G4State_PreI    102   stepsPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
103                                                   103 
104   minEtaCmd = new G4UIcmdWithADouble("/CCal/ge    104   minEtaCmd = new G4UIcmdWithADouble("/CCal/generator/minEta",this);
105   minEtaCmd->SetGuidance("Set minimum Eta angl    105   minEtaCmd->SetGuidance("Set minimum Eta angle for the incident particle direction");
106   minEtaCmd->SetGuidance("  Choice : from 0 to    106   minEtaCmd->SetGuidance("  Choice : from 0 to infinity");
107   minEtaCmd->SetParameterName("value",true);      107   minEtaCmd->SetParameterName("value",true);
108   minEtaCmd->SetDefaultValue(0);                  108   minEtaCmd->SetDefaultValue(0);
109   minEtaCmd->AvailableForStates(G4State_PreIni    109   minEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
110                                                   110 
111   maxEtaCmd = new G4UIcmdWithADouble("/CCal/ge    111   maxEtaCmd = new G4UIcmdWithADouble("/CCal/generator/maxEta",this);
112   maxEtaCmd->SetGuidance("Set maximum Eta angl    112   maxEtaCmd->SetGuidance("Set maximum Eta angle for the incident particle direction");
113   maxEtaCmd->SetGuidance("  Choice : from 0 to    113   maxEtaCmd->SetGuidance("  Choice : from 0 to infinity");
114   maxEtaCmd->SetParameterName("value",true);      114   maxEtaCmd->SetParameterName("value",true);
115   maxEtaCmd->SetDefaultValue(3.5);                115   maxEtaCmd->SetDefaultValue(3.5);
116   maxEtaCmd->AvailableForStates(G4State_PreIni    116   maxEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
117                                                   117 
118   stepsEtaCmd = new G4UIcmdWithAnInteger("/CCa    118   stepsEtaCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsEta",this);
119   stepsEtaCmd->SetGuidance("number of steps al    119   stepsEtaCmd->SetGuidance("number of steps along Eta for scan ");
120   stepsEtaCmd->SetParameterName("value",true);    120   stepsEtaCmd->SetParameterName("value",true);
121   stepsEtaCmd->SetDefaultValue(1);                121   stepsEtaCmd->SetDefaultValue(1);
122   stepsEtaCmd->AvailableForStates(G4State_PreI    122   stepsEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
123                                                   123 
124   runNoCmd = new G4UIcmdWithAnInteger("/CCal/g    124   runNoCmd = new G4UIcmdWithAnInteger("/CCal/generator/runNo",this);
125   runNoCmd->SetGuidance("set the run number ")    125   runNoCmd->SetGuidance("set the run number ");
126   runNoCmd->SetParameterName("value",true);       126   runNoCmd->SetParameterName("value",true);
127   runNoCmd->SetDefaultValue(0);                   127   runNoCmd->SetDefaultValue(0);
128   runNoCmd->AvailableForStates(G4State_PreInit    128   runNoCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
129                                                   129 
130 }                                                 130 }
131                                                   131 
132 CCalPrimaryGeneratorMessenger::~CCalPrimaryGen    132 CCalPrimaryGeneratorMessenger::~CCalPrimaryGeneratorMessenger() {
133                                                   133 
134   if (verboseCmd)                                 134   if (verboseCmd)
135     delete verboseCmd;                            135     delete verboseCmd;
136   if (scanCmd)                                    136   if (scanCmd)
137     delete rndmCmd;                               137     delete rndmCmd;
138   if (scanCmd)                                    138   if (scanCmd)
139     delete scanCmd;                               139     delete scanCmd;
140   if (minEnergyCmd)                               140   if (minEnergyCmd)
141     delete minEnergyCmd;                          141     delete minEnergyCmd;
142   if (maxEnergyCmd)                               142   if (maxEnergyCmd)
143     delete maxEnergyCmd;                          143     delete maxEnergyCmd;
144   if (minPhiCmd)                                  144   if (minPhiCmd)
145     delete minPhiCmd;                             145     delete minPhiCmd;
146   if (maxPhiCmd)                                  146   if (maxPhiCmd)
147     delete maxPhiCmd;                             147     delete maxPhiCmd;
148   if (stepsPhiCmd)                                148   if (stepsPhiCmd)
149     delete stepsPhiCmd;                           149     delete stepsPhiCmd;
150   if (minEtaCmd)                                  150   if (minEtaCmd)
151     delete minEtaCmd;                             151     delete minEtaCmd;
152   if (maxEtaCmd)                                  152   if (maxEtaCmd)
153     delete maxEtaCmd;                             153     delete maxEtaCmd;
154   if (stepsEtaCmd)                                154   if (stepsEtaCmd)
155     delete stepsEtaCmd;                           155     delete stepsEtaCmd;
156   if (runNoCmd)                                   156   if (runNoCmd)
157     delete runNoCmd;                              157     delete runNoCmd;
158                                                   158 
159 }                                                 159 }
160                                                   160 
161 void CCalPrimaryGeneratorMessenger::SetNewValu    161 void CCalPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,
162                                                << 162             G4String newValues)    { 
163   if (command == verboseCmd)                      163   if (command == verboseCmd)
164     myAction->SetVerboseLevel(verboseCmd->GetN    164     myAction->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
165   else if (command == rndmCmd)                    165   else if (command == rndmCmd)
166     myAction->SetRandom(newValues);               166     myAction->SetRandom(newValues);
167   else if (command == scanCmd)                    167   else if (command == scanCmd)
168     myAction->SetScan(newValues);                 168     myAction->SetScan(newValues);
169   else if (command == minEnergyCmd)               169   else if (command == minEnergyCmd)
170     myAction->SetMinimumEnergy(minEnergyCmd->G    170     myAction->SetMinimumEnergy(minEnergyCmd->GetNewDoubleValue(newValues));
171   else if (command == maxEnergyCmd)               171   else if (command == maxEnergyCmd)
172     myAction->SetMaximumEnergy(maxEnergyCmd->G    172     myAction->SetMaximumEnergy(maxEnergyCmd->GetNewDoubleValue(newValues));
173   else if (command == minPhiCmd)                  173   else if (command == minPhiCmd)
174     myAction->SetMinimumPhi(minPhiCmd->GetNewD    174     myAction->SetMinimumPhi(minPhiCmd->GetNewDoubleValue(newValues));
175   else if (command == maxPhiCmd)                  175   else if (command == maxPhiCmd)
176     myAction->SetMaximumPhi(maxPhiCmd->GetNewD    176     myAction->SetMaximumPhi(maxPhiCmd->GetNewDoubleValue(newValues));
177   else if (command == stepsPhiCmd)                177   else if (command == stepsPhiCmd)
178     myAction->SetStepsPhi(stepsPhiCmd->GetNewI    178     myAction->SetStepsPhi(stepsPhiCmd->GetNewIntValue(newValues));
179   else if (command == minEtaCmd)                  179   else if (command == minEtaCmd)
180     myAction->SetMinimumEta(minEtaCmd->GetNewD    180     myAction->SetMinimumEta(minEtaCmd->GetNewDoubleValue(newValues));
181   else if (command == maxEtaCmd)                  181   else if (command == maxEtaCmd)
182     myAction->SetMaximumEta(maxEtaCmd->GetNewD    182     myAction->SetMaximumEta(maxEtaCmd->GetNewDoubleValue(newValues));
183   else if (command == stepsEtaCmd)                183   else if (command == stepsEtaCmd)
184     myAction->SetStepsEta(stepsEtaCmd->GetNewI    184     myAction->SetStepsEta(stepsEtaCmd->GetNewIntValue(newValues));
185   else if (command == runNoCmd)                   185   else if (command == runNoCmd)
186     myAction->SetRunNo(runNoCmd->GetNewIntValu    186     myAction->SetRunNo(runNoCmd->GetNewIntValue(newValues));
187                                                   187  
188 }                                                 188 }
189                                                   189