Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+20 -8
View File
@@ -49,6 +49,8 @@
#include <iostream>
#include <sstream>
#include "G4UIcommand.hh"
class G4String;
namespace CLHEP {
class Hep3Vector;
@@ -156,14 +158,14 @@ private:
}
/** ToString */
virtual std::string ToString() const {
std::stringstream s;
s << fRef;
return s.str();
std::stringstream ss;
ss << fRef;
return ss.str();
}
/** FromString */
virtual void FromString(const std::string& val) {
std::stringstream s(val);
s >> fRef;
std::stringstream ss(val);
ss >> fRef;
}
/** representation */
ValueType& fRef;
@@ -178,9 +180,19 @@ private:
* Specializations
*/
template<> void G4AnyType::Ref<bool>::FromString(const std::string& val);
template<> void G4AnyType::Ref<G4String>::FromString(const std::string& val);
template<> void G4AnyType::Ref<CLHEP::Hep3Vector>::FromString(const std::string& val);
template <> inline void G4AnyType::Ref<bool>::FromString(const std::string& val) {
fRef = G4UIcommand::ConvertToBool(val.c_str());
}
template <> inline void G4AnyType::Ref<G4String>::FromString(const std::string& val) {
if (val[0] == '"' ) fRef = val.substr(1,val.size()-2);
else fRef = val;
}
template <> inline void G4AnyType::Ref<G4ThreeVector>::FromString(const std::string& val) {
fRef = G4UIcommand::ConvertTo3Vector(val.c_str());
}
/**
* @class G4BadAnyCast G4AnyType.h Reflex/G4AnyType.h
@@ -91,10 +91,12 @@ public:
};
///Declare Methods
//Command& DeclarePropertyWithUnit(const G4String& name, const G4Any& variable, const G4String& unit, const G4String& doc = "");
Command& DeclareProperty(const G4String& name, const G4AnyType& variable, const G4String& doc = "");
Command& DeclarePropertyWithUnit
(const G4String& name, const G4String& defaultUnit, const G4AnyType& variable, const G4String& doc = "");
Command& DeclareMethod(const G4String& name, const G4AnyMethod& fun, const G4String& doc = "");
//Command& DeclareMethodWithUnit(const G4String& name, const G4AnyFunc& fun, const G4String& unit, const G4String& doc = "");
Command& DeclareMethodWithUnit
(const G4String& name, const G4String& defaultUnit, const G4AnyMethod& fun, const G4String& doc = "");
void SetDirectory(const G4String& dir) {directory = dir;}
void SetGuidance(const G4String& s);
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4LocalThreadCoutMessenger.hh 66241 2012-12-13 18:34:42Z gunter $
//
// class description
//
// This class is the messenger for handling cout/cerr of local thread
//
#ifndef G4LocalThreadCoutMessenger_h
#define G4LocalThreadCoutMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4LocalThreadCoutMessenger: public G4UImessenger
{
public:
G4LocalThreadCoutMessenger();
~G4LocalThreadCoutMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
G4UIdirectory* coutDir;
G4UIcommand* coutFileNameCmd;
G4UIcommand* cerrFileNameCmd;
G4UIcmdWithABool* bufferCoutCmd;
G4UIcmdWithAString* prefixCmd;
G4UIcmdWithAnInteger* ignoreCmd;
};
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIaliasList.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
#ifndef G4UIaliasList_h
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4UIbatch.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
// ====================================================================
// G4UIbatch.hh
+80
View File
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: G4UIbridge.hh 66241 2012-12-13 18:34:42Z gunter $
//
// ====================================================================
// G4UIbridge.hh
//
// This is a concrete class of G4UIsession.
//
// This class object is instantiated by G4UImanager at every time
// when "/control/execute macro_file" command is executed.
// Also in the case of pure batch mode with a macro file,
// this class can be used as other ordinary G4UIsession
// concrete classes, i.e. SessionStart() is invoked in main().
// ====================================================================
#ifndef G4UIbridge_H
#define G4UIbridge_H 1
class G4UImanager;
#include "globals.hh"
// ====================================================================
//
// class definition
//
// G4UIbridge:
// To be used for MT mode.
// Register a particular thread-local G4UImanager with a UI command
// directory name. When a UI command is issued in the master thread
// that starts with this redistered directory name, it is immediately
// forwarded to the registered G4UImanager. Such forwarded command
// is not processed in the master thread nor other worker thread.
//
// ====================================================================
class G4UIbridge
{
public:
G4UIbridge(G4UImanager* localUI,G4String dir);
~G4UIbridge();
G4int ApplyCommand(const G4String& aCmd);
private:
G4UImanager* localUImanager;
G4String dirName;
public:
inline G4UImanager* LocalUI() const
{ return localUImanager; }
inline G4String DirName() const
{ return dirName; }
inline G4int DirLength() const
{ return dirName.length(); }
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWith3Vector.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWith3VectorAndUnit.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithABool.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithADouble.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithADoubleAndUnit.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithAString.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithAnInteger.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcmdWithoutParameter.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
+26 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcommand.hh 77563 2013-11-26 09:03:18Z gcosmo $
//
//
@@ -53,9 +53,14 @@ class G4UIcommand
public:
G4UIcommand();
public: // with description
G4UIcommand(const char * theCommandPath, G4UImessenger * theMessenger);
G4UIcommand(const char * theCommandPath, G4UImessenger * theMessenger,
G4bool tBB = true);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given.
// If tBB is set to false, this command won't be sent to worker threads.
// This tBB parameter could be changed with SetToBeBroadcasted() method
// except for G4UIdirectory.
public:
virtual ~G4UIcommand();
@@ -170,6 +175,25 @@ class G4UIcommand
{ return commandGuidance[0]; }
}
protected:
G4bool toBeBroadcasted;
G4bool toBeFlushed;
G4bool workerThreadOnly;
public:
inline void SetToBeBroadcasted(G4bool val)
{ toBeBroadcasted = val; }
inline G4bool ToBeBroadcasted() const
{ return toBeBroadcasted; }
inline void SetToBeFlushed(G4bool val)
{ toBeFlushed = val; }
inline G4bool ToBeFlushed() const
{ return toBeFlushed; }
inline void SetWorkerThreadOnly(G4bool val=true)
{ workerThreadOnly = val; }
inline G4bool IsWorkerThreadOnly() const
{ return workerThreadOnly; }
protected:
G4int CheckNewValue(const char* newValue);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcommandStatus.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
#ifndef G4UIcommandStatus_h
+4 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcommandTree.hh 77651 2013-11-27 08:47:55Z gcosmo $
//
#ifndef G4UIcommandTree_h
@@ -51,8 +51,8 @@ class G4UIcommandTree
G4int operator!=(const G4UIcommandTree &right) const;
public:
void AddNewCommand(G4UIcommand * newCommand);
void RemoveCommand(G4UIcommand * aCommand);
void AddNewCommand(G4UIcommand * newCommand, G4bool workerThreadOnly=false);
void RemoveCommand(G4UIcommand * aCommand, G4bool workerThreadOnly=false);
G4UIcommand* FindPath(const char* commandPath) const;
G4UIcommandTree* FindCommandTree(const char* commandPath);
G4String CompleteCommandPath(const G4String& commandPath);
@@ -73,6 +73,7 @@ class G4UIcommandTree
std::vector<G4UIcommandTree*> tree;
G4UIcommand *guidance;
G4String pathName;
G4bool broadcastCommands;
public:
inline const G4UIcommand * GetGuidance() const
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcontrolMessenger.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
#ifndef G4UIcontrolMessenger_h
+3 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIdirectory.hh 74098 2013-09-22 16:05:49Z gcosmo $
//
//
@@ -41,8 +41,8 @@
class G4UIdirectory : public G4UIcommand
{
public: // with description
G4UIdirectory(char * theCommandPath);
G4UIdirectory(const char * theCommandPath);
G4UIdirectory(char * theCommandPath,G4bool commandsToBeBroadcasted = true);
G4UIdirectory(const char * theCommandPath,G4bool commandsToBeBroadcasted = true);
// Constructors. The argument is a full path directory which
// starts and ends with "/".
};
+50 -10
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UImanager.hh 77651 2013-11-27 08:47:55Z gcosmo $
//
#ifndef G4UImanager_h
@@ -41,7 +41,10 @@ class G4UIcommand;
class G4UIsession;
class G4UIcontrolMessenger;
class G4UnitsMessenger;
class G4LocalThreadCoutMessenger;
class G4UIaliasList;
class G4MTcoutDestination;
class G4UIbridge;
// class description:
//
@@ -54,6 +57,7 @@ class G4UImanager : public G4VStateDependent
{
public: // with description
static G4UImanager * GetUIpointer();
static G4UImanager * GetMasterUIpointer();
// A static method to get the pointer to the only existing object
// of this class.
@@ -118,6 +122,9 @@ class G4UImanager : public G4VStateDependent
void CreateHTML(const char* dir = "/");
// Generate HTML files for defined UI commands
private:
void AddWorkerCommand(G4UIcommand * newCommand);
void RemoveWorkerCommand(G4UIcommand * aCommand);
public:
void LoopS(const char* valueList);
@@ -138,13 +145,15 @@ class G4UImanager : public G4VStateDependent
// void Interact(const char * promptCharacters);
private:
static G4UImanager * fUImanager;
static G4bool fUImanagerHasBeenKilled;
static G4ThreadLocal G4UImanager * fUImanager;
static G4ThreadLocal G4bool fUImanagerHasBeenKilled;
static G4UImanager * fMasterUImanager;
G4UIcommandTree * treeTop;
G4UIsession * session;
G4UIsession * g4UIWindow;
G4UIcontrolMessenger * UImessenger;
G4UnitsMessenger * UnitsMessenger;
G4LocalThreadCoutMessenger * CoutMessenger;
G4String savedParameters;
G4UIcommand * savedCommand;
G4int verboseLevel;
@@ -238,14 +247,45 @@ class G4UImanager : public G4VStateDependent
void ParseMacroSearchPath();
G4String FindMacroPath(const G4String& fname) const;
// Old methods kept for backward compatibility
// inline G4UIcommandTree * GetTree() const
// { return treeTop; };
// inline G4UIsession * GetSession() const
// { return session; };
// inline void SetSession(G4UIsession *const value)
// { session = value; };
private:
G4bool isMaster;
std::vector<G4UIbridge*>* bridges;
G4bool ignoreCmdNotFound;
G4bool stackCommandsForBroadcast;
std::vector<G4String>* commandStack;
public:
inline void SetMasterUIManager(G4bool val)
{
isMaster = val;
//ignoreCmdNotFound = val;
stackCommandsForBroadcast = val;
if(val&&!bridges)
{
bridges = new std::vector<G4UIbridge*>;
fMasterUImanager = this;
}
}
inline void SetIgnoreCmdNotFound(G4bool val)
{ ignoreCmdNotFound = val; }
std::vector<G4String>* GetCommandStack();
void RegisterBridge(G4UIbridge* brg);
public:
void SetUpForAThread(G4int tId);
private:
G4int threadID;
G4MTcoutDestination* threadCout;
static G4int igThreadID;
public:
void SetCoutFileName(const G4String& fileN = "G4cout.txt", G4bool ifAppend = true);
void SetCerrFileName(const G4String& fileN = "G4cerr.txt", G4bool ifAppend = true);
void SetThreadPrefixString(const G4String& s = "W");
void SetThreadUseBuffer(G4bool flg = true);
void SetThreadIgnore(G4int tid = 0);
};
#endif
+5 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UImessenger.hh 74278 2013-10-02 15:04:18Z gcosmo $
//
#ifndef G4UImessenger_h
@@ -48,7 +48,8 @@ class G4UImessenger
{
public: // with description
G4UImessenger();
G4UImessenger(const G4String& path, const G4String& dsc);
G4UImessenger(const G4String& path, const G4String& dsc,
G4bool commandsToBeBroadcasted = true);
// Constructor. In the implementation of the concrete messenger, all commands
// related to the messenger must be constructed.
virtual ~G4UImessenger();
@@ -83,7 +84,8 @@ class G4UImessenger
// shortcut way for creating directory and commands
G4UIdirectory* baseDir; // used if new object is created
G4String baseDirName; // used if dir already exists
void CreateDirectory(const G4String& path, const G4String& dsc);
void CreateDirectory(const G4String& path, const G4String& dsc,
G4bool commandsToBeBroadcasted=true);
template <typename T> T* CreateCommand(const G4String& cname,
const G4String& dsc);
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIparameter.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
// ---------------------------------------------------------------------
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIsession.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
// $id$
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UItokenNum.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
// G4UItokenNum.hh
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UnitsMessenger.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
// class description
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VFlavoredParallelWorld.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
// Abstract interface for GEANT4 Flavored Parallel World.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VGlobalFastSimulationManager.hh 67965 2013-03-13 09:35:29Z gcosmo $
//
//
// Abstract interface for GEANT4 Global Fast Simulation Manager.
@@ -54,6 +54,7 @@
#ifndef G4VGLOBALFASTSIMULATIONMANAGER_HH
#define G4VGLOBALFASTSIMULATIONMANAGER_HH
#include "G4Types.hh"
class G4VFlavoredParallelWorld;
class G4ParticleDefinition;
@@ -78,7 +79,7 @@ protected:
static void SetConcreteInstance (G4VGlobalFastSimulationManager*);
// Sets the pointer to actual Global Fast Simulation manager.
static G4VGlobalFastSimulationManager* fpConcreteInstance;
static G4ThreadLocal G4VGlobalFastSimulationManager* fpConcreteInstance;
// Pointer to real G4GlobalFastSimulationManager.
};