Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -23,46 +23,31 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbDetectorBuilder
// G4tgbDetectorBuilder
//
// Class description:
//
// Builder of transient detector.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbDetectorBuilder_hh
#define G4tgbDetectorBuilder_hh
#define G4tgbDetectorBuilder_hh 1
#include "globals.hh"
#include <string>
#include <vector>
#include <map>
#include "G4VSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
class G4tgbVolume;
class G4tgrVolume;
//--------------------------------------------------------------------------
class G4tgbDetectorBuilder
{
public: // with description
G4tgbDetectorBuilder();
virtual ~G4tgbDetectorBuilder();
class G4tgbDetectorBuilder
{
public:
virtual const G4tgrVolume* ReadDetector();
virtual G4VPhysicalVolume* ConstructDetector( const G4tgrVolume* tgrVoltop );
G4tgbDetectorBuilder();
virtual ~G4tgbDetectorBuilder();
virtual const G4tgrVolume* ReadDetector();
virtual G4VPhysicalVolume* ConstructDetector(const G4tgrVolume* tgrVoltop);
};
#endif
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbDetectorConstruction
// G4tgbDetectorConstruction
//
// Class description:
//
@@ -34,12 +31,10 @@
// It passes to the G4RunManager the top volume in the hierarchy
// constructed in G4tgbVolumeMgr.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbDetectorConstruction_H
#define G4tgbDetectorConstruction_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbDetectorConstruction_hh
#define G4tgbDetectorConstruction_hh 1
#include "globals.hh"
@@ -47,12 +42,12 @@ class G4VPhysicalVolume;
class G4tgbDetectorConstruction
{
public: // with description
public:
G4tgbDetectorConstruction();
~G4tgbDetectorConstruction();
G4VPhysicalVolume* Construct();
G4tgbDetectorConstruction();
~G4tgbDetectorConstruction();
G4VPhysicalVolume* Construct();
};
#endif
@@ -23,60 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbElement
// G4tgbElement
//
// Class description:
//
// Transient class of a chemical element; builds a G4Element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbElement_h
#define G4tgbElement_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbElement_hh
#define G4tgbElement_hh 1
#include <vector>
#include <string>
#include "globals.hh"
#include "G4tgrElement.hh"
#include "G4Element.hh"
//--------------------------------------------------------------------------
class G4tgbElement
{
{
public:
public: // with description
G4tgbElement() {}
~G4tgbElement() {}
G4tgbElement(){}
~G4tgbElement(){}
G4tgbElement(G4tgrElement* hg);
// Construct the G4tgbElement from the corresponding HgElement
G4tgbElement( G4tgrElement* hg );
// Construct the G4tgbElement from the corresponding HgElement
G4Element* BuildG4ElementSimple();
G4Element* BuildG4ElementFromIsotopes();
// Build a G4Element out of this HElement
G4Element* BuildG4ElementSimple();
G4Element* BuildG4ElementFromIsotopes();
// Build a G4Element out of this HElement
const G4String& GetName() const
{
return theTgrElem->GetName();
}
const G4String& GetType() const
{
return theTgrElem->GetType();
}
const G4String& GetName() const { return theTgrElem->GetName(); }
const G4String& GetType() const { return theTgrElem->GetType(); }
private:
private:
G4tgrElement* theTgrElem;
G4Element* theG4Elem;
G4tgrElement* theTgrElem = nullptr;
G4Element* theG4Elem = nullptr;
};
#endif
@@ -23,27 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// class G4tgbGeometryDumper
// G4tgbGeometryDumper
//
// Class description:
//
// Class for dumping the whole geometry.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbGeometryDumper_HH
#define G4tgbGeometryDumper_HH
#include "globals.hh"
#include "G4RotationMatrix.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbGeometryDumper_hh
#define G4tgbGeometryDumper_hh 1
#include <fstream>
#include <map>
#include <vector>
#include "globals.hh"
#include "G4RotationMatrix.hh"
class G4Material;
class G4Element;
class G4Isotope;
@@ -55,70 +52,67 @@ class G4PVReplica;
class G4tgbGeometryDumper
{
public: // with description
public:
static G4tgbGeometryDumper* GetInstance();
~G4tgbGeometryDumper();
void DumpGeometry(const G4String& fname );
void DumpGeometry(const G4String& fname);
G4VPhysicalVolume* GetTopPhysVol();
void DumpPhysVol( G4VPhysicalVolume* pv );
void DumpPVPlacement( G4VPhysicalVolume* pv, const G4String& lvName,
G4int copyNo = -999 );
void DumpPVParameterised( G4PVParameterised* pv );
void DumpPVReplica( G4PVReplica* pv, const G4String& lvName );
G4String DumpLogVol( G4LogicalVolume* lv, G4String extraName = "",
G4VSolid* solid = 0, G4Material* mate = 0);
G4String DumpMaterial( G4Material* mat );
void DumpElement( G4Element* ele);
void DumpIsotope( G4Isotope* ele);
G4String DumpSolid( G4VSolid* solid, const G4String& extraName = "" );
void DumpBooleanVolume( const G4String& solidType, G4VSolid* so );
void DumpSolidParams(G4VSolid * so);
std::vector<G4double> GetSolidParams( const G4VSolid * so);
void DumpPolySections(G4int zPlanes, G4double* z,
G4double *rmin, G4double *rmax);
G4String DumpRotationMatrix( G4RotationMatrix* rotm );
void DumpPhysVol(G4VPhysicalVolume* pv);
void DumpPVPlacement(G4VPhysicalVolume* pv, const G4String& lvName,
G4int copyNo = -999);
void DumpPVParameterised(G4PVParameterised* pv);
void DumpPVReplica(G4PVReplica* pv, const G4String& lvName);
G4String DumpLogVol(G4LogicalVolume* lv, const G4String& extraName = "",
G4VSolid* solid = nullptr, G4Material* mate = nullptr);
G4String DumpMaterial(G4Material* mat);
void DumpElement(G4Element* ele);
void DumpIsotope(G4Isotope* ele);
G4String DumpSolid(G4VSolid* solid, const G4String& extraName = "");
void DumpBooleanVolume(const G4String& solidType, G4VSolid* so);
void DumpSolidParams(G4VSolid* so);
std::vector<G4double> GetSolidParams(const G4VSolid* so);
void DumpPolySections(G4int zPlanes, G4double* z, G4double* rmin,
G4double* rmax);
G4String DumpRotationMatrix(G4RotationMatrix* rotm);
private:
G4tgbGeometryDumper();
private:
std::vector<G4VPhysicalVolume*> GetPVChildren(G4LogicalVolume* lv);
G4String GetTGSolidType(const G4String& solidtype);
G4double MatDeterminant(G4RotationMatrix* ro);
G4double approxTo0(G4double val);
G4String AddQuotes(const G4String& str);
std::vector<G4VPhysicalVolume*> GetPVChildren( G4LogicalVolume* lv );
G4String GetTGSolidType( const G4String& solidtype );
G4double MatDeterminant(G4RotationMatrix * ro) ;
G4double approxTo0( G4double val );
G4String AddQuotes( const G4String& str );
G4String GetIsotopeName( G4Isotope* );
template< class TYP> G4String GetObjectName( TYP* obj,
std::map<G4String,TYP*> objectsDumped );
G4bool CheckIfLogVolExists( const G4String& name, G4LogicalVolume* pt );
G4bool CheckIfPhysVolExists( const G4String& name, G4VPhysicalVolume* );
G4String LookForExistingRotation( const G4RotationMatrix* rotm );
G4String SupressRefl( G4String name );
G4String SubstituteRefl( G4String name );
G4bool Same2G4Isotopes( G4Isotope* ele1, G4Isotope* ele2 );
const G4String& FindSolidName( G4VSolid* solid );
G4String GetIsotopeName(G4Isotope*);
template <class TYP>
G4String GetObjectName(TYP* obj, std::map<G4String, TYP*> objectsDumped);
G4bool CheckIfLogVolExists(const G4String& name, G4LogicalVolume* pt);
G4bool CheckIfPhysVolExists(const G4String& name, G4VPhysicalVolume*);
G4String LookForExistingRotation(const G4RotationMatrix* rotm);
G4String SupressRefl(G4String name);
G4String SubstituteRefl(G4String name);
G4bool Same2G4Isotopes(G4Isotope* ele1, G4Isotope* ele2);
const G4String& FindSolidName(G4VSolid* solid);
private:
static G4ThreadLocal G4tgbGeometryDumper* theInstance;
std::ofstream* theFile;
std::ofstream* theFile = nullptr;
std::map<G4String,G4Material*> theMaterials;
std::map<G4String,G4Element*> theElements;
std::map<G4String,G4Isotope*> theIsotopes;
std::map<G4String,G4VSolid*> theSolids;
std::map<G4String,G4LogicalVolume*> theLogVols;
std::map<G4String,G4VPhysicalVolume*> thePhysVols;
std::map<G4String,G4RotationMatrix*> theRotMats;
std::map<G4String, G4Material*> theMaterials;
std::map<G4String, G4Element*> theElements;
std::map<G4String, G4Isotope*> theIsotopes;
std::map<G4String, G4VSolid*> theSolids;
std::map<G4String, G4LogicalVolume*> theLogVols;
std::map<G4String, G4VPhysicalVolume*> thePhysVols;
std::map<G4String, G4RotationMatrix*> theRotMats;
G4int theRotationNumber;
G4int theRotationNumber = 0;
};
#endif
@@ -23,52 +23,41 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbIsotope
// G4tgbIsotope
//
// Class description:
//
// Transient class of an isotope; builds a G4Isotope.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbIsotope_h
#define G4tgbIsotope_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbIsotope_hh
#define G4tgbIsotope_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include "G4tgrIsotope.hh"
#include "G4Isotope.hh"
//--------------------------------------------------------------------------
class G4tgbIsotope
{
public:
public: // with description
G4tgbIsotope();
~G4tgbIsotope();
G4tgbIsotope();
~G4tgbIsotope();
G4tgbIsotope(G4tgrIsotope* hg);
// Construct the G4tgbIsotope from the corresponding HgIsotope
G4tgbIsotope( G4tgrIsotope* hg );
// Construct the G4tgbIsotope from the corresponding HgIsotope
G4Isotope* BuildG4Isotope();
// Build a G4Isotope out of this HIsotope
G4Isotope* BuildG4Isotope();
// Build a G4Isotope out of this HIsotope
const G4String& GetName() const { return theTgrIsot->GetName(); }
const G4String& GetName() const { return theTgrIsot->GetName(); }
private:
private:
G4tgrIsotope* theTgrIsot;
G4Isotope* theG4Isot;
G4tgrIsotope* theTgrIsot = nullptr;
G4Isotope* theG4Isot = nullptr;
};
#endif
@@ -23,26 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterial
// G4tgbMaterial
//
// Class description:
//
// Transient class of a material; builds a G4Material.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterial_h
#define G4tgbMaterial_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterial_hh
#define G4tgbMaterial_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include <iostream>
#include "G4tgrMaterial.hh"
@@ -51,56 +44,37 @@
class G4tgbMaterial
{
friend std::ostream& operator<<(std::ostream&, const G4tgbMaterial&);
public: // with description
public:
G4tgbMaterial();
virtual ~G4tgbMaterial();
G4tgbMaterial( G4tgrMaterial* tgr );
G4tgbMaterial(G4tgrMaterial* tgr);
virtual G4Material* BuildG4Material() = 0;
const G4String& GetName() const
{
return theTgrMate->GetName();
}
const G4String& GetName() const { return theTgrMate->GetName(); }
G4double GetDensity() const
{
return theTgrMate->GetDensity();
}
G4double GetDensity() const { return theTgrMate->GetDensity(); }
G4int GetNumberOfMaterials() const
{
return theTgrMate->GetNumberOfComponents();
}
G4double GetA() const
{
return theTgrMate->GetA();
}
G4double GetA() const { return theTgrMate->GetA(); }
G4double GetZ() const
{
return theTgrMate->GetZ();
}
G4double GetZ() const { return theTgrMate->GetZ(); }
const G4String& GetType() const
{
return theTgrMate->GetType();
}
const G4String& GetType() const { return theTgrMate->GetType(); }
G4tgrMaterial* GetTgrMate() const
{
return theTgrMate;
}
G4tgrMaterial* GetTgrMate() const { return theTgrMate; }
protected:
G4tgrMaterial* theTgrMate;
G4Material* theG4Mate;
G4tgrMaterial* theTgrMate = nullptr;
G4Material* theG4Mate = nullptr;
};
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialMgr
// G4tgbMaterialMgr
//
// Class description:
//
// Singleton class to manage the building of transient materials,
// as well as the construction of the corresponding G4Material's.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterialMgr_h
#define G4tgbMaterialMgr_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialMgr_hh
#define G4tgbMaterialMgr_hh 1
#include "globals.hh"
@@ -55,19 +50,19 @@
#include "G4Element.hh"
#include "G4Material.hh"
typedef std::map< G4String, G4tgbIsotope* > G4mstgbisot;
typedef std::map< G4String, G4tgbElement* > G4mstgbelem;
typedef std::map< G4String, G4tgbMaterial* > G4mstgbmate;
typedef std::map< G4String, G4Isotope* > G4msg4isot;
typedef std::map< G4String, G4Element* > G4msg4elem;
typedef std::map< G4String, G4Material* > G4msg4mate;
using G4mstgbisot = std::map<G4String, G4tgbIsotope*>;
using G4mstgbelem = std::map<G4String, G4tgbElement*>;
using G4mstgbmate = std::map<G4String, G4tgbMaterial*>;
using G4msg4isot = std::map<G4String, G4Isotope*>;
using G4msg4elem = std::map<G4String, G4Element*>;
using G4msg4mate = std::map<G4String, G4Material*>;
class G4tgbMaterialMgr
class G4tgbMaterialMgr
{
public: // with description
public:
~G4tgbMaterialMgr();
static G4tgbMaterialMgr* GetInstance();
// Get only instance (it it does not exists, create it)
@@ -78,45 +73,45 @@ class G4tgbMaterialMgr
void CopyMaterials();
// Copy the G4tgrMaterials into G4tgbMaterials
G4Isotope* FindOrBuildG4Isotope(const G4String & name);
G4Isotope* FindOrBuildG4Isotope(const G4String& name);
// Look for a G4Isotope that has to exists
// (if not found create it from the corresponding G4tgbIsotope)
G4Isotope* FindBuiltG4Isotope(const G4String & name) const;
// Look for a G4Isotope and if not found return 0
G4Isotope* FindBuiltG4Isotope(const G4String& name) const;
// Look for a G4Isotope and if not found return nullptr
G4tgbIsotope* FindG4tgbIsotope(const G4String& name,
G4bool bMustExist = 0) const;
// Look for a G4Isotope and if not found return 0
G4bool bMustExist = false) const;
// Look for a G4Isotope and if not found return nullptr
G4Element* FindOrBuildG4Element(const G4String & name,
G4bool bMustExist = 1);
G4Element* FindOrBuildG4Element(const G4String& name,
G4bool bMustExist = true);
// Look for a G4Element that has to exists by default
// (if not found create it from the corresponding G4tgbElement)
G4Element* FindBuiltG4Element(const G4String& name) const;
// Look for a G4Element and if not found return 0
// Look for a G4Element and if not found return nullptr
G4tgbElement* FindG4tgbElement(const G4String& name,
G4bool bMustExist = 0) const;
// Look for a G4Element and if not found return 0
G4bool bMustExist = false) const;
// Look for a G4Element and if not found return nullptr
G4Material* FindOrBuildG4Material(const G4String& name,
G4bool bMustExist = 1);
// Look for a G4Material that has to exists by default
// (if not found create it from the corresponding G4tgbMaterial)
G4bool bMustExist = true);
// Look for a G4Material that has to exists by default
// (if not found create it from the corresponding G4tgbMaterial)
G4Material* FindBuiltG4Material(const G4String& name) const;
// Look for a G4Material and if not found return 0
// Look for a G4Material and if not found return nullptr
G4tgbMaterial* FindG4tgbMaterial(const G4String& name,
G4bool bMustExist = 0) const;
// Look for a G4tgbMaterial and if not found return 0
G4bool bMustExist = false) const;
// Look for a G4tgbMaterial and if not found return nullptr
const G4msg4isot GetG4IsotopeList() const { return theG4Isotopes; }
const G4msg4elem GetG4ElementList() const { return theG4Elements; }
const G4msg4isot GetG4IsotopeList() const { return theG4Isotopes; }
const G4msg4elem GetG4ElementList() const { return theG4Elements; }
const G4msg4mate GetG4MaterialList() const { return theG4Materials; }
private:
private:
G4tgbMaterialMgr();
// Private Constructor
private:
private:
static G4ThreadLocal G4tgbMaterialMgr* theInstance;
@@ -126,11 +121,11 @@ class G4tgbMaterialMgr
// List of all tgbElements created
G4mstgbmate theG4tgbMaterials;
// List of all G4tgbMaterials created
G4msg4isot theG4Isotopes;
G4msg4isot theG4Isotopes;
// Container of all G4Isotopes created
G4msg4elem theG4Elements;
G4msg4elem theG4Elements;
// Container of all G4Elements created
G4msg4mate theG4Materials;
G4msg4mate theG4Materials;
// Container of all G4Materials created
};
@@ -23,32 +23,23 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialMixture
// G4tgbMaterialMixture
//
// Class description:
//
// Transient class of a material mixture; builds a G4Material mixture.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterialMixture_h
#define G4tgbMaterialMixture_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialMixture_hh
#define G4tgbMaterialMixture_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include "G4tgbMaterial.hh"
class G4tgbMaterialMixture : public G4tgbMaterial
{
public: // with description
public:
G4tgbMaterialMixture();
virtual ~G4tgbMaterialMixture();
@@ -58,9 +49,9 @@ class G4tgbMaterialMixture : public G4tgbMaterial
virtual const G4String& GetComponent(G4int i) const;
virtual G4double GetFraction(G4int i) const;
//Operators
// Operators
G4tgbMaterialMixture& operator=(const G4tgbMaterialMixture&);
G4tgbMaterialMixture& operator=(const G4tgbMaterialMixture&);
protected:
@@ -23,43 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialMixtureByNoAtoms
// G4tgbMaterialMixtureByNoAtoms
//
// Class description:
//
// Class to represent a material whose components are given by number of atoms.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByNoAtoms_h
#define G4tgbMaterialMixtureByNoAtoms_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByNoAtoms_hh
#define G4tgbMaterialMixtureByNoAtoms_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include "G4tgbMaterialMixture.hh"
class G4tgbMaterialMixtureByNoAtoms : public G4tgbMaterialMixture
{
public:
public: // with description
G4tgbMaterialMixtureByNoAtoms( G4tgrMaterial* tgr );
G4tgbMaterialMixtureByNoAtoms(G4tgrMaterial* tgr);
G4tgbMaterialMixtureByNoAtoms();
~G4tgbMaterialMixtureByNoAtoms();
~G4tgbMaterialMixtureByNoAtoms();
G4Material* BuildG4Material();
// Return the associated G4Material and if does not exist build it
void TransformToFractionsByWeight();
};
#endif
@@ -23,36 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialMixtureByVolume
// G4tgbMaterialMixtureByVolume
//
// Class description:
//
// Class to represent a material whose components are given by volume.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByVolume_h
#define G4tgbMaterialMixtureByVolume_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByVolume_hh
#define G4tgbMaterialMixtureByVolume_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include "G4tgbMaterialMixture.hh"
class G4tgbMaterialMixtureByVolume : public G4tgbMaterialMixture
{
public: // with description
public:
G4tgbMaterialMixtureByVolume();
G4tgbMaterialMixtureByVolume( G4tgrMaterial* tgr );
~G4tgbMaterialMixtureByVolume();
G4tgbMaterialMixtureByVolume(G4tgrMaterial* tgr);
~G4tgbMaterialMixtureByVolume();
G4Material* BuildG4Material();
// Return the associated G4Material and if does not exist build it
@@ -23,36 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialMixtureByWeight
// G4tgbMaterialMixtureByWeight
//
// Class description:
//
// Class to represent a material whose components are given by weight fractions.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByWeight_h
#define G4tgbMaterialMixtureByWeight_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialMixtureByWeight_hh
#define G4tgbMaterialMixtureByWeight_hh 1
#include "globals.hh"
#include <vector>
#include <string>
#include "G4tgbMaterialMixture.hh"
class G4tgbMaterialMixtureByWeight : public G4tgbMaterialMixture
{
public: // with description
public:
G4tgbMaterialMixtureByWeight();
G4tgbMaterialMixtureByWeight( G4tgrMaterial* tgr );
~G4tgbMaterialMixtureByWeight();
G4tgbMaterialMixtureByWeight(G4tgrMaterial* tgr);
~G4tgbMaterialMixtureByWeight();
G4Material* BuildG4Material();
// Return the associated G4Material and if does not exist build it
@@ -23,39 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbMaterialSimple
// G4tgbMaterialSimple
//
// Class description:
//
// Class to represent a simple material definition.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbMaterialSimple_hh
#define G4tgbMaterialSimple_hh 1
#ifndef G4tgbMaterialSimple_h
#define G4tgbMaterialSimple_h
#include "globals.hh"
#include <vector>
#include <string>
#include <iostream>
#include "globals.hh"
#include "G4tgbMaterial.hh"
class G4tgbMaterialSimple : public G4tgbMaterial
{
public:
public: // with description
G4tgbMaterialSimple();
~G4tgbMaterialSimple();
~G4tgbMaterialSimple();
G4tgbMaterialSimple( G4tgrMaterial* tgr );
G4tgbMaterialSimple(G4tgrMaterial* tgr);
// Fill the data interpreting the list of words read 'wl'
friend std::ostream& operator<<(std::ostream&, const G4tgbMaterialSimple&);
@@ -63,13 +54,13 @@ class G4tgbMaterialSimple : public G4tgbMaterial
G4Material* BuildG4Material();
// Return the associated G4Material and if does not exist build it
G4double GetZ() const {return theZ;}
G4double GetA() const {return theA;}
G4double GetZ() const { return theZ; }
G4double GetA() const { return theA; }
private:
G4double theZ;
G4double theA;
G4double theZ = 0.0;
G4double theA = 0.0;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbPlaceParamCircle
// G4tgbPlaceParamCircle
//
// Class description:
//
// Class to represent simple Cartesian parameterisations along a circle.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbPlaceParamCircle_H
#define G4tgbPlaceParamCircle_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbPlaceParamCircle_hh
#define G4tgbPlaceParamCircle_hh 1
#include "globals.hh"
@@ -49,14 +44,14 @@ class G4tgrPlaceParameterisation;
class G4VPhysicalVolume;
class G4tgbPlaceParamCircle : public G4tgbPlaceParameterisation
{
public: // with description
{
public:
G4tgbPlaceParamCircle( G4tgrPlaceParameterisation* );
G4tgbPlaceParamCircle(G4tgrPlaceParameterisation*);
~G4tgbPlaceParamCircle();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
G4VPhysicalVolume* physVol) const;
private:
@@ -64,12 +59,12 @@ class G4tgbPlaceParamCircle : public G4tgbPlaceParameterisation
private:
G4double theRadius;
G4double theRadius = 0.0;
G4ThreeVector theCircleAxis;
G4ThreeVector theDirInPlane;
G4double theStep;
G4double theOffset;
G4double theStep = 0.0;
G4double theOffset = 0.0;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbPlaceParamLinear
// G4tgbPlaceParamLinear
//
// Class description:
//
// Class to represent simple Cartesian parameterisations along a line.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbPlaceParamLinear_H
#define G4tgbPlaceParamLinear_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbPlaceParamLinear_hh
#define G4tgbPlaceParamLinear_hh 1
#include "globals.hh"
@@ -48,18 +43,19 @@ class G4VPhysicalVolume;
class G4tgrPlaceParameterisation;
class G4tgbPlaceParamLinear : public G4tgbPlaceParameterisation
{
public: // with description
{
public:
G4tgbPlaceParamLinear( G4tgrPlaceParameterisation* );
G4tgbPlaceParamLinear(G4tgrPlaceParameterisation*);
~G4tgbPlaceParamLinear();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
G4VPhysicalVolume* physVol) const;
private:
G4ThreeVector theDirection;
G4double theStep;
G4double theOffset;
G4double theStep = 0.0;
G4double theOffset = 0.0;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbPlaceParamSquare
// G4tgbPlaceParamSquare
//
// Class description:
//
// Class to represent simple Cartesian parameterisations along a square.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbPlaceParamSquare_H
#define G4tgbPlaceParamSquare_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbPlaceParamSquare_hh
#define G4tgbPlaceParamSquare_hh 1
#include "globals.hh"
#include "G4tgbPlaceParameterisation.hh"
@@ -46,25 +41,25 @@
class G4VPhysicalVolume;
class G4tgbPlaceParamSquare : public G4tgbPlaceParameterisation
{
public: // with description
{
public:
G4tgbPlaceParamSquare( G4tgrPlaceParameterisation* );
~G4tgbPlaceParamSquare();
G4tgbPlaceParamSquare(G4tgrPlaceParameterisation*);
~G4tgbPlaceParamSquare();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume* physVol) const;
private:
G4int theNCopies1;
G4int theNCopies2;
G4int theNCopies1 = 0;
G4int theNCopies2 = 0;
G4ThreeVector theDirection1;
G4ThreeVector theDirection2;
G4double theStep1;
G4double theStep2;
G4double theOffset1;
G4double theOffset2;
G4double theStep1 = 0.0;
G4double theStep2 = 0.0;
G4double theOffset1 = 0.0;
G4double theOffset2 = 0.0;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbPlaceParamSquare
// G4tgbPlaceParamSquare
//
// Class description:
//
// Class to represent parameterisations of placements.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbPlaceParameterisation_H
#define G4tgbPlaceParameterisation_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbPlaceParameterisation_hh
#define G4tgbPlaceParameterisation_hh 1
#include "globals.hh"
#include "geomdefs.hh"
@@ -50,28 +45,26 @@ class G4VPhysicalVolume;
class G4tgrPlaceParameterisation;
class G4tgbPlaceParameterisation : public G4VPVParameterisation
{
public: // with description
{
public:
G4tgbPlaceParameterisation( G4tgrPlaceParameterisation* tgrParam );
G4tgbPlaceParameterisation(G4tgrPlaceParameterisation* tgrParam);
virtual ~G4tgbPlaceParameterisation();
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const;
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume*) const;
void CheckNExtraData( G4tgrPlaceParameterisation* tgrParam,
G4int nWcheck, WLSIZEtype st,
const G4String& methodName );
void CheckNExtraData(G4tgrPlaceParameterisation* tgrParam, G4int nWcheck,
WLSIZEtype st, const G4String& methodName);
G4int GetNCopies() const { return theNCopies; }
EAxis GetAxis() const { return theAxis; }
protected:
G4int theNCopies;
EAxis theAxis;
G4int theNCopies = 0;
EAxis theAxis = kUndefined;
G4ThreeVector theTranslation;
G4RotationMatrix* theRotationMatrix;
G4RotationMatrix* theRotationMatrix = nullptr;
};
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbRotationMatrix
// G4tgbRotationMatrix
//
// Class description:
//
// Transient class of a rotation matrix; builds a G4RotationMatrix,
// of each rotation matrix.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbRotationMatrix_h
#define G4tgbRotationMatrix_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbRotationMatrix_hh
#define G4tgbRotationMatrix_hh 1
#include "globals.hh"
@@ -50,27 +45,26 @@
class G4tgbRotationMatrix
{
public: // with description
public:
G4tgbRotationMatrix();
~G4tgbRotationMatrix();
~G4tgbRotationMatrix();
G4tgbRotationMatrix( G4tgrRotationMatrix* tgr );
G4tgbRotationMatrix(G4tgrRotationMatrix* tgr);
// Construct the G4tgbRotationMatrix (fill its data members)
// interpreting the data in the list of words 'wl'
G4RotationMatrix* BuildG4RotMatrix( );
G4RotationMatrix* BuildG4RotMatrixFrom3( std::vector<G4double>& values );
G4RotationMatrix* BuildG4RotMatrixFrom6( std::vector<G4double>& values );
G4RotationMatrix* BuildG4RotMatrixFrom9( std::vector<G4double>& values );
G4RotationMatrix* BuildG4RotMatrix();
G4RotationMatrix* BuildG4RotMatrixFrom3(std::vector<G4double>& values);
G4RotationMatrix* BuildG4RotMatrixFrom6(std::vector<G4double>& values);
G4RotationMatrix* BuildG4RotMatrixFrom9(std::vector<G4double>& values);
// Build a G4RotationMatrix transforming theValues
G4String GetName() { return theTgrRM->GetName(); }
const G4String& GetName() { return theTgrRM->GetName(); }
private:
G4tgrRotationMatrix* theTgrRM;
G4tgrRotationMatrix* theTgrRM = nullptr;
};
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbRotationMatrixMgr
// G4tgbRotationMatrixMgr
//
// Class description:
//
// Singleton class to manage the building of transient rotation matrix,
// as well as the construction of the corresponding G4RotationMatrix's.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbRotationMatrixMgr_h
#define G4tgbRotationMatrixMgr_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbRotationMatrixMgr_hh
#define G4tgbRotationMatrixMgr_hh 1
#include "globals.hh"
@@ -47,32 +42,29 @@
#include "G4tgbRotationMatrix.hh"
typedef std::map< G4String, G4tgbRotationMatrix*,
std::less<G4String> > G4mstgbrotm;
typedef std::map< G4String, G4RotationMatrix*,
std::less<G4String> > G4msg4rotm;
using G4mstgbrotm = std::map<G4String, G4tgbRotationMatrix*,
std::less<G4String>>;
using G4msg4rotm = std::map<G4String, G4RotationMatrix*, std::less<G4String>>;
class G4tgbRotationMatrixMgr
class G4tgbRotationMatrixMgr
{
public: // with description
public:
~G4tgbRotationMatrixMgr();
static G4tgbRotationMatrixMgr* GetInstance();
// Get only instance (if it does not exists, create it)
G4RotationMatrix* FindOrBuildG4RotMatrix(const G4String& name);
// Look for a G4RotationMatrix and if not found create it
// from the corresponding G4tgbRotationMatrix
// from the corresponding G4tgbRotationMatrix
G4RotationMatrix* FindG4RotMatrix(const G4String& name);
// Look for a G4RotationMatrix and if not found return 0
// Look for a G4RotationMatrix and if not found return nullptr
G4tgbRotationMatrix* FindOrBuildTgbRotMatrix(const G4String& name);
// Look for an G4tgbRotationMatrix and if not found exit
G4tgbRotationMatrix* FindTgbRotMatrix(const G4String& name);
// Look for an G4tgbRotationMatrix and if not found return 0
public: // without description
// Look for an G4tgbRotationMatrix and if not found return nullptr
const G4mstgbrotm GetTgbRotMatList() const { return theTgbRotMats; }
const G4msg4rotm& GetG4RotMatList() const { return theG4RotMats; }
@@ -83,13 +75,13 @@ class G4tgbRotationMatrixMgr
void CopyRotMats();
static G4ThreadLocal G4tgbRotationMatrixMgr* theInstance;
private:
G4mstgbrotm theTgbRotMats;
G4msg4rotm theG4RotMats;
G4msg4rotm theG4RotMats;
};
std::ostream& operator<<(std::ostream&, const G4RotationMatrix &);
std::ostream& operator<<(std::ostream&, const G4RotationMatrix&);
#endif
+30 -38
View File
@@ -23,35 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbVolume
// G4tgbVolume
//
// Class description:
//
// Class to manage the geometry info of any detector unit. The detector units
// created in this class are essentially transient copies of Geant4 physical
// volumes. Thus, they are characterized by a name and the parameters of a
// Geant4 physical volume.
// Geant4 physical volume.
// They have associated several detector positions, that can be instances of
// G4tgrPlace, G4tgrPlaceDivRep or G4tgrPlaceParameterisation.
// Each detector positioning is done inside a parent. As there can be several
// parents, we will write one parent for each detector position, even if that
// means that parents are repeated.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbVolume_hh
#define G4tgbVolume_hh 1
#ifndef G4tgbVolume_h
#define G4tgbVolume_h
#include "globals.hh"
#include <vector>
#include <map>
#include "globals.hh"
#include "G4tgrVolume.hh"
#include "geomdefs.hh"
@@ -64,56 +57,55 @@ class G4AssemblyVolume;
class G4tgbVolume
{
public: // with description
public:
G4tgbVolume();
~G4tgbVolume();
G4tgbVolume( G4tgrVolume* vol);
~G4tgbVolume();
G4tgbVolume(G4tgrVolume* vol);
void ConstructG4Volumes( const G4tgrPlace* place,
const G4LogicalVolume* parentLV );
void ConstructG4Volumes(const G4tgrPlace* place,
const G4LogicalVolume* parentLV);
// Construct the G4VSolid, G4LogicalVolume and the G4VPhysicalVolume
// of copy 'copyNo'
G4VSolid* FindOrConstructG4Solid( const G4tgrSolid* vol);
// Construct the G4VSolid from the data of the corresponding G4tgrVolume.
G4VSolid* FindOrConstructG4Solid(const G4tgrSolid* vol);
// Construct the G4VSolid from the data of the corresponding G4tgrVolume.
// Allow to use data from another G4tgrVolume, needed by Boolean solids
// (that have to construct two solids and then do the Boolean operation)
G4LogicalVolume* ConstructG4LogVol( const G4VSolid* solid );
G4LogicalVolume* ConstructG4LogVol(const G4VSolid* solid);
// Construct the G4LogicalVolume and then call the construction of
// volumes that are positioned inside this LV
G4VPhysicalVolume* ConstructG4PhysVol( const G4tgrPlace* place,
const G4LogicalVolume* currentLV,
const G4LogicalVolume* parentLV );
G4VPhysicalVolume* ConstructG4PhysVol(const G4tgrPlace* place,
const G4LogicalVolume* currentLV,
const G4LogicalVolume* parentLV);
// Construct the G4VPhysicalVolume placing 'curentLV' with position
// given by the G4tgrPlace 'copyNo' inside 'parentLV'
void SetCutsInRange( G4LogicalVolume* logvol,
std::map<G4String,G4double> cuts );
void SetCutsInEnergy( G4LogicalVolume* logvol,
std::map<G4String,G4double> cuts );
void SetCutsInRange(G4LogicalVolume* logvol,
std::map<G4String, G4double> cuts);
void SetCutsInEnergy(G4LogicalVolume* logvol,
std::map<G4String, G4double> cuts);
void CheckNoSolidParams( const G4String& solidType,
const unsigned int NoParamExpected,
const unsigned int NoParam );
void CheckNoSolidParams(const G4String& solidType,
const unsigned int NoParamExpected,
const unsigned int NoParam);
// Before building a solid of type 'solydType', check if the number
// of paramenters is the expected one
G4VSolid* BuildSolidForDivision( G4VSolid* parentSolid, EAxis axis );
G4VSolid* BuildSolidForDivision(G4VSolid* parentSolid, EAxis axis);
const G4String& GetName() const { return theTgrVolume->GetName(); }
G4bool GetVisibility() const { return theTgrVolume->GetVisibility(); }
const G4double* GetColour() const { return theTgrVolume->GetColour(); }
private:
G4tgrVolume* theTgrVolume;
G4tgrVolume* theTgrVolume = nullptr;
// The G4tgrVolume to which it corresponds
G4AssemblyVolume* theG4AssemblyVolume;
G4AssemblyVolume* theG4AssemblyVolume = nullptr;
};
#endif
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgbVolume
// G4tgbVolumeMgr
//
// Class description:
//
// Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes.
// It is a singleton, accesed always through calls to GetInstance().
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgbVolumeMgr_h
#define G4tgbVolumeMgr_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgbVolumeMgr_hh
#define G4tgbVolumeMgr_hh 1
#include "globals.hh"
@@ -54,57 +49,56 @@ class G4tgbVolume;
class G4tgrVolume;
class G4tgbDetectorBuilder;
typedef std::map< G4String, G4tgbVolume* > G4mssvol;
typedef std::multimap< G4String, G4VSolid* > G4mmssol;
typedef std::multimap< G4String, G4LogicalVolume* > G4mmslv;
typedef std::multimap< G4String, G4VPhysicalVolume* > G4mmspv;
typedef std::map< G4LogicalVolume*, G4LogicalVolume* > G4mlvlv;
typedef std::map< G4VPhysicalVolume*, G4VPhysicalVolume* > G4mpvpv;
using G4mssvol = std::map<G4String, G4tgbVolume*>;
using G4mmssol = std::multimap<G4String, G4VSolid*>;
using G4mmslv = std::multimap<G4String, G4LogicalVolume*>;
using G4mmspv = std::multimap<G4String, G4VPhysicalVolume*>;
using G4mlvlv = std::map<G4LogicalVolume*, G4LogicalVolume*>;
using G4mpvpv = std::map<G4VPhysicalVolume*, G4VPhysicalVolume*>;
//----------------------------------------------------------------------------
class G4tgbVolumeMgr
{
public: // with description
class G4tgbVolumeMgr
{
public:
G4tgbVolumeMgr();
~G4tgbVolumeMgr();
~G4tgbVolumeMgr();
static G4tgbVolumeMgr* GetInstance();
// Get the only instance
static G4tgbVolumeMgr* GetInstance();
// Get the only instance
void AddTextFile( const G4String& fname );
void AddTextFile(const G4String& fname);
G4VPhysicalVolume* ReadAndConstructDetector();
void CopyVolumes();
// Build a G4tgbVolume per each G4tgbVolume
G4tgbVolume* FindVolume( const G4String& volname);
G4tgbVolume* FindVolume(const G4String& volname);
// Find a G4tgbVolume by name
void RegisterMe( const G4tgbVolume* vol );
void RegisterMe(const G4tgbVolume* vol);
// Register a G4tgbVolume
void RegisterMe( const G4VSolid* solid );
void RegisterMe(const G4VSolid* solid);
// Register a G4VSolid
void RegisterMe( const G4LogicalVolume* lv );
void RegisterMe(const G4LogicalVolume* lv);
// Register a G4LogicalVolume
void RegisterMe( const G4VPhysicalVolume* pv );
void RegisterMe(const G4VPhysicalVolume* pv);
// Register a G4VPhysicalVolume
void RegisterChildParentLVs( const G4LogicalVolume* logvol,
const G4LogicalVolume* parentLV );
void RegisterChildParentLVs(const G4LogicalVolume* logvol,
const G4LogicalVolume* parentLV);
// Register a child and its parent LV
G4VSolid* FindG4Solid( const G4String& name );
// Find if solid already exists, comparing the name and all parameters
G4VSolid* FindG4Solid(const G4String& name);
// Find if solid already exists, comparing the name and all parameters
// (could be checked before creating it, but it would be quite
// complicated, because it would have to compare the parameters, and
// they depend on the type of solid)
G4LogicalVolume* FindG4LogVol( const G4String& theName,
const G4bool bExists = 0 );
G4LogicalVolume* FindG4LogVol(const G4String& theName,
const G4bool bExists = false);
// Find a G4LogicalVolume if it already exists
G4VPhysicalVolume* FindG4PhysVol( const G4String& theName,
const G4bool bExists = 0 );
G4VPhysicalVolume* FindG4PhysVol(const G4String& theName,
const G4bool bExists = false);
// Find a G4VPhysicalVolume if it already exists
G4VPhysicalVolume* GetTopPhysVol();
@@ -125,14 +119,18 @@ class G4tgbVolumeMgr
void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
void DumpG4SolidList();
public: // without description
const std::multimap< G4String, G4VSolid* >& GetSolids() const
{ return theSolids; }
void SetDetectorBuilder( G4tgbDetectorBuilder* db )
{ theDetectorBuilder = db; }
const std::multimap<G4String, G4VSolid*>& GetSolids() const
{
return theSolids;
}
void SetDetectorBuilder(G4tgbDetectorBuilder* db)
{
theDetectorBuilder = db;
}
G4tgbDetectorBuilder* GetDetectorBuilder() const
{ return theDetectorBuilder; }
{
return theDetectorBuilder;
}
private:
@@ -164,7 +162,7 @@ class G4tgbVolumeMgr
// Physical volume tree for inverse navigation (from children to parents):
// first is child, then parent
G4tgbDetectorBuilder* theDetectorBuilder;
G4tgbDetectorBuilder* theDetectorBuilder = nullptr;
};
#endif
@@ -23,34 +23,29 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrElement
// G4tgrElement
//
// Class description:
//
// Transient class of a chemical element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrElement_h
#define G4tgrElement_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrElement_hh
#define G4tgrElement_hh 1
#include "globals.hh"
class G4tgrElement
{
public: // with description
public:
G4tgrElement();
virtual ~G4tgrElement();
const G4String& GetName() const { return theName; }
const G4String& GetName() const { return theName; }
const G4String& GetSymbol() const { return theSymbol; }
const G4String& GetType() const { return theType; }
const G4String& GetType() const { return theType; }
protected:
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrElementFromIsotopes
// G4tgrElementFromIsotopes
//
// Class description:
//
// Transient class of a chemical element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrElementFromIsotopes_h
#define G4tgrElementFromIsotopes_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrElementFromIsotopes_hh
#define G4tgrElementFromIsotopes_hh 1
#include "globals.hh"
@@ -47,27 +42,27 @@
class G4tgrElementFromIsotopes : public G4tgrElement
{
public: // with description
public:
G4tgrElementFromIsotopes();
~G4tgrElementFromIsotopes();
~G4tgrElementFromIsotopes();
G4tgrElementFromIsotopes( const std::vector<G4String>& wl );
G4tgrElementFromIsotopes(const std::vector<G4String>& wl);
// Construct the G4tgrElementFromIsotopes (fill its data members)
// interpreting the data in the list of words 'wl'
// interpreting the data in the list of words 'wl'
G4int GetNumberOfIsotopes() const { return theNoIsotopes; }
const G4String& GetComponent( G4int n ) const { return theComponents[n]; }
G4double GetAbundance( G4int n ) const { return theAbundances[n]; }
G4int GetNumberOfIsotopes() const { return theNoIsotopes; }
const G4String& GetComponent(G4int n) const { return theComponents[n]; }
G4double GetAbundance(G4int n) const { return theAbundances[n]; }
friend std::ostream& operator<<(std::ostream&,
const G4tgrElementFromIsotopes& );
const G4tgrElementFromIsotopes&);
private:
G4int theNoIsotopes;
G4int theNoIsotopes = 0;
std::vector<G4String> theComponents;
std::vector<G4double> theAbundances;
};
#endif
@@ -23,49 +23,43 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrElementSimple
// G4tgrElementSimple
//
// Class description:
//
// Transient class of a chemical element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrElementSimple_h
#define G4tgrElementSimple_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrElementSimple_hh
#define G4tgrElementSimple_hh 1
#include <vector>
#include "globals.hh"
#include "G4tgrElement.hh"
class G4tgrElementSimple : public G4tgrElement
{
public: // with description
{
public:
G4tgrElementSimple();
~G4tgrElementSimple();
~G4tgrElementSimple();
G4tgrElementSimple( const std::vector<G4String>& wl );
G4tgrElementSimple(const std::vector<G4String>& wl);
// Construct the G4tgrElementSimple (fill its data members)
// interpreting the data in the list of words 'wl'
// interpreting the data in the list of words 'wl'
G4double GetZ() const { return theZ; }
G4double GetA() const { return theA; }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrElementSimple& obj);
private:
G4double theZ;
G4double theA;
G4double theZ = 0.0;
G4double theA = 0.0;
};
#endif
@@ -23,34 +23,29 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrEvaluator
// G4tgrEvaluator
//
// Class description:
//
// Simple customised evaluator utility class.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrEvaluator_HH
#define G4tgrEvaluator_HH
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrEvaluator_hh
#define G4tgrEvaluator_hh 1
#include "G4ThreeVector.hh"
#include "G4Evaluator.hh"
class G4tgrEvaluator : public G4Evaluator
{
public: // with description
public:
G4tgrEvaluator();
~G4tgrEvaluator();
~G4tgrEvaluator();
// Constructor & destructor.
void print_error( G4int status ) const;
void print_error(G4int status) const;
// Overwritten ERROR_SYNTAX_ERROR message
private:
+27 -31
View File
@@ -23,40 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrFileIn
// G4tgrFileIn
//
// Class description:
//
// Singleton for importing file descriptions.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrFileIn_hh
#define G4tgrFileIn_hh 1
#ifndef G4tgrFileIn_HH
#define G4tgrFileIn_HH
#include "globals.hh"
#include <vector>
class G4tgrFileIn
#include "globals.hh"
class G4tgrFileIn
{
public: // with description
public:
G4tgrFileIn();
~G4tgrFileIn();
~G4tgrFileIn();
static G4tgrFileIn& GetInstance( const G4String& name );
static G4tgrFileIn& GetInstance(const G4String& name);
// Get the only instance opening the file
static G4tgrFileIn& GetInstanceOpened( const G4String& name );
static G4tgrFileIn& GetInstanceOpened(const G4String& name);
// Get the only instance when file should be already opened
G4int GetWordsInLine( std::vector<G4String>& wl );
// Read a line and transform it to a vector of words
G4int GetWordsInLine(std::vector<G4String>& wl);
// Read a line and transform it to a vector of words
void ErrorInLine();
// Print out an error message indicating the line being read
@@ -64,35 +60,35 @@ class G4tgrFileIn
// Access data members
G4int Nline() { return theLineNo[theCurrentFile]; }
const G4String& GetName() { return theName; }
void OpenNewFile( const char* filename );
void OpenNewFile(const char* filename);
G4bool EndOfFile();
void Close();
void DumpException( const G4String& sent );
void DumpException(const G4String& sent);
private:
G4tgrFileIn( const G4String& name ) : theCurrentFile(-1), theName(name) {}
G4tgrFileIn(const G4String& name) : theName(name) {}
private:
std::vector< std::ifstream* > theFiles;
std::vector<std::ifstream*> theFiles;
std::vector<G4int> theLineNo;
// Number of line being read
std::vector<G4String> theNames;
G4int theCurrentFile;
G4int theCurrentFile = -1;
// Index of file being read in theFiles
static G4ThreadLocal std::vector<G4tgrFileIn*> *theInstances;
static G4ThreadLocal std::vector<G4tgrFileIn*>* theInstances;
// Vector of class instances (each one identified by its name)
G4String theName;
G4String theName = "";
// Name of file
};
#endif
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrFileReader
// G4tgrFileReader
//
// Class description:
//
// This service provides access to detector description data.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrFileReader_H
#define G4tgrFileReader_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrFileReader_hh
#define G4tgrFileReader_hh 1
#include "globals.hh"
@@ -49,17 +44,17 @@ class G4tgrLineProcessor;
class G4tgrFileReader
{
public: // with description
public:
static G4tgrFileReader* GetInstance();
// Get the only instance
static G4tgrFileReader* GetInstance();
// Get the only instance
virtual ~G4tgrFileReader();
G4bool ReadFiles();
void AddTextFile(const G4String& fname) { theTextFiles.push_back( fname ); }
void SetLineProcessor( G4tgrLineProcessor* lp ) { theLineProcessor = lp; }
void AddTextFile(const G4String& fname) { theTextFiles.push_back(fname); }
void SetLineProcessor(G4tgrLineProcessor* lp) { theLineProcessor = lp; }
G4tgrLineProcessor* GetLineProcessor() const { return theLineProcessor; }
protected:
@@ -68,11 +63,10 @@ class G4tgrFileReader
private:
static G4ThreadLocal G4tgrFileReader* theInstance;
static G4ThreadLocal G4tgrFileReader* theInstance;
std::vector<G4String> theTextFiles;
G4tgrLineProcessor* theLineProcessor;
G4tgrLineProcessor* theLineProcessor = nullptr;
};
# endif
#endif
@@ -23,52 +23,47 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrIsotope
// G4tgrIsotope
//
// Class description:
//
// Transient class of a chemical element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrIsotope_h
#define G4tgrIsotope_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrIsotope_hh
#define G4tgrIsotope_hh 1
#include <vector>
#include "globals.hh"
class G4tgrIsotope
{
public: // with description
{
public:
G4tgrIsotope();
~G4tgrIsotope();
~G4tgrIsotope();
G4tgrIsotope( const std::vector<G4String>& wl );
G4tgrIsotope(const std::vector<G4String>& wl);
// Construct the G4tgrIsotope (fill its data members)
// interpreting the data in the list of words 'wl'
// interpreting the data in the list of words 'wl'
// Retrieval methods
const G4String& GetName() const { return theName; }
G4int GetZ() const { return theZ; }
G4int GetN() const { return theN; }
G4int GetZ() const { return theZ; }
G4int GetN() const { return theN; }
G4double GetA() const { return theA; }
friend std::ostream& operator<<(std::ostream& os, const G4tgrIsotope& obj);
private:
G4String theName; // name of the Isotope
G4int theZ; // atomic number
G4int theN; // number of nucleons
G4double theA; // mass
private:
G4String theName = ""; // name of the Isotope
G4int theZ = 0; // atomic number
G4int theN = 0; // number of nucleons
G4double theA = 0.0; // mass
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrIsotope
// G4tgrLineProcessor
//
// Class description:
//
// This service provides access to detector description data.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrLineProcessor_H
#define G4tgrLineProcessor_H 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrLineProcessor_hh
#define G4tgrLineProcessor_hh 1
#include "globals.hh"
@@ -48,20 +43,20 @@ class G4tgrVolumeMgr;
class G4tgrLineProcessor
{
public: // with description
public:
G4tgrLineProcessor();
virtual ~G4tgrLineProcessor();
virtual G4bool ProcessLine( const std::vector<G4String>& wl );
virtual G4bool ProcessLine(const std::vector<G4String>& wl);
protected:
G4tgrVolume* FindVolume( const G4String& volname );
G4tgrVolume* FindVolume(const G4String& volname);
private:
G4tgrVolumeMgr* volmgr;
G4tgrVolumeMgr* volmgr = nullptr;
};
# endif
#endif
@@ -23,71 +23,71 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrMaterial
// G4tgrMaterial
//
// Class description:
//
// Class to represent a transient material.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrMaterial_h
#define G4tgrMaterial_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrMaterial_hh
#define G4tgrMaterial_hh 1
#include "globals.hh"
#include "G4Material.hh"
class G4tgrMaterial
{
public: // with description
public:
G4tgrMaterial();
virtual ~G4tgrMaterial();
// Get methods
const G4String& GetName() const { return theName; }
const G4String& GetName() const { return theName; }
G4double GetDensity() const { return theDensity; }
// Density in g/cm3
G4int GetNumberOfComponents() const { return theNoComponents; }
const G4String& GetType() const { return theMateType; }
G4int GetNumberOfComponents() const { return theNoComponents; }
const G4String& GetType() const { return theMateType; }
virtual G4double GetA() const = 0;
virtual G4double GetZ() const = 0;
virtual G4double GetA() const = 0;
virtual G4double GetZ() const = 0;
virtual const G4String& GetComponent(G4int i) const = 0;
virtual G4double GetFraction(G4int i) = 0;
virtual G4double GetFraction(G4int i) = 0;
G4double GetIonisationMeanExcitationEnergy() const
{ return theIonisationMeanExcitationEnergy; }
{
return theIonisationMeanExcitationEnergy;
}
void SetIonisationMeanExcitationEnergy( G4double mee )
{ theIonisationMeanExcitationEnergy = mee; }
void SetIonisationMeanExcitationEnergy(G4double mee)
{
theIonisationMeanExcitationEnergy = mee;
}
G4State GetState() const { return theState; }
void SetState( G4String val );
const G4State& GetState() const { return theState; }
void SetState(const G4String& val);
G4double GetTemperature() const { return theTemperature; }
void SetTemperature( G4double val ) { theTemperature = val; }
void SetTemperature(G4double val) { theTemperature = val; }
G4double GetPressure() const { return thePressure; }
void SetPressure( G4double val ) { thePressure = val; }
void SetPressure(G4double val) { thePressure = val; }
protected:
G4String theName;
G4double theDensity;
G4int theNoComponents;
G4String theMateType;
G4double theIonisationMeanExcitationEnergy;
G4State theState;
G4double theTemperature;
G4double thePressure;
G4String theName = "Material";
G4double theDensity = 0.0;
G4int theNoComponents = 0;
G4String theMateType = "Material";
G4double theIonisationMeanExcitationEnergy = -1.0;
G4State theState = kStateUndefined;
G4double theTemperature = 0.0;
G4double thePressure = 0.0;
};
#endif
@@ -23,26 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrMaterialFactory
// G4tgrMaterialFactory
//
// Class description:
//
// Singleton class to manage the building of transient materials.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrMaterialFactory_h
#define G4tgrMaterialFactory_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrMaterialFactory_hh
#define G4tgrMaterialFactory_hh 1
#include <map>
#include "globals.hh"
#include "G4tgrIsotope.hh"
#include "G4tgrElementSimple.hh"
#include "G4tgrElementFromIsotopes.hh"
@@ -50,31 +45,33 @@
#include "G4tgrMaterialSimple.hh"
#include "G4tgrMaterialMixture.hh"
typedef std::map< G4String, G4tgrIsotope* > G4mstgrisot;
typedef std::map< G4String, G4tgrElement* > G4mstgrelem;
typedef std::map< G4String, G4tgrMaterial* > G4mstgrmate;
using G4mstgrisot = std::map<G4String, G4tgrIsotope*>;
using G4mstgrelem = std::map<G4String, G4tgrElement*>;
using G4mstgrmate = std::map<G4String, G4tgrMaterial*>;
class G4tgrMaterialFactory
class G4tgrMaterialFactory
{
public: // with decription
public:
~G4tgrMaterialFactory();
static G4tgrMaterialFactory* GetInstance();
// Get only instance (it it does not exist, create it)
G4tgrIsotope* AddIsotope( const std::vector<G4String>& wl );
G4tgrIsotope* AddIsotope(const std::vector<G4String>& wl);
// Build a G4tgrIsotope
G4tgrElementSimple* AddElementSimple( const std::vector<G4String>& wl );
G4tgrElementSimple* AddElementSimple(const std::vector<G4String>& wl);
// Build a G4tgrElementSimple
G4tgrElementFromIsotopes* AddElementFromIsotopes( const std::vector<G4String>& wl );
G4tgrElementFromIsotopes*
AddElementFromIsotopes(const std::vector<G4String>& wl);
// Build a G4tgrElementFromIsotopes
G4tgrMaterialSimple* AddMaterialSimple( const std::vector<G4String>& wl );
G4tgrMaterialSimple* AddMaterialSimple(const std::vector<G4String>& wl);
// Build a G4tgrMaterialSimple and add it to the Materials list
G4tgrMaterialMixture* AddMaterialMixture( const std::vector<G4String>& wl, const G4String& mixtType );
G4tgrMaterialMixture* AddMaterialMixture(const std::vector<G4String>& wl,
const G4String& mixtType);
// Build a G4tgrMaterialByWeight or G4tgrMaterialByNoAtoms
// or G4tgrMaterialByVolume and add it to the Materials list
@@ -94,11 +91,9 @@ class G4tgrMaterialFactory
void DumpMaterialList() const;
// Dump detailed list of materials
public: // without description
const G4mstgrisot& GetIsotopeList() const {return theG4tgrIsotopes; }
const G4mstgrelem& GetElementList() const {return theG4tgrElements; }
const G4mstgrmate& GetMaterialList() const {return theG4tgrMaterials;}
const G4mstgrisot& GetIsotopeList() const { return theG4tgrIsotopes; }
const G4mstgrelem& GetElementList() const { return theG4tgrElements; }
const G4mstgrmate& GetMaterialList() const { return theG4tgrMaterials; }
private:
@@ -107,7 +102,8 @@ class G4tgrMaterialFactory
void ErrorAlreadyExists(const G4String& object,
const std::vector<G4String>& wl,
const G4bool bNoRepeating = true );
const G4bool bNoRepeating = true);
private:
static G4ThreadLocal G4tgrMaterialFactory* theInstance;
@@ -23,32 +23,29 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrMaterialMixture
// G4tgrMaterialMixture
//
// Class description:
//
// Class to represent a material mixture.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrMaterialMixture_h
#define G4tgrMaterialMixture_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrMaterialMixture_hh
#define G4tgrMaterialMixture_hh 1
#include <iostream>
#include <vector>
#include "globals.hh"
#include "G4tgrMaterial.hh"
class G4tgrMaterialMixture : public G4tgrMaterial
{
public: // with description
public:
G4tgrMaterialMixture();
~G4tgrMaterialMixture();
G4tgrMaterialMixture(const G4String& matType,
const std::vector<G4String>& wl);
@@ -60,24 +57,17 @@ class G4tgrMaterialMixture : public G4tgrMaterial
G4double GetA() const { return 0.; }
G4double GetZ() const { return 0.; }
const G4String& GetComponent(G4int i) const { return theComponents[i]; }
G4double GetFraction(G4int i) { return theFractions[i]; }
G4tgrMaterialMixture operator= (const G4tgrMaterialMixture&);
public: // without description
G4tgrMaterialMixture();
~G4tgrMaterialMixture();
const G4String& GetComponent(G4int i) const { return theComponents[i]; }
G4double GetFraction(G4int i) { return theFractions[i]; }
protected:
void TransformToFractionsByWeight(){};
void TransformToFractionsByWeight() {}
protected:
std::vector<G4String> theComponents;
std::vector<G4double> theFractions;
std::vector<G4String> theComponents;
std::vector<G4double> theFractions;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrMaterialSimple
// G4tgrMaterialSimple
//
// Class description:
//
// Class to represent a simple material, i.e. made of a single element.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrMaterialSimple_h
#define G4tgrMaterialSimple_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrMaterialSimple_hh
#define G4tgrMaterialSimple_hh 1
#include "globals.hh"
@@ -48,15 +43,16 @@
class G4tgrMaterialSimple : public G4tgrMaterial
{
public: // with description
public:
G4tgrMaterialSimple();
~G4tgrMaterialSimple();
G4tgrMaterialSimple(const G4String& matType,
const std::vector<G4String>& wl);
// Fill the data interpreting the list of words read 'wl'
friend std::ostream& operator<<(std::ostream&, const G4tgrMaterialSimple&);
G4tgrMaterialSimple& operator= (const G4tgrMaterialSimple&);
friend std::ostream& operator<<(std::ostream&, const G4tgrMaterialSimple&);
G4double GetA() const { return theA; }
G4double GetZ() const { return theZ; }
@@ -64,16 +60,11 @@ class G4tgrMaterialSimple : public G4tgrMaterial
const G4String& GetComponent(G4int i) const;
G4double GetFraction(G4int i);
public: // without description
G4tgrMaterialSimple();
~G4tgrMaterialSimple();
private:
G4String name;
G4double theA;
G4double theZ;
G4String name = "MaterialSimple";
G4double theA = 0.0;
G4double theZ = 0.0;
};
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrMessenger
// G4tgrMessenger
//
// Class description:
//
// Concrete class of G4UImessenger which takes care of commands for
// the geometry generation from text file.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrMessenger_h
#define G4tgrMessenger_h 1
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrMessenger_hh
#define G4tgrMessenger_hh 1
#include "G4UImessenger.hh"
@@ -47,20 +42,20 @@ class G4UIcmdWithAnInteger;
class G4tgrMessenger : public G4UImessenger
{
public: // with description
public:
G4tgrMessenger();
~G4tgrMessenger();
~G4tgrMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
static G4int GetVerboseLevel();
static void SetVerboseLevel( G4int verb );
static void SetVerboseLevel(G4int verb);
private:
G4UIdirectory* tgDirectory;
G4UIcmdWithAnInteger* verboseCmd;
G4UIdirectory* tgDirectory = nullptr;
G4UIcmdWithAnInteger* verboseCmd = nullptr;
static G4ThreadLocal G4int theVerboseLevel;
};
@@ -23,48 +23,42 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrParameterMgr
// G4tgrParameterMgr
//
// Class description:
//
// Class to manage parameters. It is a singleton.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrParameterMgr_h
#define G4tgrParameterMgr_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrParameterMgr_hh
#define G4tgrParameterMgr_hh 1
#include <map>
#include <vector>
typedef std::map< G4String, G4String > G4mapss;
#include "globals.hh"
class G4tgrParameterMgr
{
public: // with description
using G4mapss = std::map<G4String, G4String>;
static G4tgrParameterMgr* GetInstance();
// Get the only instance
class G4tgrParameterMgr
{
public:
void AddParameterNumber( const std::vector<G4String>& wl,
G4bool mustBeNew = 0 );
void AddParameterString( const std::vector<G4String>& wl,
G4bool mustBeNew = 0 );
static G4tgrParameterMgr* GetInstance();
// Get the only instance
void AddParameterNumber(const std::vector<G4String>& wl,
G4bool mustBeNew = false);
void AddParameterString(const std::vector<G4String>& wl,
G4bool mustBeNew = false);
// Add to theParameterList
void CheckIfNewParameter( const std::vector<G4String>& wl,
G4bool mustBeNew );
void CheckIfNewParameter(const std::vector<G4String>& wl, G4bool mustBeNew);
// Check if it is new and that there are 3 words
G4String FindParameter( const G4String& name, G4bool exists = true );
// Find a Parameter with name 'name'.
G4String FindParameter(const G4String& name, G4bool exists = true);
// Find a Parameter with name 'name'.
void DumpList();
// Dump list of parameters
@@ -72,7 +66,7 @@ class G4tgrParameterMgr
private:
G4tgrParameterMgr();
~G4tgrParameterMgr();
~G4tgrParameterMgr();
private:
+13 -18
View File
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrPlace
// G4tgrPlace
//
// Class description:
//
// Abstract base class to describe the position of a G4tgrVolume inside
// another G4tgrVolume.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrPlace_h
#define G4tgrPlace_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrPlace_hh
#define G4tgrPlace_hh 1
#include "globals.hh"
#include "G4ThreeVector.hh"
@@ -47,7 +42,7 @@ class G4tgrVolume;
class G4tgrPlace
{
public: // with description
public:
G4tgrPlace();
virtual ~G4tgrPlace();
@@ -58,24 +53,24 @@ class G4tgrPlace
G4tgrVolume* GetVolume() const { return theVolume; }
unsigned int GetCopyNo() const { return theCopyNo; }
const G4String& GetType() const { return theType; }
void SetVolume( G4tgrVolume* vol ) { theVolume = vol; }
void SetType( const G4String& typ ){ theType = typ; }
void SetVolume(G4tgrVolume* vol) { theVolume = vol; }
void SetType(const G4String& typ) { theType = typ; }
virtual G4ThreeVector GetPlacement() const;
protected:
G4tgrVolume* theVolume;
G4tgrVolume* theVolume = nullptr;
// The detunit to which it belongs
G4String theParentName;
G4String theParentName = "";
// The parent (by name, as we will allow that a child
// is placed in the file before the parent is created)
// is placed in the file before the parent is created)
unsigned int theCopyNo;
unsigned int theCopyNo = 0;
// The copy number
G4String theType;
G4String theType = "";
// The type (simple/replica/param)
};
@@ -23,45 +23,43 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrPlaceDivRep
// G4tgrPlaceDivRep
//
// Class description:
//
// Class to descripe the position of a G4tgrVolume inside another
// G4tgrVolume as a replica, i.e. filling the whole parent volume.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrPlaceDivRep_h
#define G4tgrPlaceDivRep_h
#include "globals.hh"
#include "geomdefs.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrPlaceDivRep_hh
#define G4tgrPlaceDivRep_hh 1
#include <vector>
#include "globals.hh"
#include "geomdefs.hh"
#include "G4tgrPlace.hh"
enum G4DivType { DivByNdiv, DivByWidth, DivByNdivAndWidth };
enum G4DivType
{
DivByNdiv,
DivByWidth,
DivByNdivAndWidth
};
class G4tgrPlaceDivRep : public G4tgrPlace
{
public: // with description
public:
G4tgrPlaceDivRep();
~G4tgrPlaceDivRep();
~G4tgrPlaceDivRep();
G4tgrPlaceDivRep( const std::vector<G4String>& wl );
G4tgrPlaceDivRep(const std::vector<G4String>& wl);
// Creates an object passing the only data that is fixed
// (ndiv, width, offset may be have to be recalculated)
EAxis BuildAxis( const G4String& axisName );
EAxis BuildAxis(const G4String& axisName);
// Access functions
@@ -72,21 +70,22 @@ class G4tgrPlaceDivRep : public G4tgrPlace
G4DivType GetDivType() const { return theDivType; }
void SetParentName(const G4String& parentName) { theParentName=parentName; }
void SetNDiv( G4int ndiv ) { theNDiv = ndiv; }
void SetWidth( G4double width ) { theWidth = width; }
void SetAxis( EAxis axis ) { theAxis = axis; }
void SetOffset( G4double offset ) { theOffset = offset; }
void SetDivType( G4DivType typ ) { theDivType = typ; }
void SetNDiv(G4int ndiv) { theNDiv = ndiv; }
void SetWidth(G4double width) { theWidth = width; }
void SetAxis(EAxis axis) { theAxis = axis; }
void SetOffset(G4double offset) { theOffset = offset; }
void SetDivType(G4DivType typ) { theDivType = typ; }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrPlaceDivRep& obj);
private:
G4int theNDiv;
G4double theWidth;
EAxis theAxis;
G4double theOffset;
G4DivType theDivType;
G4int theNDiv = 0;
G4double theWidth = 0.0;
EAxis theAxis = kUndefined;
G4double theOffset = 0.0;
G4DivType theDivType = DivByNdivAndWidth;
};
#endif
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrPlaceParameterisation
// G4tgrPlaceParameterisation
//
// Class description:
//
@@ -36,42 +33,40 @@
// - Parameterisation also of the dimensions
// - Parameterisation of the solid type
// Data is just stored in this class, without any calculation of the
// positions of each copy
// positions of each copy
// :POS_PARAM "volu_name" copyNo "parent_name" "parametrisation_type"
// number_copies step offset extra_data(n words).
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrPlaceParameterisation_h
#define G4tgrPlaceParameterisation_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrPlaceParameterisation_hh
#define G4tgrPlaceParameterisation_hh 1
#include <vector>
#include "globals.hh"
#include "G4tgrPlace.hh"
class G4tgrPlaceParameterisation : public G4tgrPlace
{
public: // with description
public:
G4tgrPlaceParameterisation();
~G4tgrPlaceParameterisation();
~G4tgrPlaceParameterisation();
G4tgrPlaceParameterisation( const std::vector<G4String>& p);
G4tgrPlaceParameterisation(const std::vector<G4String>& p);
// Creates an object passing the parameters
// Access functions
const G4String& GetParamType() const { return theParamType; }
// GetType returns placement type
// GetType returns placement type
std::vector<G4double> GetExtraData() const { return theExtraData; }
const G4String& GetRotMatName() const { return theRotMatName; }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrPlaceParameterisation& obj);
private:
G4String theParamType;
@@ -23,38 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrPlaceSimple
// G4tgrPlaceSimple
//
// Class description:
//
// Class to describe a simple positioning of a G4tgrVolume inside
// another G4tgrVolume.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrPlaceSimple_h
#define G4tgrPlaceSimple_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrPlaceSimple_hh
#define G4tgrPlaceSimple_hh 1
#include <vector>
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4tgrPlace.hh"
class G4tgrPlaceSimple : public G4tgrPlace
{
public: // with description
public:
G4tgrPlaceSimple();
~G4tgrPlaceSimple();
~G4tgrPlaceSimple();
G4tgrPlaceSimple( const std::vector<G4String>& wl );
G4tgrPlaceSimple(const std::vector<G4String>& wl);
// Accessors
@@ -63,6 +57,7 @@ class G4tgrPlaceSimple : public G4tgrPlace
friend std::ostream& operator<<(std::ostream& os,
const G4tgrPlaceSimple& obj);
protected:
G4ThreeVector thePlace;
@@ -23,51 +23,52 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrRotationMatrix
// G4tgrRotationMatrix
//
// Class description:
//
// Transient class of a rotation matrix.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrRotationMatrix_h
#define G4tgrRotationMatrix_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrRotationMatrix_hh
#define G4tgrRotationMatrix_hh 1
#include <vector>
enum G4RotMatInputType { rm3, rm6, rm9 };
#include "globals.hh"
enum G4RotMatInputType
{
rm3,
rm6,
rm9
};
class G4tgrRotationMatrix
{
public: // with description
public:
G4tgrRotationMatrix();
~G4tgrRotationMatrix();
~G4tgrRotationMatrix();
G4tgrRotationMatrix( const std::vector<G4String>& wl );
G4tgrRotationMatrix(const std::vector<G4String>& wl);
// Construct the G4tgrRotationMatrix (fill its data members)
// interpreting the data in the list of words 'wl'
// interpreting the data in the list of words 'wl'
const G4String& GetName() { return theName; }
std::vector<G4double>& GetValues() { return theValues; }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrRotationMatrix& obj);
private:
G4String theName;
G4String theName = "Rotation-Matrix";
std::vector<G4double> theValues;
// thetaX,phiX,thetaY,phiY,thetaZ,phiZ;
G4RotMatInputType theInputType;
G4RotMatInputType theInputType = rm9;
};
#endif
@@ -23,47 +23,43 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrRotationMatrixFactory
// G4tgrRotationMatrixFactory
//
// Class description:
//
// Singleton class to manage the building of transient rotation matrix.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrRotationMatrixFactory_h
#define G4tgrRotationMatrixFactory_h
#include "globals.hh"
#include "G4tgrRotationMatrix.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrRotationMatrixFactory_hh
#define G4tgrRotationMatrixFactory_hh 1
#include <vector>
#include <map>
typedef std::map< G4String, G4tgrRotationMatrix* > G4mstgrrotm;
#include "globals.hh"
#include "G4tgrRotationMatrix.hh"
class G4tgrRotationMatrixFactory
using G4mstgrrotm = std::map<G4String, G4tgrRotationMatrix*>;
class G4tgrRotationMatrixFactory
{
public: // with desctiption
public:
static G4tgrRotationMatrixFactory* GetInstance();
// Get the only instance (it it does not exists, create it)
G4tgrRotationMatrix* AddRotMatrix( const std::vector<G4String>& wl );
G4tgrRotationMatrix* AddRotMatrix(const std::vector<G4String>& wl);
// Build a G4tgrRotationMatrix and add it to theTgrRotMats
G4tgrRotationMatrix* FindRotMatrix(const G4String& rotm);
// Look for an G4tgrRotationMatrix and if not found return 0
// Look for an G4tgrRotationMatrix and if not found return 0
const G4mstgrrotm& GetRotMatMap() const
{ return theTgrRotMats; }
const G4mstgrrotm& GetRotMatMap() const { return theTgrRotMats; }
std::vector<G4tgrRotationMatrix*> GetRotMatList() const
{ return theTgrRotMatList; }
{
return theTgrRotMatList;
}
void DumpRotmList();
// Dump list of rotation matrices
@@ -71,12 +67,12 @@ class G4tgrRotationMatrixFactory
private:
G4tgrRotationMatrixFactory();
~G4tgrRotationMatrixFactory();
~G4tgrRotationMatrixFactory();
private:
static G4ThreadLocal G4tgrRotationMatrixFactory* theInstance;
std::vector<G4tgrRotationMatrix*> theTgrRotMatList;
G4mstgrrotm theTgrRotMats;
};
+14 -20
View File
@@ -23,57 +23,51 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrSolid
// G4tgrSolid
//
// Class description:
//
// Base class for management of transient solids.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrSolid_h
#define G4tgrSolid_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrSolid_hh
#define G4tgrSolid_hh 1
#include <vector>
#include "globals.hh"
#include "G4ThreeVector.hh"
class G4tgrSolid
{
public: // with description
public:
G4tgrSolid();
G4tgrSolid( const std::vector<G4String>& wl);
G4tgrSolid(const std::vector<G4String>& wl);
virtual ~G4tgrSolid();
friend std::ostream& operator<<(std::ostream&, const G4tgrSolid&);
// Accessors
// Accessors
const G4String& GetName() const { return theName; }
const G4String& GetType() const { return theType; }
const std::vector< std::vector<G4double>* > GetSolidParams() const;
const std::vector<std::vector<G4double>*> GetSolidParams() const;
virtual const G4String& GetRelativeRotMatName() const;
virtual G4ThreeVector GetRelativePlace() const;
private:
void FillSolidParams( const std::vector<G4String>& wl );
void FillSolidParams(const std::vector<G4String>& wl);
protected:
G4String theName;
G4String theName;
// Name of the solid
G4String theType;
G4String theType;
// Type of the solid (Simple, Boolean, Box, Tube, ...)
std::vector< std::vector<G4double>* > theSolidParams;
std::vector<std::vector<G4double>*> theSolidParams;
// Vectors of parameters
};
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrSolidBoolean
// G4tgrSolidBoolean
//
// Class description:
//
@@ -34,25 +31,22 @@
// the Boolean operation of two solids. The type of operation can be:
// Union, Substraction, Intersection.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrSolidBoolean_h
#define G4tgrSolidBoolean_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrSolidBoolean_hh
#define G4tgrSolidBoolean_hh 1
#include <vector>
#include "globals.hh"
#include "G4tgrSolid.hh"
class G4tgrSolidBoolean : public G4tgrSolid
{
public: // with description
public:
G4tgrSolidBoolean(const std::vector<G4String>& wl);
~G4tgrSolidBoolean();
~G4tgrSolidBoolean();
friend std::ostream& operator<<(std::ostream&, const G4tgrSolidBoolean&);
@@ -62,12 +56,12 @@ class G4tgrSolidBoolean : public G4tgrSolid
const G4String& GetRelativeRotMatName() const;
G4ThreeVector GetRelativePlace() const;
private:
private:
// Solid types (Box, Tube, etc) of the solids composing the Boolean solid
std::vector< std::vector<G4double>* > theSolidParams;
// Vectors of parameters.
std::vector<std::vector<G4double>*> theSolidParams;
// Vectors of parameters.
G4String theRelativeRotMatName;
G4ThreeVector theRelativePlace;
@@ -75,18 +69,16 @@ class G4tgrSolidBoolean : public G4tgrSolid
std::vector<const G4tgrSolid*> theSolids;
// The two G4tgrSolid's that combine to make this one
};
inline const G4tgrSolid* G4tgrSolidBoolean::GetSolid( G4int ii ) const
{
inline const G4tgrSolid* G4tgrSolidBoolean::GetSolid(G4int ii) const
{
if((ii != 0) && (ii != 1))
{
std::ostringstream message;
message << "Only two G4tgrSolids (0,1) possible ! Asking for... "
<< ii;
G4Exception("G4tgrSolidBoolean::GetSolid()", "InvalidInput",
FatalException, message);
message << "Only two G4tgrSolids (0,1) possible ! Asking for... " << ii;
G4Exception("G4tgrSolidBoolean::GetSolid()", "InvalidInput", FatalException,
message);
}
return theSolids[ii];
}
+42 -41
View File
@@ -23,82 +23,83 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrUtils
// G4tgrUtils
//
// Class description:
//
// Utility class for managing of strings.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrUtils_h
#define G4tgrUtils_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrUtils_hh
#define G4tgrUtils_hh 1
#include <iostream>
#include <vector>
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
#include "G4tgrEvaluator.hh"
enum WLSIZEtype {WLSIZE_EQ,WLSIZE_NE,WLSIZE_LE,WLSIZE_LT,WLSIZE_GE,WLSIZE_GT};
enum WLSIZEtype
{
WLSIZE_EQ,
WLSIZE_NE,
WLSIZE_LE,
WLSIZE_LT,
WLSIZE_GE,
WLSIZE_GT
};
class G4tgrUtils
{
public: // with description
public:
G4tgrUtils();
~G4tgrUtils();
~G4tgrUtils();
static G4bool IsSeparator(char);
static G4bool IsNumber( const G4String& str);
static G4bool IsInteger( const G4double val,
const G4double precision = 1.e-6 );
static G4bool IsFunction( const G4String& word );
static G4bool IsNumber(const G4String& str);
static G4bool IsInteger(const G4double val,
const G4double precision = 1.e-6);
static G4bool IsFunction(const G4String& word);
// Checks that every character in a G4String is a number
// (also '.' or exponencial notation: 'E')
static G4bool WordIsUnit( const G4String& word );
static G4bool WordIsUnit(const G4String& word);
static void Dump3v( const G4ThreeVector& vec, const char* msg);
static void Dump3v(const G4ThreeVector& vec, const char* msg);
// Dumps a three-vector with a message
static void Dumprm( const G4RotationMatrix& rm, const char* msg);
static void Dumprm(const G4RotationMatrix& rm, const char* msg);
// Dumps a rotation matrix with a message
static void DumpVS( const std::vector<G4String>& wl , const char* msg);
static void DumpVS(const std::vector<G4String>& wl, const char* msg);
// Dumps a vector of G4Strings with a message to cout
static void DumpVS( const std::vector<G4String>& wl , const char* msg,
std::ostream& outs) ;
static void DumpVS(const std::vector<G4String>& wl, const char* msg,
std::ostream& outs);
// Dumps a vector of G4Strings with a message to outs
static void CheckWLsize( const std::vector<G4String>& wl,
unsigned int nWCheck, WLSIZEtype st,
const G4String& methodName );
static G4bool CheckListSize( unsigned int nWreal,
unsigned int nWcheck, WLSIZEtype st,
G4String& outstr );
static void CheckWLsize(const std::vector<G4String>& wl,
unsigned int nWCheck,
WLSIZEtype st, const G4String& methodName);
static G4bool CheckListSize(unsigned int nWreal, unsigned int nWcheck,
WLSIZEtype st, G4String& outstr);
static G4String SubColon( const G4String& str );
static G4String SubColon(const G4String& str);
// Return the str without leading ':'
static G4String GetString( const G4String& str );
static G4String GetString(const G4String& str);
// Return the str without leading and trailing '"' and ' '
static G4double GetDouble( const G4String& str, G4double unitval = 1. );
static G4double GetDouble(const G4String& str, G4double unitval = 1.);
// Convert a G4String to a double, checking that it is really a number
static G4int GetInt( const G4String& str );
static G4int GetInt(const G4String& str);
// Convert a G4String to an integer, checking that it is really an int
static G4bool GetBool( const G4String& str );
static G4bool GetBool(const G4String& str);
// Convert a bool to an integer, checking that it is really a bool
static G4RotationMatrix GetRotationFromDirection( G4ThreeVector dir );
static G4RotationMatrix GetRotationFromDirection(G4ThreeVector dir);
static G4bool AreWordsEquivalent( const G4String& word1,
const G4String& word2 );
static G4bool AreWordsEquivalent(const G4String& word1,
const G4String& word2);
// Looks if word1 and word2 are equivalent, considering that
// word1 may have '*', meaning 'any character'
@@ -107,4 +108,4 @@ class G4tgrUtils
static G4ThreadLocal G4tgrEvaluator* theEvaluator;
};
#endif
#endif
+36 -41
View File
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrVolume
// G4tgrVolume
//
// Class description:
//
@@ -39,18 +36,16 @@
// parents, one parent for each volume placement will be written, even if that
// means that parents are repeated...
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrVolume_h
#define G4tgrVolume_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrVolume_hh
#define G4tgrVolume_hh 1
#include <vector>
#include <map>
#include "globals.hh"
class G4tgrSolid;
class G4tgrPlace;
class G4tgrPlaceDivRep;
@@ -58,66 +53,66 @@ class G4tgrPlaceParameterisation;
class G4tgrVolume
{
public: // with description
public:
G4tgrVolume();
G4tgrVolume( const std::vector<G4String>& wl );
G4tgrVolume( const G4tgrVolume& vol );
G4tgrVolume(const std::vector<G4String>& wl);
G4tgrVolume(const G4tgrVolume& vol);
virtual ~G4tgrVolume();
virtual G4tgrPlace* AddPlace( const std::vector<G4String>& wl );
virtual G4tgrPlace* AddPlace(const std::vector<G4String>& wl);
// Add a position with the data read from a ':place' tag
G4tgrPlaceDivRep* AddPlaceReplica( const std::vector<G4String>& wl );
G4tgrPlaceDivRep* AddPlaceReplica(const std::vector<G4String>& wl);
// Add a replicated position
G4tgrPlaceParameterisation* AddPlaceParam(const std::vector<G4String>& wl);
// Add a parameterised position
void AddVisibility( const std::vector<G4String>& wl );
void AddVisibility(const std::vector<G4String>& wl);
// Add visibility flag
void AddRGBColour( const std::vector<G4String>& wl );
void AddRGBColour(const std::vector<G4String>& wl);
// Add colour
void AddCheckOverlaps( const std::vector<G4String>& wl );
void AddCheckOverlaps(const std::vector<G4String>& wl);
// Add check overlaps flag
// Accessors
const G4String& GetName() const {return theName;}
void SetName(const G4String& name) {theName = name;}
const G4String& GetType() const {return theType;}
G4tgrSolid* GetSolid() const {return theSolid;}
const G4String& GetMaterialName() const {return theMaterialName;}
const G4String& GetName() const { return theName; }
void SetName(const G4String& name) { theName = name; }
const G4String& GetType() const { return theType; }
G4tgrSolid* GetSolid() const { return theSolid; }
const G4String& GetMaterialName() const { return theMaterialName; }
const std::vector<G4tgrPlace*> GetPlacements() const {return thePlacements;}
G4bool GetVisibility() const {return theVisibility;}
G4double* GetColour() const {return theRGBColour;}
G4double* GetRGBColour() const {return theRGBColour;}
G4bool GetVisibility() const { return theVisibility; }
G4double* GetColour() const { return theRGBColour; }
G4double* GetRGBColour() const { return theRGBColour; }
G4bool GetCheckOverlaps() const {return theCheckOverlaps;}
G4bool GetCheckOverlaps() const { return theCheckOverlaps; }
virtual G4tgrVolume* GetVolume( G4int ii ) const;
virtual G4tgrVolume* GetVolume(G4int ii) const;
friend std::ostream& operator<<(std::ostream& os, const G4tgrVolume& obj);
protected:
protected:
G4String theName;
G4String theName = "";
// Name of the volume
G4String theType;
// Type of the volume
G4String theMaterialName;
G4String theType = "";
// Type of the volume
G4String theMaterialName = "";
// Material of which the corresponding PV will be made of
G4tgrSolid* theSolid;
// Solid
G4tgrSolid* theSolid = nullptr;
// Solid
std::vector<G4tgrPlace*> thePlacements;
// Vector of placements
// Vector of placements
G4bool theVisibility;
G4double* theRGBColour;
G4bool theCheckOverlaps;
G4bool theVisibility = false;
G4double* theRGBColour = nullptr;
G4bool theCheckOverlaps = false;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrVolumeAssembly
// G4tgrVolumeAssembly
//
// Class description:
//
// Class for keeping the information of assembly volumes.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrVolumeAssembly_h
#define G4tgrVolumeAssembly_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrVolumeAssembly_hh
#define G4tgrVolumeAssembly_hh 1
#include "globals.hh"
#include "G4tgrVolume.hh"
@@ -45,26 +40,26 @@
class G4tgrVolumeAssembly : public G4tgrVolume
{
public: // with description
public:
G4tgrVolumeAssembly();
G4tgrVolumeAssembly( const std::vector<G4String>& wl );
~G4tgrVolumeAssembly();
G4tgrVolumeAssembly(const std::vector<G4String>& wl);
~G4tgrVolumeAssembly();
virtual G4tgrPlace* AddPlace( const std::vector<G4String>& wl );
virtual G4tgrPlace* AddPlace(const std::vector<G4String>& wl);
// Add a position with the data read from a ':place_assembly' tag
const G4String& GetComponentName(G4int ii) const
{ return theComponentNames[ii]; }
const G4String& GetComponentRM(G4int ii) const
{ return theComponentRMs[ii]; }
G4ThreeVector GetComponentPos(G4int ii) const
{ return theComponentPos[ii]; }
G4int GetNoComponents() const
{ return theComponentNames.size(); }
{
return theComponentNames[ii];
}
const G4String& GetComponentRM(G4int ii) const {return theComponentRMs[ii];}
G4ThreeVector GetComponentPos(G4int ii) const {return theComponentPos[ii];}
G4int GetNoComponents() const { return theComponentNames.size(); }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrVolumeAssembly& obj);
protected:
std::vector<G4String> theComponentNames;
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrVolumeDivision
// G4tgrVolumeDivision
//
// Class description:
//
@@ -38,41 +35,34 @@
// :DIV_STEP "volu_name" "parent_name" "material" step
// "replica_axis_name" offset
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrVolumeDivision_h
#define G4tgrVolumeDivision_h
#include "globals.hh"
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrVolumeDivision_hh
#define G4tgrVolumeDivision_hh 1
#include <map>
#include "globals.hh"
#include "G4tgrVolume.hh"
#include "G4tgrPlaceDivRep.hh"
typedef std::multimap< G4String, G4String > G4mmss;
using G4mmss = std::multimap<G4String, G4String>;
//----------------------------------------------------------------------------
class G4tgrVolumeDivision : public G4tgrVolume
class G4tgrVolumeDivision : public G4tgrVolume
{
public: // with description
public:
G4tgrVolumeDivision( const std::vector<G4String>& wl );
~G4tgrVolumeDivision();
// G4bool SetSolid(G4tgrVolume* parentDU, G4bool byStep,
// EAxis axis, G4double div_step, G4double offset);
// Set the solid type and parameters dividing the mother volune
G4tgrVolumeDivision(const std::vector<G4String>& wl);
~G4tgrVolumeDivision();
G4tgrPlaceDivRep* GetPlaceDivision() { return thePlaceDiv; }
friend std::ostream& operator<<(std::ostream& os,
const G4tgrVolumeDivision& obj);
private:
G4tgrPlaceDivRep* thePlaceDiv;
G4tgrPlaceDivRep* thePlaceDiv = nullptr;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4tgrVolumeMgr
// G4tgrVolumeMgr
//
// Class description:
//
// Class to manage the detector units. It is a singleton.
// History:
// - Created. P.Arce, CIEMAT (November 2007)
// -------------------------------------------------------------------------
#ifndef G4tgrVolumeMgr_h
#define G4tgrVolumeMgr_h
// Author: P.Arce, CIEMAT (November 2007)
// --------------------------------------------------------------------
#ifndef G4tgrVolumeMgr_hh
#define G4tgrVolumeMgr_hh 1
#include "globals.hh"
#include "G4tgrSolid.hh"
@@ -50,80 +45,78 @@
#include <map>
typedef std::map< G4String, G4tgrSolid* > G4mapssol;
typedef std::map< G4String, G4tgrVolume* > G4mapsvol;
typedef std::multimap< G4String, const G4tgrPlace* > G4mmapspl;
using G4mapssol = std::map<G4String, G4tgrSolid*>;
using G4mapsvol = std::map<G4String, G4tgrVolume*>;
using G4mmapspl = std::multimap<G4String, const G4tgrPlace*>;
//----------------------------------------------------------------------------
class G4tgrVolumeMgr
{
public: // with description
class G4tgrVolumeMgr
{
public:
static G4tgrVolumeMgr* GetInstance();
// Get the only instance
static G4tgrVolumeMgr* GetInstance();
// Get the only instance
G4tgrSolid* CreateSolid( const std::vector<G4String>& wl, G4bool bVOLUtag );
G4tgrSolid* CreateSolid(const std::vector<G4String>& wl, G4bool bVOLUtag);
void RegisterParentChild( const G4String& parentName,
const G4tgrPlace* pl );
void RegisterParentChild(const G4String& parentName, const G4tgrPlace* pl);
// Add to theG4tgrVolumeTree
G4tgrSolid* FindSolid( const G4String& name, G4bool exists = false );
G4tgrSolid* FindSolid(const G4String& name, G4bool exists = false);
// Find a G4tgrSolid with name 'name'. If it is not found:
// if exists is true, exit; if exists is false, return 0
// if exists is true, exit; if exists is false, return nullptr
G4tgrVolume* FindVolume( const G4String& volname, G4bool exists = false );
G4tgrVolume* FindVolume(const G4String& volname, G4bool exists = false);
// Find a G4tgrVolume with name 'volname'. If it is not found:
// if exists is true, exit; if exists is false, return 0
// if exists is true, exit; if exists is false, return nullptr
std::vector<G4tgrVolume*> FindVolumes( const G4String& volname,
G4bool exists );
// Find all G4tgrVolume's with name 'volname'. '*' can be used in the
std::vector<G4tgrVolume*> FindVolumes(const G4String& volname,
G4bool exists);
// Find all G4tgrVolume's with name 'volname'. '*' can be used in the
// name to mean 'any character' or 'any substring'. If it is not found:
// if exists is true, exit; if exists is false, return 0
// if exists is true, exit; if exists is false, return nullptr
const G4tgrVolume* GetTopVolume();
const G4tgrVolume* GetTopVolume();
// Find the top of the volume tree
std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
GetChildren( const G4String& name );
GetChildren(const G4String& name);
// Find the list of G4tgrPlace children of G4tgrVolume 'name'
void DumpSummary();
// Dump summary
void DumpVolumeTree();
// Dump to cout the tree of G4tgrVolume's
void DumpVolumeLeaf( const G4tgrVolume* vol, unsigned int copyNo,
unsigned int leafDepth);
void DumpVolumeLeaf(const G4tgrVolume* vol, unsigned int copyNo,
unsigned int leafDepth);
// Dump a G4tgrVolume indicating its copy no
// and its depth (number of ancestors)
void RegisterMe( G4tgrSolid* vol);
void UnRegisterMe( G4tgrSolid* vol );
void RegisterMe( G4tgrVolume* vol);
void UnRegisterMe( G4tgrVolume* vol );
void RegisterMe( G4tgrPlace* pl ) { theG4tgrPlaceList.push_back( pl ); }
void RegisterMe( G4tgrIsotope* iso ) { theHgIsotList.push_back( iso ); }
void RegisterMe( G4tgrElement* ele ) { theHgElemList.push_back( ele ); }
void RegisterMe( G4tgrMaterial* mat ) { theHgMateList.push_back( mat ); }
void RegisterMe( G4tgrRotationMatrix* rm ) { theHgRotMList.push_back(rm); }
void RegisterMe(G4tgrSolid* vol);
void UnRegisterMe(G4tgrSolid* vol);
void RegisterMe(G4tgrVolume* vol);
void UnRegisterMe(G4tgrVolume* vol);
void RegisterMe(G4tgrPlace* pl) { theG4tgrPlaceList.push_back(pl); }
void RegisterMe(G4tgrIsotope* iso) { theHgIsotList.push_back(iso); }
void RegisterMe(G4tgrElement* ele) { theHgElemList.push_back(ele); }
void RegisterMe(G4tgrMaterial* mat) { theHgMateList.push_back(mat); }
void RegisterMe(G4tgrRotationMatrix* rm) { theHgRotMList.push_back(rm); }
// Accessors
const G4mapssol& GetSolidMap() {return theG4tgrSolidMap;}
const G4mapsvol& GetVolumeMap() {return theG4tgrVolumeMap;}
const G4mmapspl& GetVolumeTree() {return theG4tgrVolumeTree;}
std::vector<G4tgrVolume*> GetVolumeList() {return theG4tgrVolumeList;}
std::vector<G4tgrPlace*> GetDetPlaceList() {return theG4tgrPlaceList;}
std::vector<G4tgrIsotope*> GetIsotopeList() {return theHgIsotList;}
std::vector<G4tgrElement*> GetElementList() {return theHgElemList;}
std::vector<G4tgrMaterial*> GetMaterialList() {return theHgMateList;}
std::vector<G4tgrRotationMatrix*> GetRotMList() {return theHgRotMList;}
const G4mapssol& GetSolidMap() { return theG4tgrSolidMap; }
const G4mapsvol& GetVolumeMap() { return theG4tgrVolumeMap; }
const G4mmapspl& GetVolumeTree() { return theG4tgrVolumeTree; }
std::vector<G4tgrVolume*> GetVolumeList() { return theG4tgrVolumeList; }
std::vector<G4tgrPlace*> GetDetPlaceList() { return theG4tgrPlaceList; }
std::vector<G4tgrIsotope*> GetIsotopeList() { return theHgIsotList; }
std::vector<G4tgrElement*> GetElementList() { return theHgElemList; }
std::vector<G4tgrMaterial*> GetMaterialList() { return theHgMateList; }
std::vector<G4tgrRotationMatrix*> GetRotMList() { return theHgRotMList; }
private:
G4tgrVolumeMgr();
~G4tgrVolumeMgr();
~G4tgrVolumeMgr();
private: