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.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 /materials/src/G4NistMessenger.cc (Version 11.3.0) and /materials/src/G4NistMessenger.cc (Version 8.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 //
                                                   >>  27 // $Id: G4NistMessenger.cc,v 1.2 2006/06/29 19:13:05 gunter Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-02 $
                                                   >>  29 //
                                                   >>  30 //
 26 // File name:     G4NistMessenger                  31 // File name:     G4NistMessenger
 27 //                                                 32 //
 28 // Author:        Vladimir Ivanchenko              33 // Author:        Vladimir Ivanchenko
 29 //                                                 34 //
 30 // Creation date: 23.12.2004                       35 // Creation date: 23.12.2004
 31 //                                                 36 //
 32 // Modifications:                                  37 // Modifications:
 33 //                                                 38 //
 34 //                                                 39 //
 35 // -------------------------------------------     40 // -------------------------------------------------------------------
                                                   >>  41 //
                                                   >>  42 
                                                   >>  43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >>  44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 36                                                    45 
 37 #include "G4NistMessenger.hh"                      46 #include "G4NistMessenger.hh"
 38                                                    47 
 39 #include "G4ApplicationState.hh"               << 
 40 #include "G4DensityEffectData.hh"              << 
 41 #include "G4IonisParamMat.hh"                  << 
 42 #include "G4NistManager.hh"                        48 #include "G4NistManager.hh"
 43 #include "G4UIcmdWithAString.hh"               << 
 44 #include "G4UIcmdWithAnInteger.hh"             << 
 45 #include "G4UIdirectory.hh"                    << 
 46 #include "G4UIcommand.hh"                      << 
 47 #include "G4UIparameter.hh"                    << 
 48                                                    49 
 49 #include <sstream>                             <<  50 #include "G4UIdirectory.hh"
                                                   >>  51 #include "G4UIcmdWithAnInteger.hh"
                                                   >>  52 #include "G4UIcmdWithAString.hh"
 50                                                    53 
 51 //....oooOO0OOooo........oooOO0OOooo........oo     54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 52                                                    55 
 53 G4NistMessenger::G4NistMessenger(G4NistManager <<  56 G4NistMessenger::G4NistMessenger(G4NistManager* man)
                                                   >>  57 :manager(man)
 54 {                                                  58 {
 55   matDir = new G4UIdirectory("/material/");        59   matDir = new G4UIdirectory("/material/");
 56   matDir->SetGuidance("Commands for materials" <<  60   matDir->SetGuidance("Commands for Materials");
 57                                                <<  61   
 58   verCmd = new G4UIcmdWithAnInteger("/material <<  62   verCmd = new G4UIcmdWithAnInteger("/material/verbose",this);
 59   verCmd->SetGuidance("Set verbose level.");       63   verCmd->SetGuidance("Set verbose level.");
 60   verCmd->AvailableForStates(G4State_PreInit,  <<  64   
 61   verCmd->SetToBeBroadcasted(false);           << 
 62                                                << 
 63   nistDir = new G4UIdirectory("/material/nist/     65   nistDir = new G4UIdirectory("/material/nist/");
 64   nistDir->SetGuidance("Commands for the nist      66   nistDir->SetGuidance("Commands for the nist dataBase");
 65                                                <<  67     
 66   prtElmCmd = new G4UIcmdWithAString("/materia <<  68   prtElmCmd = new G4UIcmdWithAString("/material/nist/printElement",this);
 67   prtElmCmd->SetGuidance("print element(s) in      69   prtElmCmd->SetGuidance("print element(s) in dataBase.");
 68   prtElmCmd->SetGuidance("symbol = element.");     70   prtElmCmd->SetGuidance("symbol = element.");
 69   prtElmCmd->SetGuidance("all    = all element     71   prtElmCmd->SetGuidance("all    = all elements.");
                                                   >>  72   prtElmCmd->SetGuidance("verbose>1 : list associated isotopes.");  
 70   prtElmCmd->SetParameterName("symbol", true);     73   prtElmCmd->SetParameterName("symbol", true);
 71   prtElmCmd->SetDefaultValue("all");               74   prtElmCmd->SetDefaultValue("all");
 72   prtElmCmd->AvailableForStates(G4State_PreIni <<  75   
 73   prtElmCmd->SetToBeBroadcasted(false);        <<  76   przElmCmd = new G4UIcmdWithAnInteger("/material/nist/printElementZ",this);
 74                                                << 
 75   przElmCmd = new G4UIcmdWithAnInteger("/mater << 
 76   przElmCmd->SetGuidance("print element Z in d     77   przElmCmd->SetGuidance("print element Z in dataBase.");
 77   przElmCmd->SetGuidance("0 = all elements."); <<  78   przElmCmd->SetGuidance("verbose>1 : list associated isotopes.");
 78   przElmCmd->SetParameterName("Z", true);      <<  79    
 79   przElmCmd->SetDefaultValue(0);               <<  80   lisMatCmd = new G4UIcmdWithAString("/material/nist/listMaterials",this);
 80   przElmCmd->SetRange("0<=Z && Z<108");        <<  81   lisMatCmd->SetGuidance("list materials in dataBase.");
 81   przElmCmd->AvailableForStates(G4State_PreIni <<  82   lisMatCmd->SetGuidance("simple = simple nist materials.");
 82   przElmCmd->SetToBeBroadcasted(false);        <<  83   lisMatCmd->SetGuidance("compound = compound nist materials.");
 83                                                <<  84   lisMatCmd->SetGuidance("hep = hep materials.");
 84   lisMatCmd = new G4UIcmdWithAString("/materia <<  85   lisMatCmd->SetGuidance("all = all materials.");
 85   lisMatCmd->SetGuidance("Materials in Geant4  <<  86   lisMatCmd->SetParameterName("list", true);
 86   lisMatCmd->SetGuidance("simple - simple NIST <<  87   lisMatCmd->SetCandidates("simple compound hep all");
 87   lisMatCmd->SetGuidance("compound - compound  << 
 88   lisMatCmd->SetGuidance("hep - HEP materials. << 
 89   lisMatCmd->SetGuidance("bio - biomedical mat << 
 90   lisMatCmd->SetGuidance("all - list of all Ge << 
 91   lisMatCmd->SetParameterName("matlist", true) << 
 92   // lisMatCmd->SetCandidates("simple compound << 
 93   lisMatCmd->SetDefaultValue("all");               88   lisMatCmd->SetDefaultValue("all");
 94   lisMatCmd->AvailableForStates(G4State_PreIni <<  89   
 95   lisMatCmd->SetToBeBroadcasted(false);        << 
 96                                                << 
 97   g4Dir = new G4UIdirectory("/material/g4/");      90   g4Dir = new G4UIdirectory("/material/g4/");
 98   g4Dir->SetGuidance("Commands for G4MaterialT     91   g4Dir->SetGuidance("Commands for G4MaterialTable");
 99                                                <<  92   
100   g4ElmCmd = new G4UIcmdWithAString("/material <<  93   g4ElmCmd = new G4UIcmdWithAString("/material/g4/printElement",this);
101   g4ElmCmd->SetGuidance("print Element from G4 <<  94   g4ElmCmd->SetGuidance("print Element in G4ElementTable.");
102   g4ElmCmd->SetGuidance("all - all elements.") <<  95     
103   g4ElmCmd->SetParameterName("elm", true);     <<  96   g4MatCmd = new G4UIcmdWithAString("/material/g4/printMaterial",this);
104   g4ElmCmd->SetDefaultValue("all");            <<  97   g4MatCmd->SetGuidance("print Material in G4MaterialTable.");
105                                                <<  98             
106   g4MatCmd = new G4UIcmdWithAString("/material << 
107   g4MatCmd->SetGuidance("print Material from G << 
108   g4MatCmd->SetGuidance("all - all materials") << 
109   g4MatCmd->SetParameterName("pmat", true);    << 
110   g4MatCmd->SetDefaultValue("all");            << 
111   g4MatCmd->AvailableForStates(G4State_PreInit << 
112   g4MatCmd->SetToBeBroadcasted(false);         << 
113                                                << 
114   g4DensCmd = new G4UIcmdWithAString("/materia << 
115   g4DensCmd->SetGuidance("print Material from  << 
116   g4DensCmd->SetGuidance("all - all materials" << 
117   g4DensCmd->SetParameterName("dmat", true);   << 
118   g4DensCmd->SetDefaultValue("all");           << 
119   g4DensCmd->AvailableForStates(G4State_PreIni << 
120   g4DensCmd->SetToBeBroadcasted(false);        << 
121                                                << 
122   densCmd = new G4UIcmdWithAString("/material/ << 
123   densCmd->SetGuidance("enable accurate comput << 
124   densCmd->SetGuidance("all - all materials.") << 
125   densCmd->SetParameterName("dens", true);     << 
126   densCmd->SetDefaultValue("all");             << 
127   densCmd->AvailableForStates(G4State_PreInit) << 
128   lisMatCmd->SetToBeBroadcasted(false);        << 
129                                                << 
130   adensCmd = new G4UIcmdWithAString("/material << 
131   adensCmd->SetGuidance("disable accurate comp << 
132   adensCmd->SetGuidance("all - all materials." << 
133   adensCmd->SetParameterName("dens", true);    << 
134   adensCmd->SetDefaultValue("all");            << 
135   adensCmd->AvailableForStates(G4State_PreInit << 
136   adensCmd->SetToBeBroadcasted(false);         << 
137                                                << 
138   fPosiCmd = new G4UIcommand("/material/g4/ort << 
139   fPosiCmd->SetGuidance("defined orto-positron << 
140   fPosiCmd->SetGuidance("via material name, al << 
141   fPosiCmd->AvailableForStates(G4State_PreInit << 
142   fPosiCmd->SetToBeBroadcasted(false);         << 
143                                                << 
144   auto p1 = new G4UIparameter("matname",'s', f << 
145   fPosiCmd->SetParameter(p1);                  << 
146                                                << 
147   auto p2 = new G4UIparameter("fraction", 'd', << 
148   p2->SetParameterRange("fraction>=0. && fract << 
149   fPosiCmd->SetParameter(p2);                  << 
150 }                                                  99 }
151                                                   100 
152 //....oooOO0OOooo........oooOO0OOooo........oo    101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153                                                   102 
154 G4NistMessenger::~G4NistMessenger()               103 G4NistMessenger::~G4NistMessenger()
155 {                                                 104 {
156   delete verCmd;                               << 105   delete verCmd;  
157   delete prtElmCmd;                               106   delete prtElmCmd;
158   delete przElmCmd;                               107   delete przElmCmd;
159   delete lisMatCmd;                               108   delete lisMatCmd;
160   delete nistDir;                                 109   delete nistDir;
161                                                << 
162   delete g4ElmCmd;                             << 
163   delete g4MatCmd;                             << 
164   delete g4DensCmd;                            << 
165   delete densCmd;                              << 
166   delete adensCmd;                             << 
167   delete fPosiCmd;                             << 
168                                                   110   
                                                   >> 111   delete g4ElmCmd;   
                                                   >> 112   delete g4MatCmd;  
169   delete g4Dir;                                   113   delete g4Dir;
170   delete matDir;                               << 114   delete matDir;  
171 }                                                 115 }
172                                                   116 
173 //....oooOO0OOooo........oooOO0OOooo........oo    117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
174                                                   118 
175 void G4NistMessenger::SetNewValue(G4UIcommand*    119 void G4NistMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
176 {                                                 120 {
177   // G4cout << "G4NistMessenger::SetNewValue < << 121   if (command == verCmd) 
178   if (command == verCmd) {                     << 122    { manager->SetVerbose(verCmd->GetNewIntValue(newValue));}
179     manager->SetVerbose(verCmd->GetNewIntValue << 123     
180   }                                            << 124   if (command == prtElmCmd)
181   else if (command == prtElmCmd) {             << 125    { manager->PrintElement(newValue);}
182     manager->PrintElement(newValue);           << 126     
183   }                                            << 127   if (command == przElmCmd)
184   else if (command == przElmCmd) {             << 128    { manager->PrintElement(przElmCmd->GetNewIntValue(newValue));}
185     G4int Z = przElmCmd->GetNewIntValue(newVal << 129    
186     if (Z >= 0 && Z < 108) {                   << 130   if (command == lisMatCmd) 
187       manager->PrintElement(Z);                << 131    { manager->ListMaterials(newValue);}
188     }                                          << 132 
189   }                                            << 133   if (command == g4ElmCmd)
190   else if (command == lisMatCmd) {             << 134    { manager->PrintG4Element(newValue);}
191     manager->ListMaterials(newValue);          << 135    
192   }                                            << 136   if (command == g4MatCmd)
193   else if (command == g4ElmCmd) {              << 137    { manager->PrintG4Material(newValue);}
194     manager->PrintG4Element(newValue);         << 
195   }                                            << 
196   else if (command == g4MatCmd) {              << 
197     manager->PrintG4Material(newValue);        << 
198   }                                            << 
199   else if (command == g4DensCmd) {             << 
200     G4IonisParamMat::GetDensityEffectData()->P << 
201   }                                            << 
202   else if (command == densCmd) {               << 
203     manager->SetDensityEffectCalculatorFlag(ne << 
204   }                                            << 
205   else if (command == adensCmd) {              << 
206     manager->SetDensityEffectCalculatorFlag(ne << 
207   }                                            << 
208   else if (command == fPosiCmd) {              << 
209     G4String mnam{""};                         << 
210     G4double f{0.0};                           << 
211     std::istringstream ss(newValue);           << 
212     ss >> mnam >> f;                           << 
213     // set fraction for all materials          << 
214     if (mnam == "all" || mnam == "none") {     << 
215       if (mnam == "none" || f < 0.0) { f = 0.0 << 
216       auto mtable = G4Material::GetMaterialTab << 
217       for ( auto const & mat : *mtable ) {     << 
218   mat->GetIonisation()->SetOrtoPositroniumFrac << 
219       }                                        << 
220     } else {                                   << 
221       // set fraction for one material         << 
222       auto mat = manager->FindOrBuildMaterial( << 
223       if (nullptr != mat) {                    << 
224   mat->GetIonisation()->SetOrtoPositroniumFrac << 
225       }                                        << 
226     }                                          << 
227   }                                            << 
228 }                                                 138 }
                                                   >> 139 
                                                   >> 140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
229                                                   141