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] [ 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/extended/hadronic/Hadr01/src/DetectorMessenger.cc (Version 11.3.0) and /examples/extended/hadronic/Hadr01/src/DetectorMessenger.cc (Version 11.2)


  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 /// \file hadronic/Hadr01/src/DetectorMessenge     26 /// \file hadronic/Hadr01/src/DetectorMessenger.cc
 27 /// \brief Implementation of the DetectorMesse     27 /// \brief Implementation of the DetectorMessenger class
 28 //                                                 28 //
 29 //                                                 29 //
 30 //////////////////////////////////////////////     30 /////////////////////////////////////////////////////////////////////////
 31 //                                                 31 //
 32 // DetectorMessenger                               32 // DetectorMessenger
 33 //                                                 33 //
 34 // Created: 31.01.03 V.Ivanchenko                  34 // Created: 31.01.03 V.Ivanchenko
 35 //                                                 35 //
 36 // Modified:                                       36 // Modified:
 37 // 04.06.2006 Adoptation of Hadr01 (V.Ivanchen     37 // 04.06.2006 Adoptation of Hadr01 (V.Ivanchenko)
 38 // 16.11.2006 Add beamCmd (V.Ivanchenko)           38 // 16.11.2006 Add beamCmd (V.Ivanchenko)
 39 //                                                 39 //
 40 //////////////////////////////////////////////     40 ////////////////////////////////////////////////////////////////////////
 41 //                                                 41 //
 42                                                    42 
 43 #include "DetectorMessenger.hh"                    43 #include "DetectorMessenger.hh"
 44                                                    44 
 45 #include "DetectorConstruction.hh"                 45 #include "DetectorConstruction.hh"
 46 #include "HistoManager.hh"                     <<  46 #include "G4UIdirectory.hh"
 47                                                << 
 48 #include "G4HadronicParameters.hh"             << 
 49 #include "G4UIcmdWith3Vector.hh"               << 
 50 #include "G4UIcmdWithABool.hh"                     47 #include "G4UIcmdWithABool.hh"
 51 #include "G4UIcmdWithADoubleAndUnit.hh"        << 
 52 #include "G4UIcmdWithAString.hh"                   48 #include "G4UIcmdWithAString.hh"
 53 #include "G4UIcmdWithAnInteger.hh"                 49 #include "G4UIcmdWithAnInteger.hh"
                                                   >>  50 #include "G4UIcmdWith3Vector.hh"
                                                   >>  51 #include "G4UIcmdWithADoubleAndUnit.hh"
 54 #include "G4UIcmdWithoutParameter.hh"              52 #include "G4UIcmdWithoutParameter.hh"
 55 #include "G4UIdirectory.hh"                    <<  53 #include "G4HadronicParameters.hh"
                                                   >>  54 #include "HistoManager.hh"
 56                                                    55 
 57 //....oooOO0OOooo........oooOO0OOooo........oo     56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 58                                                    57 
 59 DetectorMessenger::DetectorMessenger(DetectorC <<  58 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
 60   : G4UImessenger(),                           <<  59 : G4UImessenger(), fDetector(Det),
 61     fDetector(Det),                            <<  60   fTestDir(0),
 62     fTestDir(0),                               <<  61   fMatCmd(0),
 63     fMatCmd(0),                                <<  62   fMat1Cmd(0),
 64     fMat1Cmd(0),                               <<  63   fRCmd(0),
 65     fRCmd(0),                                  <<  64   fLCmd(0),
 66     fLCmd(0),                                  <<  65   fEdepCmd(0),
 67     fEdepCmd(0),                               <<  66   fBinCmd(0),
 68     fBinCmd(0),                                <<  67   fNOfAbsCmd(0),
 69     fNOfAbsCmd(0),                             <<  68   fVerbCmd(0),
 70     fVerbCmd(0),                               <<  69   fBeamCmd(0)
 71     fBeamCmd(0)                                << 
 72 {                                                  70 {
 73   fTestDir = new G4UIdirectory("/testhadr/");      71   fTestDir = new G4UIdirectory("/testhadr/");
 74   fTestDir->SetGuidance(" Hadronic Extended Ex     72   fTestDir->SetGuidance(" Hadronic Extended Example.");
 75                                                    73 
 76   fMatCmd = new G4UIcmdWithAString("/testhadr/ <<  74   fMatCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
 77   fMatCmd->SetGuidance("Select Material for th     75   fMatCmd->SetGuidance("Select Material for the target");
 78   fMatCmd->SetParameterName("tMaterial", false <<  76   fMatCmd->SetParameterName("tMaterial",false);
 79   fMatCmd->AvailableForStates(G4State_PreInit, <<  77   fMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 80                                                    78 
 81   fMat1Cmd = new G4UIcmdWithAString("/testhadr <<  79   fMat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
 82   fMat1Cmd->SetGuidance("Select Material for w     80   fMat1Cmd->SetGuidance("Select Material for world");
 83   fMat1Cmd->SetParameterName("wMaterial", fals <<  81   fMat1Cmd->SetParameterName("wMaterial",false);
 84   fMat1Cmd->AvailableForStates(G4State_PreInit <<  82   fMat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 85                                                    83 
 86   fRCmd = new G4UIcmdWithADoubleAndUnit("/test <<  84   fRCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
 87   fRCmd->SetGuidance("Set radius of the target     85   fRCmd->SetGuidance("Set radius of the target");
 88   fRCmd->SetParameterName("radius", false);    <<  86   fRCmd->SetParameterName("radius",false);
 89   fRCmd->SetUnitCategory("Length");                87   fRCmd->SetUnitCategory("Length");
 90   fRCmd->SetRange("radius>0");                     88   fRCmd->SetRange("radius>0");
 91   fRCmd->AvailableForStates(G4State_PreInit);      89   fRCmd->AvailableForStates(G4State_PreInit);
 92                                                    90 
 93   fLCmd = new G4UIcmdWithADoubleAndUnit("/test <<  91   fLCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
 94   fLCmd->SetGuidance("Set length of the target     92   fLCmd->SetGuidance("Set length of the target");
 95   fLCmd->SetParameterName("length", false);    <<  93   fLCmd->SetParameterName("length",false);
 96   fLCmd->SetUnitCategory("Length");                94   fLCmd->SetUnitCategory("Length");
 97   fLCmd->SetRange("length>0");                     95   fLCmd->SetRange("length>0");
 98   fLCmd->AvailableForStates(G4State_PreInit);      96   fLCmd->AvailableForStates(G4State_PreInit);
 99                                                    97 
100   fBinCmd = new G4UIcmdWithAnInteger("/testhad <<  98   fBinCmd = new G4UIcmdWithAnInteger("/testhadr/NumberOfBinsE",this);
101   fBinCmd->SetGuidance("Set number of bins for     99   fBinCmd->SetGuidance("Set number of bins for Energy");
102   fBinCmd->SetParameterName("NEbins", false);  << 100   fBinCmd->SetParameterName("NEbins",false);
103   fBinCmd->AvailableForStates(G4State_PreInit)    101   fBinCmd->AvailableForStates(G4State_PreInit);
104                                                   102 
105   fNOfAbsCmd = new G4UIcmdWithAnInteger("/test << 103   fNOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/NumberDivZ",this);
106   fNOfAbsCmd->SetGuidance("Set number of slice    104   fNOfAbsCmd->SetGuidance("Set number of slices");
107   fNOfAbsCmd->SetParameterName("NZ", false);   << 105   fNOfAbsCmd->SetParameterName("NZ",false);
108   fNOfAbsCmd->AvailableForStates(G4State_PreIn    106   fNOfAbsCmd->AvailableForStates(G4State_PreInit);
109                                                   107 
110   fEdepCmd = new G4UIcmdWithADoubleAndUnit("/t << 108   fEdepCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/MaxEdep",this);
111   fEdepCmd->SetGuidance("Set max energy in his    109   fEdepCmd->SetGuidance("Set max energy in histogram");
112   fEdepCmd->SetParameterName("edep", false);   << 110   fEdepCmd->SetParameterName("edep",false);
113   fEdepCmd->SetUnitCategory("Energy");            111   fEdepCmd->SetUnitCategory("Energy");
114   fEdepCmd->SetRange("edep>0");                   112   fEdepCmd->SetRange("edep>0");
115   fEdepCmd->AvailableForStates(G4State_PreInit << 113   fEdepCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
116                                                   114 
117   fBeamCmd = new G4UIcmdWithABool("/testhadr/D << 115   fBeamCmd = new G4UIcmdWithABool("/testhadr/DefaultBeamPosition",this);
118   fBeamCmd->SetGuidance("Use default beam posi    116   fBeamCmd->SetGuidance("Use default beam position");
119   fBeamCmd->AvailableForStates(G4State_PreInit << 117   fBeamCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
120                                                   118 
121   fVerbCmd = new G4UIcmdWithAnInteger("/testha << 119   fVerbCmd = new G4UIcmdWithAnInteger("/testhadr/Verbose",this);
122   fVerbCmd->SetGuidance("Set verbose for ");      120   fVerbCmd->SetGuidance("Set verbose for ");
123   fVerbCmd->SetParameterName("verb", false);   << 121   fVerbCmd->SetParameterName("verb",false);
124   fVerbCmd->AvailableForStates(G4State_PreInit << 122   fVerbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
125                                                   123 
126   fBertCmd = new G4UIcmdWithAnInteger("/testha << 124   fBertCmd = new G4UIcmdWithAnInteger("/testhadr/printBertiniXS",this);
127   fBertCmd->SetGuidance("Set printout of Berti    125   fBertCmd->SetGuidance("Set printout of Bertini crosss ections");
128   fBertCmd->SetParameterName("bert", false);   << 126   fBertCmd->SetParameterName("bert",false);
129   fBertCmd->AvailableForStates(G4State_PreInit << 127   fBertCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
130                                                   128 
131   fBCCmd = new G4UIcmdWithABool("/testhadr/BCP << 129   fBCCmd = new G4UIcmdWithABool("/testhadr/BCParticles",this);
132   fBCCmd->SetGuidance("Enable b-, c- hadronic     130   fBCCmd->SetGuidance("Enable b-, c- hadronic physics");
133   fBCCmd->SetParameterName("BCparticles", fals << 131   fBCCmd->SetParameterName("BCparticles",false);
134   fBCCmd->AvailableForStates(G4State_PreInit);    132   fBCCmd->AvailableForStates(G4State_PreInit);
135                                                   133 
136   fHNCmd = new G4UIcmdWithABool("/testhadr/Hyp << 134   fHNCmd = new G4UIcmdWithABool("/testhadr/HyperNuclei",this);
137   fHNCmd->SetGuidance("Enable hyper-nuclei had    135   fHNCmd->SetGuidance("Enable hyper-nuclei hadronic physics");
138   fHNCmd->SetParameterName("HyperNuclei", fals << 136   fHNCmd->SetParameterName("HyperNuclei",false);
139   fHNCmd->AvailableForStates(G4State_PreInit);    137   fHNCmd->AvailableForStates(G4State_PreInit);
140                                                   138 
141   fNGPCmd = new G4UIcmdWithABool("/testhadr/Ne << 139   fNGPCmd = new G4UIcmdWithABool("/testhadr/NeutronGeneralProcess",this);
142   fNGPCmd->SetGuidance("Enable neutron general    140   fNGPCmd->SetGuidance("Enable neutron general process");
143   fNGPCmd->SetParameterName("NeutronGeneralPro << 141   fNGPCmd->SetParameterName("NeutronGeneralProcess",false);
144   fNGPCmd->AvailableForStates(G4State_PreInit)    142   fNGPCmd->AvailableForStates(G4State_PreInit);
145 }                                                 143 }
146                                                   144 
147 //....oooOO0OOooo........oooOO0OOooo........oo    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148                                                   146 
149 DetectorMessenger::~DetectorMessenger()           147 DetectorMessenger::~DetectorMessenger()
150 {                                                 148 {
151   delete fMatCmd;                                 149   delete fMatCmd;
152   delete fMat1Cmd;                                150   delete fMat1Cmd;
153   delete fRCmd;                                   151   delete fRCmd;
154   delete fLCmd;                                   152   delete fLCmd;
155   delete fBinCmd;                                 153   delete fBinCmd;
156   delete fNOfAbsCmd;                              154   delete fNOfAbsCmd;
157   delete fTestDir;                                155   delete fTestDir;
158   delete fBeamCmd;                                156   delete fBeamCmd;
159   delete fVerbCmd;                                157   delete fVerbCmd;
160   delete fBertCmd;                                158   delete fBertCmd;
161   delete fEdepCmd;                                159   delete fEdepCmd;
162   delete fBCCmd;                                  160   delete fBCCmd;
163   delete fHNCmd;                                  161   delete fHNCmd;
164   delete fNGPCmd;                                 162   delete fNGPCmd;
165 }                                                 163 }
166                                                   164 
167 //....oooOO0OOooo........oooOO0OOooo........oo    165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
168                                                   166 
169 void DetectorMessenger::SetNewValue(G4UIcomman    167 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
170 {                                                 168 {
171   HistoManager* h = HistoManager::GetPointer()    169   HistoManager* h = HistoManager::GetPointer();
172   if (command == fMatCmd) {                    << 170   if( command == fMatCmd ) {
173     fDetector->SetTargetMaterial(newValue);       171     fDetector->SetTargetMaterial(newValue);
174   }                                            << 172   } else if( command == fMat1Cmd ) {
175   else if (command == fMat1Cmd) {              << 
176     fDetector->SetWorldMaterial(newValue);        173     fDetector->SetWorldMaterial(newValue);
177   }                                            << 174   } else if( command == fRCmd ) {
178   else if (command == fRCmd) {                 << 
179     h->SetTargetRadius(fRCmd->GetNewDoubleValu    175     h->SetTargetRadius(fRCmd->GetNewDoubleValue(newValue));
180   }                                            << 176   } else if( command == fLCmd ) {
181   else if (command == fLCmd) {                 << 
182     h->SetTargetLength(fLCmd->GetNewDoubleValu    177     h->SetTargetLength(fLCmd->GetNewDoubleValue(newValue));
183   }                                            << 178   } else if( command == fNOfAbsCmd ) {
184   else if (command == fNOfAbsCmd) {            << 
185     h->SetNumberOfSlices(fNOfAbsCmd->GetNewInt    179     h->SetNumberOfSlices(fNOfAbsCmd->GetNewIntValue(newValue));
186   }                                            << 180   } else if( command == fBinCmd ) {
187   else if (command == fBinCmd) {               << 
188     h->SetNumberOfBinsE(fBinCmd->GetNewIntValu    181     h->SetNumberOfBinsE(fBinCmd->GetNewIntValue(newValue));
189   }                                            << 182   } else if( command == fVerbCmd ) {
190   else if (command == fVerbCmd) {              << 
191     h->SetVerbose(fVerbCmd->GetNewIntValue(new    183     h->SetVerbose(fVerbCmd->GetNewIntValue(newValue));
192   }                                            << 184   } else if( command == fBertCmd ) {
193   else if (command == fBertCmd) {              << 
194     h->SetPrintBertiniXS(fBertCmd->GetNewIntVa    185     h->SetPrintBertiniXS(fBertCmd->GetNewIntValue(newValue));
195   }                                            << 186   } else if (command == fBeamCmd) {
196   else if (command == fBeamCmd) {              << 
197     h->SetDefaultBeamPositionFlag(fBeamCmd->Ge    187     h->SetDefaultBeamPositionFlag(fBeamCmd->GetNewBoolValue(newValue));
198   }                                            << 188   } else if (command == fEdepCmd) {
199   else if (command == fEdepCmd) {              << 
200     h->SetMaxEnergyDeposit(fEdepCmd->GetNewDou    189     h->SetMaxEnergyDeposit(fEdepCmd->GetNewDoubleValue(newValue));
201   }                                            << 190   } else if( command == fBCCmd ) {
202   else if (command == fBCCmd) {                << 
203     G4HadronicParameters::Instance()->SetEnabl    191     G4HadronicParameters::Instance()->SetEnableBCParticles(fBCCmd->GetNewBoolValue(newValue));
204   }                                            << 192   } else if( command == fHNCmd ) {
205   else if (command == fHNCmd) {                << 
206     G4HadronicParameters::Instance()->SetEnabl    193     G4HadronicParameters::Instance()->SetEnableHyperNuclei(fHNCmd->GetNewBoolValue(newValue));
207   }                                            << 194   } else if( command == fNGPCmd ) {
208   else if (command == fNGPCmd) {               << 195     G4HadronicParameters::Instance()->SetEnableNeutronGeneralProcess(fNGPCmd->GetNewBoolValue(newValue));
209     G4HadronicParameters::Instance()->SetEnabl << 
210       fNGPCmd->GetNewBoolValue(newValue));     << 
211   }                                               196   }
212 }                                                 197 }
213                                                   198 
214 //....oooOO0OOooo........oooOO0OOooo........oo    199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 200 
215                                                   201