ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ProductionCutsTableMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ProductionCutsTableMessenger.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 //
29 //---------------------------------------------------------------
30 //
31 // G4ProductionCutsTableMessenger.cc
32 // ------------------------------------------------------------
33 // History
34 // first version 02 Mar. 2008 by H.Kurashige
35 //
36 
38 #include "G4ProductionCutsTable.hh"
39 
40 #include "G4UIdirectory.hh"
42 #include "G4UIcmdWithAnInteger.hh"
44 #include "G4UIcmdWithAString.hh"
45 #include "G4ios.hh"
46 #include "G4Tokenizer.hh"
47 
48 #include <sstream>
49 
51  :theCutsTable(pTable)
52 {
53  // /cuts/ directory
54  theDirectory = new G4UIdirectory("/cuts/");
55  theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
56 
57  // /cuts/verbose command
58  verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
59  verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
60  verboseCmd->SetGuidance(" 0 : Silent (default)");
61  verboseCmd->SetGuidance(" 1 : Display warning messages");
62  verboseCmd->SetGuidance(" 2 : Display more info");
63  verboseCmd->SetGuidance(" 2 : Display debug info");
64  verboseCmd->SetParameterName("level",true);
66  verboseCmd->SetRange("level >=0 && level <=3");
67 
68  // /cuts/setLowEdge command
69  setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
70  setLowEdgeCmd->SetGuidance("Set low edge energy value ");
71  setLowEdgeCmd->SetParameterName("edge",false);
73  setLowEdgeCmd->SetRange("edge >0.0");
76 
77  // /cuts/setHighEdge command
78  setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
79  setHighEdgeCmd->SetGuidance("Set high edge energy value ");
80  setHighEdgeCmd->SetParameterName("edge",false);
82  setHighEdgeCmd->SetRange("edge >0.0");
85 
86  // /cuts/setMaxCutEnergy command
87  setMaxEnergyCutCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setMaxCutEnergy",this);
88  setMaxEnergyCutCmd->SetGuidance("Set maximum of cut energy value ");
91  setMaxEnergyCutCmd->SetRange("cut >0.0");
94 
95  // /cuts/dump command
96  dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
97  dumpCmd->SetGuidance("Dump cuplues in ProductuinCutsTable. ");
98 
99 }
100 
102 {
103  delete dumpCmd;
104  delete setMaxEnergyCutCmd;
105  delete setHighEdgeCmd;
106  delete setLowEdgeCmd;
107  delete verboseCmd;
108  delete theDirectory;
109 }
110 
112  G4String newValue)
113 {
114  if( command==verboseCmd ) {
116 
117  } else if( command==dumpCmd ){
118  theCutsTable-> DumpCouples();
119 
120  } else if( command==setLowEdgeCmd ){
121  G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
123  theCutsTable->SetEnergyRange(lowEdge, highEdge);
124 
125  } else if( command==setHighEdgeCmd ){
126  G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
128  theCutsTable->SetEnergyRange(lowEdge, highEdge);
129 
130  } else if( command==setMaxEnergyCutCmd ){
131  G4double cut = setHighEdgeCmd->GetNewDoubleValue(newValue);
133 
134  }
135 }
136 
138 {
139  G4String cv;
140 
141  if( command==verboseCmd ){
143 
144  } else if( command==setLowEdgeCmd ){
146  cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
147 
148  } else if( command==setHighEdgeCmd ){
150  cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
151 
152  } else if( command==setMaxEnergyCutCmd ){
154  cv = setMaxEnergyCutCmd->ConvertToString( cut, "GeV" );
155  }
156 
157 
158  return cv;
159 
160 }
161