ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EmExtraParametersMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4EmExtraParametersMessenger.cc
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 //
28 // GEANT4 Class file
29 //
30 // File name: G4EmExtraParametersMessenger
31 //
32 // Author: Vladimir Ivanchenko
33 //
34 // Creation date: 07-05-2019
35 //
36 // -------------------------------------------------------------------
37 //
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
43 #include "G4UIcommand.hh"
44 #include "G4UIparameter.hh"
45 #include "G4UIcmdWithABool.hh"
46 #include "G4UIcmdWithAnInteger.hh"
47 #include "G4UIcmdWithADouble.hh"
49 #include "G4UIcmdWithAString.hh"
51 #include "G4UImanager.hh"
52 #include "G4EmExtraParameters.hh"
53 
54 #include <sstream>
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57 
59  : theParameters(ptr)
60 {
61  paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
62  paiCmd->SetGuidance("Activate PAI in the G4Region.");
63  paiCmd->SetGuidance(" partName : particle name (default - all)");
64  paiCmd->SetGuidance(" regName : G4Region name");
65  paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
67 
68  G4UIparameter* part = new G4UIparameter("partName",'s',false);
69  paiCmd->SetParameter(part);
70 
71  G4UIparameter* pregName = new G4UIparameter("regName",'s',false);
72  paiCmd->SetParameter(pregName);
73 
74  G4UIparameter* ptype = new G4UIparameter("type",'s',false);
75  paiCmd->SetParameter(ptype);
76  ptype->SetParameterCandidates("pai PAI PAIphoton");
77 
78  mscoCmd = new G4UIcommand("/process/em/AddEmRegion",this);
79  mscoCmd->SetGuidance("Add optional EM configuration for a G4Region.");
80  mscoCmd->SetGuidance(" regName : G4Region name");
81  mscoCmd->SetGuidance(" emType : G4EmStandard, G4EmStandard_opt1, ...");
83 
84  G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
85  mscoCmd->SetParameter(mregName);
86 
87  G4UIparameter* mtype = new G4UIparameter("mscType",'s',false);
88  mscoCmd->SetParameter(mtype);
89  mtype->SetParameterCandidates("G4EmStandard G4EmStandard_opt1 G4EmStandard_opt2 G4EmStandard_opt3 G4EmStandard_opt4 G4EmStandardGS G4EmStandardSS G4EmLivermore G4EmPenelope G4RadioactiveDecay");
90 
91  SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
92  SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
93  SubSecCmd->SetGuidance(" subSec : true/false");
94  SubSecCmd->SetGuidance(" Region : region name");
96 
97  StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
98  StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
99  StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
100  StepFuncCmd->SetGuidance(" finalRange: range for final step");
101  StepFuncCmd->SetGuidance(" unit : unit of finalRange");
103 
104  G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
105  dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
106  StepFuncCmd->SetParameter(dRoverRPrm);
107 
108  G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
109  finalRangePrm->SetParameterRange("finalRange>0.");
110  StepFuncCmd->SetParameter(finalRangePrm);
111 
112  G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
113  unitPrm->SetDefaultUnit("mm");
114  StepFuncCmd->SetParameter(unitPrm);
115 
116  StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
117  StepFuncCmd1->SetGuidance("Set the energy loss step limitation parameters for muon/hadron.");
118  StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
119  StepFuncCmd1->SetGuidance(" finalRange: range for final step");
121 
122  G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
123  dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
124  StepFuncCmd1->SetParameter(dRoverRPrm1);
125 
126  G4UIparameter* finalRangePrm1 = new G4UIparameter("finalRangeMuHad",'d',false);
127  finalRangePrm1->SetParameterRange("finalRangeMuHad>0.");
128  StepFuncCmd1->SetParameter(finalRangePrm1);
129 
130  G4UIparameter* unitPrm1 = new G4UIparameter("unit",'s',true);
131  unitPrm1->SetDefaultValue("mm");
132  StepFuncCmd1->SetParameter(unitPrm1);
133 
134  G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
135  SubSecCmd->SetParameter(subSec);
136 
137  G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
138  SubSecCmd->SetParameter(subSecReg);
139 
140  bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
141  bfCmd->SetGuidance("Set factor for the process cross section.");
142  bfCmd->SetGuidance(" procName : process name");
143  bfCmd->SetGuidance(" procFact : factor");
144  bfCmd->SetGuidance(" flagFact : flag to change weight");
146 
147  G4UIparameter* procName = new G4UIparameter("procName",'s',false);
148  bfCmd->SetParameter(procName);
149 
150  G4UIparameter* procFact = new G4UIparameter("procFact",'d',false);
151  bfCmd->SetParameter(procFact);
152 
153  G4UIparameter* flagFact = new G4UIparameter("flagFact",'s',false);
154  bfCmd->SetParameter(flagFact);
155 
156  fiCmd = new G4UIcommand("/process/em/setForcedInteraction",this);
157  fiCmd->SetGuidance("Set factor for the process cross section.");
158  fiCmd->SetGuidance(" procNam : process name");
159  fiCmd->SetGuidance(" regNam : region name");
160  fiCmd->SetGuidance(" tlength : fixed target length");
161  fiCmd->SetGuidance(" unitT : length unit");
162  fiCmd->SetGuidance(" tflag : flag to change weight");
164 
165  G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
166  fiCmd->SetParameter(procNam);
167 
168  G4UIparameter* regNam = new G4UIparameter("regNam",'s',false);
169  fiCmd->SetParameter(regNam);
170 
171  G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
172  tlength->SetParameterRange("tlength>0");
173  fiCmd->SetParameter(tlength);
174 
175  G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
176  unitT->SetDefaultUnit("mm");
177  fiCmd->SetParameter(unitT);
178 
179  G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
180  flagT->SetDefaultValue(true);
181  fiCmd->SetParameter(flagT);
182 
183  bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
184  bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
185  bsCmd->SetGuidance(" bProcNam : process name");
186  bsCmd->SetGuidance(" bRegNam : region name");
187  bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
188  bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
189  bsCmd->SetGuidance(" bUnit : energy unit");
191 
192  G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
193  bsCmd->SetParameter(bProcNam);
194 
195  G4UIparameter* bRegNam = new G4UIparameter("bRegNam",'s',false);
196  bsCmd->SetParameter(bRegNam);
197 
198  G4UIparameter* bFactor = new G4UIparameter("bFactor",'d',false);
199  bsCmd->SetParameter(bFactor);
200 
201  G4UIparameter* bEnergy = new G4UIparameter("bEnergy",'d',false);
202  bsCmd->SetParameter(bEnergy);
203 
204  G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
205  bUnit->SetDefaultUnit("MeV");
206  bsCmd->SetParameter(bUnit);
207 
208  dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
209  dirSplitCmd->SetGuidance("Enable directional brem splitting");
211 
212  qeCmd = new G4UIcmdWithABool("/process/em/QuantumEntanglement",this);
213  qeCmd->SetGuidance("Enable quantum entanglement");
215 
216  dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
217  dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
219 
220  dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
221  dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
226 
228 {
229  delete paiCmd;
230  delete mscoCmd;
231  delete SubSecCmd;
232  delete bfCmd;
233  delete fiCmd;
234  delete bsCmd;
235  delete qeCmd;
236  delete StepFuncCmd;
237  delete StepFuncCmd1;
238  delete dirSplitCmd;
239  delete dirSplitTargetCmd;
240  delete dirSplitRadiusCmd;
241 }
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
244 
246  G4String newValue)
247 {
248  G4bool physicsModified = false;
249 
250  if (command == paiCmd) {
251  G4String s1(""),s2(""),s3("");
252  std::istringstream is(newValue);
253  is >> s1 >> s2 >> s3;
254  theParameters->AddPAIModel(s1, s2, s3);
255  } else if (command == mscoCmd) {
256  G4String s1(""),s2("");
257  std::istringstream is(newValue);
258  is >> s1 >> s2;
260  } else if (command == StepFuncCmd || command == StepFuncCmd1) {
261  G4double v1,v2;
262  G4String unt;
263  std::istringstream is(newValue);
264  is >> v1 >> v2 >> unt;
265  v2 *= G4UIcommand::ValueOf(unt);
266  if(command == StepFuncCmd) {
268  } else {
270  }
271  physicsModified = true;
272  } else if (command == SubSecCmd) {
273  G4String s1, s2;
274  std::istringstream is(newValue);
275  is >> s1 >> s2;
276  G4bool yes = false;
277  if(s1 == "true") { yes = true; }
278  theParameters->SetSubCutoff(yes,s2);
279  } else if (command == bfCmd) {
280  G4double v1(1.0);
281  G4String s0(""),s1("");
282  std::istringstream is(newValue);
283  is >> s0 >> v1 >> s1;
284  G4bool yes = false;
285  if(s1 == "true") { yes = true; }
287  physicsModified = true;
288  } else if (command == fiCmd) {
289  G4double v1(0.0);
290  G4String s1(""),s2(""),s3(""),unt("mm");
291  std::istringstream is(newValue);
292  is >> s1 >> s2 >> v1 >> unt >> s3;
293  G4bool yes = false;
294  if(s3 == "true") { yes = true; }
295  v1 *= G4UIcommand::ValueOf(unt);
297  physicsModified = true;
298  } else if (command == bsCmd) {
299  G4double fb(1.0),en(1.e+30);
300  G4String s1(""),s2(""),unt("MeV");
301  std::istringstream is(newValue);
302  is >> s1 >> s2 >> fb >> en >> unt;
303  en *= G4UIcommand::ValueOf(unt);
305  physicsModified = true;
306  } else if (command == qeCmd) {
308  } else if (command == dirSplitCmd) {
310  dirSplitCmd->GetNewBoolValue(newValue));
311  physicsModified = true;
312  } else if (command == dirSplitTargetCmd) {
315  physicsModified = true;
316  } else if (command == dirSplitRadiusCmd) {
319  physicsModified = true;
320  }
321 
322  if(physicsModified) {
323  G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
324  }
325 }
326 
327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....