Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4LocalThreadCoutMessenger
//
// Class description
//
// This class is the messenger for handling cout/cerr of a local thread
// Author: M.Asai, 2013
// --------------------------------------------------------------------
#ifndef G4LocalThreadCoutMessenger_hh
#define G4LocalThreadCoutMessenger_hh 1
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4LocalThreadCoutMessenger : public G4UImessenger
{
public:
G4LocalThreadCoutMessenger();
~G4LocalThreadCoutMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
G4UIdirectory* coutDir = nullptr;
G4UIcommand* coutFileNameCmd = nullptr;
G4UIcommand* cerrFileNameCmd = nullptr;
G4UIcmdWithABool* bufferCoutCmd = nullptr;
G4UIcmdWithAString* prefixCmd = nullptr;
G4UIcmdWithAnInteger* ignoreCmd = nullptr;
G4UIcmdWithABool* ignoreInitCmd = nullptr;
};
#endif
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ProfilerMessenger
//
// Class description
//
// This class is the messenger of the class which maintain the profiling
// controls (located in global/management/include/G4Profiler.hh).
// In general, it forwards to the argument parser provided by timemory.
// Author: J.Madsen, 12 November 2020
// --------------------------------------------------------------------
#ifndef G4ProfilerMessenger_hh
#define G4ProfilerMessenger_hh 1
#include "G4Profiler.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4ProfilerMessenger : public G4UImessenger
{
public:
G4ProfilerMessenger();
~G4ProfilerMessenger() override;
G4ProfilerMessenger(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger& operator=(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger(G4ProfilerMessenger&&) = default;
G4ProfilerMessenger& operator=(G4ProfilerMessenger&&) = default;
void SetNewValue(G4UIcommand*, G4String) override;
private:
using stringcmd_pair = std::pair<G4UIcmdWithAString*, std::string>;
using boolcmd_pair = std::pair<G4UIcmdWithABool*, std::string>;
using directory_array = std::array<G4UIdirectory*, G4ProfileType::TypeEnd>;
using stringcmd_array = std::array<stringcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_array = std::array<boolcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_vector = std::vector<boolcmd_pair>;
G4UIdirectory* profileDirectory;
G4UIdirectory* profileOutputDirectory;
directory_array profileTypeDirs;
boolcmd_array profileEnableCmds;
boolcmd_vector profileGeneralCmds;
stringcmd_array profileCompCmds;
};
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4UIaliasList
//
// Class description:
//
// This class is exclusively used by G4UImanager for handling the
// alias list.
// Author: M.Asai, 1 October 2001
// --------------------------------------------------------------------
#ifndef G4UIaliasList_hh
#define G4UIaliasList_hh 1
#include "globals.hh"
#include <map>
class G4UIaliasList
{
public:
// Add or update alias from aliasName to command path aliasValue
void ChangeAlias(const char* aliasName, const char* aliasValue);
// Remove aliasName from list of aliases.
void RemoveAlias(const char* aliasName);
// Return command corresponding to alias, or nullptr if alias does not exist.
// Ownership of the pointer is retained by G4UIaliasList.
const G4String* FindAlias(const char* aliasName) const;
// Print alias : command pairs to G4cout
void List() const;
private:
// Adds a new alias/value pair to the map
void AddNewAlias(const char* aliasName, const char* aliasValue);
std::map<G4String, G4String> aliases;
};
#endif
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4UIcontrolMessenger
//
// Class description:
//
// This class is a concrete class of G4UImessenger which defines
// commands affecting to the G4UImanager. Commands defined by
// this messenger are:
// /control/
// /control/macroPath
// /control/execute
// /control/loop
// /control/foreach
// /control/suppressAbortion
// /control/verbose
// /control/useDoublePrecision
// /control/saveHistory
// /control/stopSavingHistory
// /control/alias
// /control/unalias
// /control/listAlias
// /control/getEnv
// /control/getVal
// /control/echo
// /control/shell
// /control/manual
// /control/createHTML
// /control/maximumStoredHistory
// /control/if
// /control/doif
// /control/add
// /control/subtract
// /control/multiply
// /control/divide
// /control/strif
// /control/strdoif
// /control/ifBatch
// /control/ifInteractive
// /control/doifBatch
// /control/doifInteractive
// Author: Makoto Asai, SLAC - 2001
// --------------------------------------------------------------------
#ifndef G4UIcontrolMessenger_hh
#define G4UIcontrolMessenger_hh 1
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithoutParameter;
class G4UIcommand;
class G4UIcontrolMessenger : public G4UImessenger
{
public:
G4UIcontrolMessenger();
~G4UIcontrolMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValue) override;
G4String GetCurrentValue(G4UIcommand* command) override;
private:
G4UIdirectory* controlDirectory = nullptr;
G4UIcmdWithAString* macroPathCommand = nullptr;
G4UIcmdWithAString* ExecuteCommand = nullptr;
G4UIcmdWithAnInteger* suppressAbortionCommand = nullptr;
G4UIcmdWithAnInteger* verboseCommand = nullptr;
G4UIcmdWithABool* doublePrecCommand = nullptr;
G4UIcmdWithAString* historyCommand = nullptr;
G4UIcmdWithoutParameter* stopStoreHistoryCommand = nullptr;
G4UIcommand* aliasCommand = nullptr;
G4UIcmdWithAString* unaliasCommand = nullptr;
G4UIcmdWithoutParameter* listAliasCommand = nullptr;
G4UIcmdWithAString* getEnvCmd = nullptr;
G4UIcommand* getValCmd = nullptr;
G4UIcmdWithAString* echoCmd = nullptr;
G4UIcmdWithAString* shellCommand = nullptr;
G4UIcommand* loopCommand = nullptr;
G4UIcommand* foreachCommand = nullptr;
G4UIcmdWithAString* ManualCommand = nullptr;
G4UIcmdWithAString* HTMLCommand = nullptr;
G4UIcmdWithAnInteger* maxStoredHistCommand = nullptr;
G4UIcommand* ifCommand = nullptr;
G4UIcommand* doifCommand = nullptr;
G4UIcommand* addCommand = nullptr;
G4UIcommand* subtractCommand = nullptr;
G4UIcommand* multiplyCommand = nullptr;
G4UIcommand* divideCommand = nullptr;
G4UIcommand* remainderCommand = nullptr;
G4UIcommand* strifCommand = nullptr;
G4UIcommand* strdoifCommand = nullptr;
G4UIcmdWithAString* ifBatchCommand = nullptr;
G4UIcmdWithAString* ifInteractiveCommand = nullptr;
G4UIcmdWithAString* doifBatchCommand = nullptr;
G4UIcmdWithAString* doifInteractiveCommand = nullptr;
};
#endif
@@ -0,0 +1,292 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4UIparsing
//
// Utilities for parsing/checking inputs in G4UIparameter/G4UIcommand
#ifndef G4UIparsing_hh
#define G4UIparsing_hh 1
#include "G4UItokenNum.hh"
#include "globals.hh"
#include <cctype>
namespace G4UIparsing
{
// Convert G4String to value of type T
template<typename T>
inline T StoT(const G4String& s)
{
T vl;
std::istringstream is(s);
is >> vl;
return vl;
}
// Convert value of type T to G4String
template<typename T>
inline G4String TtoS(T value)
{
std::ostringstream os;
os << value;
return os.str();
}
// Return true if `str` parses to an integral number no more than `maxDigit` digits
inline G4bool IsInt(const char* str, short maxDigits)
{
const char* p = str;
G4int length = 0;
if (*p == '+' || *p == '-') {
++p;
}
if (isdigit((G4int)(*p)) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
++length;
}
if (*p == '\0') {
if (length > maxDigits) {
G4cerr << "digit length exceeds" << G4endl;
return false;
}
return true;
}
}
return false;
}
// Return true if `str` parses to an exponent
//
// A valid exponent is an integer of no more than 7 digits
inline G4bool ExpectExponent(const char* str)
{
return IsInt(str, 7);
}
inline G4bool IsDouble(const char* str)
{
const char* p = str;
switch (*p) {
case '+':
case '-':
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
switch (*p) {
case '\0':
return true; // break;
case 'E':
case 'e':
return ExpectExponent(++p); // break;
case '.':
++p;
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
else {
return false;
}
break;
default:
return false;
}
}
if (*p == '.') {
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
}
break;
case '.':
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
break;
default: // digit is expected
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (*p == '.') {
++p;
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
}
}
}
return false;
}
// --------------------------------------------------------------------
inline G4int CompareInt(G4int arg1, G4int op, G4int arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareInt" << G4endl;
errCode = 1;
}
return result;
}
// --------------------------------------------------------------------
inline G4int CompareLong(G4long arg1, G4int op, G4long arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareInt" << G4endl;
errCode = 1;
}
return result;
}
// --------------------------------------------------------------------
inline G4int CompareDouble(G4double arg1, G4int op, G4double arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareDouble" << G4endl;
errCode = 1;
}
return result;
}
} // namespace G4UIparsing
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4UnitsMessenger
//
// Class description
//
// This class is the messenger for the table of units G4UnitsTable.
// It contains the commands to interact with the table of Units
// Author: Michel Maire, 1998
// --------------------------------------------------------------------
#ifndef G4UnitsMessenger_hh
#define G4UnitsMessenger_hh 1
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UnitsMessenger : public G4UImessenger
{
public:
G4UnitsMessenger();
~G4UnitsMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
G4UIdirectory* UnitsTableDir = nullptr;
G4UIcmdWithoutParameter* ListCmd = nullptr;
};
#endif