Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
+9
View File
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-15 Gabriele Cosmo (detutil-V11-02-01)
- Fixed additional Coverity defect in G4VScoringMesh.
## 2024-07-12 Gabriele Cosmo (detutil-V11-02-00)
- Fixed reported Coverity defects, use consistently 'const G4String&' to
avoid implicit copy.
- Fixed class description in headers.
- Use G4 types.
## 2023-05-24 Makoto Asai (detutil-V11-01-01)
- Additional fix for probe scorer.
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4DefaultLinearColorMap
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4DefaultLinearColorMap_h
#define G4DefaultLinearColorMap_h 1
@@ -35,10 +36,10 @@
class G4DefaultLinearColorMap : public G4VScoreColorMap
{
public:
using G4VScoreColorMap::G4VScoreColorMap;
~G4DefaultLinearColorMap() override = default;
public:
void GetMapColor(G4double val, G4double color[4]) override;
};
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoreLogColorMap
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoreLogColorMap_h
#define G4ScoreLogColorMap_h 1
@@ -35,10 +36,10 @@
class G4ScoreLogColorMap : public G4VScoreColorMap
{
public:
using G4VScoreColorMap::G4VScoreColorMap;
~G4ScoreLogColorMap() override = default;
public:
void GetMapColor(G4double val, G4double color[4]) override;
// draw a color chart
@@ -23,21 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoreQuantityMessenger
//
// Class description:
//
// (HISTORY)
// 03-Sep-2007 T.Aso Command definitions are introduced.
// 01-Nov-2007 M.Asai Class is splited into two.
// 20-Jul-2010 T.Aso Specify unit for scorer
// 24-Mar-2011 T.Aso Add StepChecker for debugging.
// This is a concrete class of G4UImessenger which handles the
// commands for G4ScoringManager.
//
// Author: Tsukasa Aso (KEK), September 2007
// --------------------------------------------------------------------
#ifndef G4ScoreQuantityMessenger_h
#define G4ScoreQuantityMessenger_h 1
#include "G4String.hh"
#include "G4UImessenger.hh"
#include <vector>
#include "G4String.hh"
class G4ScoringManager;
class G4VScoringMesh;
@@ -48,15 +49,10 @@ class G4UIcommand;
using G4TokenVec = std::vector<G4String>;
// class description:
//
// This is a concrete class of G4UImessenger which handles the commands for
// G4ScoringManager.
//
class G4ScoreQuantityMessenger : public G4UImessenger
{
public:
G4ScoreQuantityMessenger(G4ScoringManager* SManager);
~G4ScoreQuantityMessenger() override;
@@ -66,19 +62,22 @@ class G4ScoreQuantityMessenger : public G4UImessenger
G4String GetCurrentValue(G4UIcommand*) override;
protected:
void FillTokenVec(G4String newValues, G4TokenVec& token);
void FillTokenVec(const G4String& newValues, G4TokenVec& token);
void FParticleCommand(G4VScoringMesh* mesh, G4TokenVec& token);
void FParticleWithEnergyCommand(G4VScoringMesh* mesh, G4TokenVec& token);
G4bool CheckMeshPS(G4VScoringMesh* mesh, G4String& psname,
G4bool CheckMeshPS(G4VScoringMesh* mesh, const G4String& psname,
G4UIcommand* command);
private:
void QuantityCommands();
void FilterCommands();
private:
G4ScoringManager* fSMan;
//
// Quantity commands
@@ -23,42 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringBox
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoringBox_h
#define G4ScoringBox_h 1
#include "globals.hh"
#include "G4VScoringMesh.hh"
#include "G4RotationMatrix.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VPrimitiveScorer;
class G4VScoreColorMap;
#include <vector>
class G4ScoringBox : public G4VScoringMesh
{
public:
G4ScoringBox(G4String wName);
G4ScoringBox(const G4String& wName);
~G4ScoringBox() override = default;
public:
void List() const override;
void Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg = 111) override;
void DrawColumn(RunScore* map, G4VScoreColorMap* colorMap, G4int idxProj,
G4int idxColumn) override;
// set a direction to segment this mesh
void SetSegmentDirection(G4int dir) { fSegmentDirection = dir; }
inline void SetSegmentDirection(G4int dir) { fSegmentDirection = dir; }
protected:
// construct this mesh
void SetupGeometry(G4VPhysicalVolume* fWorldPhys) override;
private:
// get replicated position from 3D index (x,y,z)
G4ThreeVector GetReplicaPosition(G4int x, G4int y, G4int z);
// get 3D index (x,y,z) from sequential index
@@ -67,6 +71,7 @@ class G4ScoringBox : public G4VScoringMesh
G4int GetIndex(G4int x, G4int y, G4int z) const;
private:
G4int fSegmentDirection; // =1: x, =2: y, =3: z
};
@@ -23,33 +23,34 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringCylinder
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoringCylinder_h
#define G4ScoringCylinder_h 1
#include "globals.hh"
#include "G4VScoringMesh.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VPrimitiveScorer;
#include <vector>
class G4ScoringCylinder : public G4VScoringMesh
{
public:
G4ScoringCylinder(G4String wName);
G4ScoringCylinder(const G4String& wName);
~G4ScoringCylinder() override = default;
public:
void List() const override;
void Draw(RunScore* map, G4VScoreColorMap* colorMap,
G4int axflg = 111) override;
G4int axflg = 111) override;
void DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn) override;
G4int idxProj, G4int idxColumn) override;
void SetRMin(G4double rMin) { fSize[0] = rMin; }
void SetRMax(G4double rMax) { fSize[1] = rMax; }
@@ -61,9 +62,11 @@ class G4ScoringCylinder : public G4VScoringMesh
void GetRZPhi(G4int index, G4int q[3]) const;
protected:
void SetupGeometry(G4VPhysicalVolume* fWorldPhys) override;
private:
// Xin Dong 09302011 for Scorers
enum IDX
{
@@ -23,30 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringManager
//
// Class description:
//
// This is a singleton class which manages the interactive scoring.
// The user cannot access to the constructor. The pointer of the
// only existing object can be got via G4ScoringManager::GetScoringManager()
// static method. The first invocation of this static method makes
// the singleton object.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoringManager_h
#define G4ScoringManager_h 1
#include "globals.hh"
#include "G4VScoringMesh.hh"
#include "G4VScoreWriter.hh"
#include <vector>
#include <map>
class G4ScoringMessenger;
class G4ScoreQuantityMessenger;
class G4VHitsCollection;
class G4VScoreColorMap;
#include "G4VScoreWriter.hh"
// class description:
//
// This is a singleton class which manages the interactive scoring.
// The user cannot access to the constructor. The pointer of the
// only existing object can be got via G4ScoringManager::GetScoringManager()
// static method. The first invokation of this static method makes
// the singleton object.
//
using MeshVec = std::vector<G4VScoringMesh *>;
using MeshVecItr = MeshVec::iterator;
@@ -60,15 +62,18 @@ using MeshMapConstItr = MeshMap::const_iterator;
class G4ScoringManager
{
public: // with description
public:
static G4ScoringManager* GetScoringManager();
// Returns the pointer to the singleton object.
static G4ScoringManager* GetScoringManagerIfExist();
G4ScoringManager(const G4ScoringManager&) = delete;
G4ScoringManager& operator=(const G4ScoringManager&) = delete;
~G4ScoringManager();
public:
static void SetReplicaLevel(G4int);
static G4int GetReplicaLevel();
@@ -109,7 +114,7 @@ class G4ScoringManager
writer->SetVerboseLevel(vl);
}
inline G4int GetVerboseLevel() const { return verboseLevel; }
inline size_t GetNumberOfMesh() const { return fMeshVec.size(); }
inline std::size_t GetNumberOfMesh() const { return fMeshVec.size(); }
inline void RegisterScoringMesh(G4VScoringMesh* scm)
{
scm->SetVerboseLevel(verboseLevel);
@@ -117,12 +122,11 @@ class G4ScoringManager
SetCurrentMesh(scm);
}
inline G4VScoringMesh* GetMesh(G4int i) const { return fMeshVec[i]; }
inline G4String GetWorldName(G4int i) const
inline const G4String& GetWorldName(G4int i) const
{
return fMeshVec[i]->GetWorldName();
}
public: // with description
inline void SetScoreWriter(G4VScoreWriter* sw)
{
delete writer;
@@ -132,7 +136,6 @@ class G4ScoringManager
}
// Replace score writers.
public:
inline void SetFactor(G4double val = 1.0)
{
if(writer != nullptr)
@@ -149,16 +152,14 @@ class G4ScoringManager
}
protected:
G4ScoringManager();
private:
// Disable copy constructor and assignement operator
G4ScoringManager(const G4ScoringManager&);
G4ScoringManager& operator=(const G4ScoringManager&);
private:
static G4ThreadLocal G4ScoringManager* fSManager;
static G4ThreadLocal G4int replicaLevel;
G4int verboseLevel;
G4ScoringMessenger* fMessenger;
G4ScoreQuantityMessenger* fQuantityMessenger;
@@ -23,21 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringMessenger
//
// Class description:
//
// (HISTORY)
// 03-Sep-2007 T.Aso Command definitions are introduced.
// 01-Nov-2007 M.Asai Class is splitted into two.
// 18-Feb-2008 T.Aso Command for cylindrical scorer.
// 18-Feb-2008 T.Aso Command for color chart display.
// This is a concrete class of G4UImessenger which handles the
// commands for G4ScoringManager.
//
// Author: Tsukasa Aso (KEK), September 2007
// --------------------------------------------------------------------
#ifndef G4ScoringMessenger_h
#define G4ScoringMessenger_h 1
#include "G4String.hh"
#include "G4UImessenger.hh"
#include <vector>
#include "G4String.hh"
class G4ScoringManager;
class G4VScoringMesh;
@@ -52,15 +53,10 @@ class G4UIcommand;
using G4TokenVec = std::vector<G4String>;
// class description:
//
// This is a concrete class of G4UImessenger which handles the commands for
// G4ScoringManager.
//
class G4ScoringMessenger : public G4UImessenger
{
public:
G4ScoringMessenger(G4ScoringManager* SManager);
~G4ScoringMessenger() override;
@@ -70,11 +66,13 @@ class G4ScoringMessenger : public G4UImessenger
G4String GetCurrentValue(G4UIcommand* command) override;
protected:
void FillTokenVec(G4String newValues, G4TokenVec& token);
void FillTokenVec(const G4String& newValues, G4TokenVec& token);
void MeshBinCommand(G4VScoringMesh* mesh, G4TokenVec& token);
void Fill1D(G4UIcommand* cmd, G4String newValues);
void Fill1D(G4UIcommand* cmd, const G4String& newValues);
private:
G4ScoringManager* fSMan;
G4UIdirectory* scoreDir;
G4UIcmdWithoutParameter* listCmd;
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringProbe
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoringProbe_h
#define G4ScoringProbe_h 1
@@ -39,11 +41,11 @@ class G4Material;
class G4ScoringProbe : public G4VScoringMesh
{
public:
G4ScoringProbe(G4String lvName, G4double half_size,
G4ScoringProbe(const G4String& lvName, G4double half_size,
G4bool checkOverlap = false);
~G4ScoringProbe() override = default;
public:
void LocateProbe(G4ThreeVector pos)
{
posVec.push_back(pos);
@@ -59,17 +61,17 @@ class G4ScoringProbe : public G4VScoringMesh
//++++++++++ visualization method not yet implemented
void Draw(RunScore* /*map*/, G4VScoreColorMap* /*colorMap*/,
G4int /*axflg=111*/) override
{}
G4int /*axflg=111*/) override {}
void DrawColumn(RunScore* /*map*/, G4VScoreColorMap* /*colorMap*/,
G4int /*idxProj*/, G4int /*idxColumn*/) override
{}
G4int /*idxProj*/, G4int /*idxColumn*/) override {}
protected:
// construct scoring volume
void SetupGeometry(G4VPhysicalVolume*) override;
protected:
G4String logVolName;
std::vector<G4ThreeVector> posVec;
G4double probeSize;
@@ -23,37 +23,41 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringRealWorld
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4ScoringRealWorld_h
#define G4ScoringRealWorld_h 1
#include "globals.hh"
#include "G4VScoringMesh.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4ScoringRealWorld : public G4VScoringMesh
{
public:
G4ScoringRealWorld(G4String lvName);
G4ScoringRealWorld(const G4String& lvName);
~G4ScoringRealWorld() override = default;
public:
void List() const override;
//++++++++++ visualization method not yet implemented
void Draw(RunScore* /*map*/, G4VScoreColorMap* /*colorMap*/,
G4int /*axflg=111*/) override
{}
G4int /*axflg=111*/) override {}
void DrawColumn(RunScore* /*map*/, G4VScoreColorMap* /*colorMap*/,
G4int /*idxProj*/, G4int /*idxColumn*/) override
{}
G4int /*idxProj*/, G4int /*idxColumn*/) override {}
protected:
// construct this mesh
void SetupGeometry(G4VPhysicalVolume*) override;
protected:
G4String logVolName;
};
@@ -23,9 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TScoreNtupleWriter
//
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
// Class description:
//
// This class implements storing hits collections of G4THitsMap<G4double>
// type vith Geant4 analysis tools.
// In order to avoid introducing dependency on the analysis category,
// the analysis manager type is defined via template.
//
// An n-tuple with three columns is created for each primitive scorer:
// G4int column - eventNumber
// G4int column - copyNumber
// G4double column - scored value
//
// Author: Ivana Hrivnacova, 30/10/2018
// --------------------------------------------------------------------
#ifndef G4TScoreNtupleWriter_h
#define G4TScoreNtupleWriter_h 1
@@ -42,22 +55,11 @@ template <typename T>
class G4TScoreNtupleWriterMessenger;
class G4HCofThisEvent;
// class description:
//
// This class implements storing hits collections of G4THitsMap<G4double>
// type vith Geant4 analysis tools.
// In order to avoid introducing dependency on the analysis category,
// the analysis manager type is defined via template.
//
// An ntuple with three columns is created for each primitive scorer:
// int column - eventNumber
// int column - copyNumber
// double column - scored value
template <typename T>
class G4TScoreNtupleWriter : public G4VScoreNtupleWriter
{
public:
G4TScoreNtupleWriter();
virtual ~G4TScoreNtupleWriter();
@@ -74,14 +76,16 @@ class G4TScoreNtupleWriter : public G4VScoreNtupleWriter
void SetNtupleMerging(G4bool value);
// get methods
G4String GetFileName() const { return fFileName; }
const G4String& GetFileName() const { return fFileName; }
G4int GetVerboseLevel() const { return fVerboseLevel; }
protected:
// methods
virtual G4VScoreNtupleWriter* CreateInstance() const;
private:
// methods
void CreateAnalysisManager();
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TScoreNtupleWriter inline methods
//
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
// ---------------------------------------------------------------------
// Author: Ivana Hrivnacova, 30/10/2018
// --------------------------------------------------------------------
#include "G4TScoreNtupleWriterMessenger.hh"
#include "G4THitsMap.hh"
@@ -23,9 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TScoreNtupleWriterMessenger
//
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
// Class description:
//
// This is a concrete class of G4UImessenger which handles the commands for
// G4TScoreNtupleWriter. This class has the following commands:
// /score/writerFileName filename
// /score/writerVerbose value
//
// Author: Ivana Hrivnacova, 30/10/2018
// --------------------------------------------------------------------
#ifndef G4TScoreNtupleWriterMessenger_h
#define G4TScoreNtupleWriterMessenger_h 1
@@ -39,14 +47,6 @@ class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
// class description:
//
// This is a concrete class of G4UImessenger which handles the commands for
// G4TScoreNtupleWriter. This class has the following commands:
// /score/writerFileName filename
// /score/writerVerbose value
//
template <typename T>
class G4TScoreNtupleWriterMessenger : public G4UImessenger
{
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TScoreNtupleWriterMessenger inline methods
//
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
// Author: Ivana Hrivnacova, 30/10/2018
// --------------------------------------------------------------------
#include "G4TScoreNtupleWriterMessenger.hh"
#include "G4TScoreNtupleWriter.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VScoreColorMap
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VScoreColorMap_h
#define G4VScoreColorMap_h 1
@@ -36,14 +37,13 @@ class G4VVisManager;
class G4VScoreColorMap
{
public:
G4VScoreColorMap(G4String mName);
G4VScoreColorMap(const G4String& mName);
virtual ~G4VScoreColorMap() = default;
public:
virtual void GetMapColor(G4double val, G4double color[4]) = 0;
public:
inline G4String GetName() const { return fName; }
inline const G4String& GetName() const { return fName; }
inline void SetFloatingMinMax(G4bool vl = true) { ifFloat = vl; }
inline G4bool IfFloatMinMax() const { return ifFloat; }
inline void SetMinMax(G4double minVal, G4double maxVal)
@@ -72,10 +72,11 @@ class G4VScoreColorMap
virtual void DrawColorChartText(G4int nPoint);
void SetPSUnit(G4String& unit) { fPSUnit = unit; }
void SetPSName(G4String& psName) { fPSName = psName; }
void SetPSUnit(const G4String& unit) { fPSUnit = unit; }
void SetPSName(const G4String& psName) { fPSName = psName; }
protected:
G4String fName;
G4bool ifFloat = true;
G4double fMinVal = 0.0;
@@ -23,9 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VScoreNtupleWriter
//
// Author: Ivana Hrivnacova, 11/09/2018 (ivana@ipno.in2p3.fr)
// Class description:
//
// This class implements the interface for storing hits collections of
// G4THitsMap<G4double> type vith Geant4 analysis tools.
//
// Author: Ivana Hrivnacova, 11/09/2018
// --------------------------------------------------------------------
#ifndef G4VScoreNtupleWriter_h
#define G4VScoreNtupleWriter_h 1
@@ -34,14 +40,10 @@
class G4HCofThisEvent;
// class description:
//
// This class implements the interface for storing hits collections of
// G4THitsMap<G4double> type vith Geant4 analysis tools.
class G4VScoreNtupleWriter
{
public:
virtual ~G4VScoreNtupleWriter();
// static methods
@@ -54,6 +56,7 @@ class G4VScoreNtupleWriter
virtual void Write() = 0;
protected:
G4VScoreNtupleWriter();
virtual G4VScoreNtupleWriter* CreateInstance() const = 0;
@@ -23,27 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VScoreWriter
//
// Class description:
//
// This class represents storing the scored quantity into a file.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VScoreWriter_h
#define G4VScoreWriter_h 1
#include "globals.hh"
class G4VScoringMesh;
// class description:
//
// This class represents storing the scored quantity into a file.
//
class G4VScoringMesh;
class G4VScoreWriter
{
public:
G4VScoreWriter() = default;
virtual ~G4VScoreWriter() = default;
public:
// store a quantity into a file
virtual void DumpQuantityToFile(const G4String& psName,
const G4String& fileName,
@@ -60,10 +61,12 @@ class G4VScoreWriter
inline G4double GetFactor() const { return fact; }
protected:
// get an index from (x,y,z)
G4int GetIndex(G4int x, G4int y, G4int z) const;
protected:
G4int fNMeshSegments[3] = {0, 0, 0}; // number of segments of the mesh
G4VScoringMesh* fScoringMesh = nullptr;
G4int verboseLevel = 0;
@@ -23,9 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VScoringMesh
//
// Class description:
//
// This class represents a multi-functional detector to be used by
// command-based scorer for parallel world scorer, this class creates a
// parallel world mesh geometry
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VScoringMesh_h
#define G4VScoringMesh_h 1
@@ -34,6 +41,8 @@
#include "G4RotationMatrix.hh"
#include "G4StatDouble.hh"
#include <map>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4MultiFunctionalDetector;
@@ -42,15 +51,6 @@ class G4VSDFilter;
class G4VScoreColorMap;
class G4ParallelWorldProcess;
#include <map>
// class description:
//
// This class represents a multi-functional detector to be used by
// command-based scorer For parallel world scorer, this class creates a
// parallel world mesh geometry
//
class G4VScoringMesh
{
public:
@@ -68,10 +68,10 @@ class G4VScoringMesh
using MeshScoreMap = std::map<G4String, RunScore*>;
public:
G4VScoringMesh(const G4String& wName);
virtual ~G4VScoringMesh() = default;
public: // with description
virtual void Construct(G4VPhysicalVolume* fWorldPhys);
virtual void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
@@ -132,7 +132,7 @@ class G4VScoringMesh
// set a rotation angle around the z axis
void RotateZ(G4double delta);
// get a rotation matrix
G4RotationMatrix GetRotationMatrix() const
inline G4RotationMatrix GetRotationMatrix() const
{
if(fRotationMatrix != nullptr)
return *fRotationMatrix;
@@ -154,7 +154,7 @@ class G4VScoringMesh
// find registered primitive scorer by the name
G4bool FindPrimitiveScorer(const G4String& psname);
// get whether current primitive scorer is set or not
G4bool IsCurrentPrimitiveScorerNull()
inline G4bool IsCurrentPrimitiveScorerNull()
{
return fCurrentPS == nullptr;
}
@@ -167,7 +167,7 @@ class G4VScoringMesh
// get unit value of primitive scorer by the name
G4double GetPSUnitValue(const G4String& psname);
// set PS name to be drawn
void SetDrawPSName(const G4String& psname) { fDrawPSName = psname; }
inline void SetDrawPSName(const G4String& psname) { fDrawPSName = psname; }
// get axis names of the hierarchical division in the divided order
void GetDivisionAxisNames(G4String divisionAxisNames[3]);
@@ -213,13 +213,15 @@ class G4VScoringMesh
inline void SetCopyNumberLevel(G4int val) { copyNumberLevel = val; }
inline G4int GetCopyNumberLevel() const { return copyNumberLevel; }
G4bool LayeredMassFlg() { return layeredMassFlg; }
inline G4bool LayeredMassFlg() { return layeredMassFlg; }
protected:
// a pure virtual function to construct this mesh geometry
virtual void SetupGeometry(G4VPhysicalVolume* fWorldPhys) = 0;
protected:
G4String fWorldName;
G4VPrimitiveScorer* fCurrentPS;
G4bool fConstructed;
@@ -23,18 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// G4ScoreQuantityMessenger
//
// ---------------------------------------------------------------------
// Modifications
// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
// 24-Mar-2011 T.Aso Add StepChecker for debugging.
// 24-Mar-2011 T.Aso Size and segmentation for replicated cylinder.
// 01-Jun-2012 T.Aso Support weighted/dividedByArea options
// in flatCurrent and flatFulx commands.
// 27-Mar-2013 T.Aso Unit option in the kineticEnergy filter was
// supported.
//
// 08-Oct-2010 T.Aso Remove unit of G4PSPassageCellCurrent.
// 24-Mar-2011 T.Aso Add StepChecker for debugging.
// 24-Mar-2011 T.Aso Size and segmentation for replicated cylinder.
// 01-Jun-2012 T.Aso Support weighted/dividedByArea options
// in flatCurrent and flatFulx commands.
// 27-Mar-2013 T.Aso Unit option in the kineticEnergy filter was supported.
// ---------------------------------------------------------------------
#include "G4ScoreQuantityMessenger.hh"
@@ -1062,7 +1060,7 @@ G4String G4ScoreQuantityMessenger::GetCurrentValue(G4UIcommand* /*command*/)
return val;
}
void G4ScoreQuantityMessenger::FillTokenVec(G4String newValues,
void G4ScoreQuantityMessenger::FillTokenVec(const G4String& newValues,
G4TokenVec& token)
{
G4Tokenizer next(newValues);
@@ -1108,7 +1106,7 @@ void G4ScoreQuantityMessenger::FParticleWithEnergyCommand(G4VScoringMesh* mesh,
}
G4bool G4ScoreQuantityMessenger::CheckMeshPS(G4VScoringMesh* mesh,
G4String& psname,
const G4String& psname,
G4UIcommand* command)
{
if(!mesh->FindPrimitiveScorer(psname))
+53 -53
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4ScoringBox
// --------------------------------------------------------------------
#include "G4ScoringBox.hh"
@@ -50,7 +50,7 @@
#include <map>
#include <fstream>
G4ScoringBox::G4ScoringBox(G4String wName)
G4ScoringBox::G4ScoringBox(const G4String& wName)
: G4VScoringMesh(wName)
, fSegmentDirection(-1)
{
@@ -242,29 +242,29 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
if(pVisManager != nullptr)
{
// cell vectors
std::vector<std::vector<std::vector<double>>> cell; // cell[X][Y][Z]
std::vector<double> ez;
for(int z = 0; z < fNSegment[2]; z++)
std::vector<std::vector<std::vector<G4double>>> cell; // cell[X][Y][Z]
std::vector<G4double> ez;
for(G4int z = 0; z < fNSegment[2]; z++)
ez.push_back(0.);
std::vector<std::vector<double>> eyz;
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> eyz;
for(G4int y = 0; y < fNSegment[1]; y++)
eyz.push_back(ez);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
cell.push_back(eyz);
std::vector<std::vector<double>> xycell; // xycell[X][Y]
std::vector<double> ey;
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> xycell; // xycell[X][Y]
std::vector<G4double> ey;
for(G4int y = 0; y < fNSegment[1]; y++)
ey.push_back(0.);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
xycell.push_back(ey);
std::vector<std::vector<double>> yzcell; // yzcell[Y][Z]
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> yzcell; // yzcell[Y][Z]
for(G4int y = 0; y < fNSegment[1]; y++)
yzcell.push_back(ez);
std::vector<std::vector<double>> xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++)
std::vector<std::vector<G4double>> xzcell; // xzcell[X][Z]
for(G4int x = 0; x < fNSegment[0]; x++)
xzcell.push_back(ez);
// projections
@@ -282,16 +282,16 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
// search max. & min. values in each slice
G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
G4double xymax = 0., yzmax = 0., xzmax = 0.;
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
if(xymin > xycell[x][y])
xymin = xycell[x][y];
if(xymax < xycell[x][y])
xymax = xycell[x][y];
}
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
if(xzmin > xzcell[x][z])
xzmin = xzcell[x][z];
@@ -299,9 +299,9 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
xzmax = xzcell[x][z];
}
}
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
if(yzmin > yzcell[y][z])
yzmin = yzcell[y][z];
@@ -326,9 +326,9 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
colorMap->SetMinMax(xymin, xymax);
}
G4ThreeVector zhalf(0., 0., fSize[2] / fNSegment[2] - thick);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2] - 1) +
@@ -378,9 +378,9 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
colorMap->SetMinMax(yzmin, yzmax);
}
G4ThreeVector xhalf(fSize[0] / fNSegment[0] - thick, 0., 0.);
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
G4ThreeVector pos2(GetReplicaPosition(fNSegment[0] - 1, y, z) +
@@ -430,9 +430,9 @@ void G4ScoringBox::Draw(RunScore* map, G4VScoreColorMap* colorMap, G4int axflg)
colorMap->SetMinMax(xzmin, xzmax);
}
G4ThreeVector yhalf(0., fSize[1] / fNSegment[1] - thick, 0.);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1] - 1, z) +
@@ -518,29 +518,29 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
pVisManager->BeginDraw();
// cell vectors
std::vector<std::vector<std::vector<double>>> cell; // cell[X][Y][Z]
std::vector<double> ez;
for(int z = 0; z < fNSegment[2]; z++)
std::vector<std::vector<std::vector<G4double>>> cell; // cell[X][Y][Z]
std::vector<G4double> ez;
for(G4int z = 0; z < fNSegment[2]; z++)
ez.push_back(0.);
std::vector<std::vector<double>> eyz;
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> eyz;
for(G4int y = 0; y < fNSegment[1]; y++)
eyz.push_back(ez);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
cell.push_back(eyz);
std::vector<std::vector<double>> xycell; // xycell[X][Y]
std::vector<double> ey;
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> xycell; // xycell[X][Y]
std::vector<G4double> ey;
for(G4int y = 0; y < fNSegment[1]; y++)
ey.push_back(0.);
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
xycell.push_back(ey);
std::vector<std::vector<double>> yzcell; // yzcell[Y][Z]
for(int y = 0; y < fNSegment[1]; y++)
std::vector<std::vector<G4double>> yzcell; // yzcell[Y][Z]
for(G4int y = 0; y < fNSegment[1]; y++)
yzcell.push_back(ez);
std::vector<std::vector<double>> xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++)
std::vector<std::vector<G4double>> xzcell; // xzcell[X][Z]
for(G4int x = 0; x < fNSegment[0]; x++)
xzcell.push_back(ez);
// projections
@@ -567,16 +567,16 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
// search max. & min. values in each slice
G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
G4double xymax = 0., yzmax = 0., xzmax = 0.;
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
if(xymin > xycell[x][y])
xymin = xycell[x][y];
if(xymax < xycell[x][y])
xymax = xycell[x][y];
}
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
if(xzmin > xzcell[x][z])
xzmin = xzcell[x][z];
@@ -584,9 +584,9 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
xzmax = xzcell[x][z];
}
}
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
if(yzmin > yzcell[y][z])
yzmin = yzcell[y][z];
@@ -607,9 +607,9 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
{
colorMap->SetMinMax(xymin, xymax);
}
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
G4Box xyplate("xy", fSize[0] / fNSegment[0], fSize[1] / fNSegment[1],
fSize[2] / fNSegment[2]);
@@ -644,9 +644,9 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
{
colorMap->SetMinMax(yzmin, yzmax);
}
for(int y = 0; y < fNSegment[1]; y++)
for(G4int y = 0; y < fNSegment[1]; y++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
G4Box yzplate("yz", fSize[0] / fNSegment[0], fSize[1] / fNSegment[1],
fSize[2] / fNSegment[2]);
@@ -681,9 +681,9 @@ void G4ScoringBox::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
{
colorMap->SetMinMax(xzmin, xzmax);
}
for(int x = 0; x < fNSegment[0]; x++)
for(G4int x = 0; x < fNSegment[0]; x++)
{
for(int z = 0; z < fNSegment[2]; z++)
for(G4int z = 0; z < fNSegment[2]; z++)
{
G4Box xzplate("xz", fSize[0] / fNSegment[0], fSize[1] / fNSegment[1],
fSize[2] / fNSegment[2]);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4ScoringCylinder
// --------------------------------------------------------------------
#include "G4ScoringCylinder.hh"
@@ -45,7 +45,16 @@
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include "G4VSensitiveDetector.hh"
#include "G4VSolid.hh"
G4ScoringCylinder::G4ScoringCylinder(const G4String& wName)
: G4VScoringMesh(wName)
{
fShape = MeshShape::cylinder;
@@ -248,16 +257,16 @@ void G4ScoringCylinder::Draw(RunScore* map, G4VScoreColorMap* colorMap,
if(pVisManager != nullptr)
{
// cell vectors
std::vector<double> ephi;
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
std::vector<G4double> ephi;
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
ephi.push_back(0.);
//-
std::vector<std::vector<double>> zphicell; // zphicell[Z][PHI]
for(int z = 0; z < fNSegment[IZ]; z++)
std::vector<std::vector<G4double>> zphicell; // zphicell[Z][PHI]
for(G4int z = 0; z < fNSegment[IZ]; z++)
zphicell.push_back(ephi);
//-
std::vector<std::vector<double>> rphicell; // rphicell[R][PHI]
for(int r = 0; r < fNSegment[IR]; r++)
std::vector<std::vector<G4double>> rphicell; // rphicell[R][PHI]
for(G4int r = 0; r < fNSegment[IR]; r++)
rphicell.push_back(ephi);
// projections
@@ -279,16 +288,16 @@ void G4ScoringCylinder::Draw(RunScore* map, G4VScoreColorMap* colorMap,
// search min./max. values
G4double zphimin = DBL_MAX, rphimin = DBL_MAX;
G4double zphimax = 0., rphimax = 0.;
for(int iphi = 0; iphi < fNSegment[IPHI]; iphi++)
for(G4int iphi = 0; iphi < fNSegment[IPHI]; iphi++)
{
for(int iz = 0; iz < fNSegment[IZ]; iz++)
for(G4int iz = 0; iz < fNSegment[IZ]; iz++)
{
if(zphimin > zphicell[iz][iphi])
zphimin = zphicell[iz][iphi];
if(zphimax < zphicell[iz][iphi])
zphimax = zphicell[iz][iphi];
}
for(int ir = 0; ir < fNSegment[IR]; ir++)
for(G4int ir = 0; ir < fNSegment[IR]; ir++)
{
if(rphimin > rphicell[ir][iphi])
rphimin = rphicell[ir][iphi];
@@ -318,9 +327,9 @@ void G4ScoringCylinder::Draw(RunScore* map, G4VScoreColorMap* colorMap,
}
G4double zhalf = fSize[2] / fNSegment[IZ];
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
{
for(int z = 0; z < fNSegment[IZ]; z++)
for(G4int z = 0; z < fNSegment[IZ]; z++)
{
//-
G4double angle = fAngle[0] + fAngle[1] / fNSegment[IPHI] * phi;
@@ -368,9 +377,9 @@ void G4ScoringCylinder::Draw(RunScore* map, G4VScoreColorMap* colorMap,
}
G4double rsize = (fSize[1] - fSize[0]) / fNSegment[IR];
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
{
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
{
G4double rs[2] = { fSize[0] + rsize * r, fSize[0] + rsize * (r + 1) };
G4double angle = fAngle[0] + fAngle[1] / fNSegment[IPHI] * phi;
@@ -448,29 +457,29 @@ void G4ScoringCylinder::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
if(pVisManager != nullptr)
{
// cell vectors
std::vector<std::vector<std::vector<double>>> cell; // cell[R][Z][PHI]
std::vector<double> ephi;
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
std::vector<std::vector<std::vector<G4double>>> cell; // cell[R][Z][PHI]
std::vector<G4double> ephi;
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
ephi.push_back(0.);
std::vector<std::vector<double>> ezphi;
for(int z = 0; z < fNSegment[IZ]; z++)
std::vector<std::vector<G4double>> ezphi;
for(G4int z = 0; z < fNSegment[IZ]; z++)
ezphi.push_back(ephi);
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
cell.push_back(ezphi);
std::vector<std::vector<double>> rzcell; // rzcell[R][Z]
std::vector<double> ez;
for(int z = 0; z < fNSegment[IZ]; z++)
std::vector<std::vector<G4double>> rzcell; // rzcell[R][Z]
std::vector<G4double> ez;
for(G4int z = 0; z < fNSegment[IZ]; z++)
ez.push_back(0.);
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
rzcell.push_back(ez);
std::vector<std::vector<double>> zphicell; // zphicell[Z][PHI]
for(int z = 0; z < fNSegment[IZ]; z++)
std::vector<std::vector<G4double>> zphicell; // zphicell[Z][PHI]
for(G4int z = 0; z < fNSegment[IZ]; z++)
zphicell.push_back(ephi);
std::vector<std::vector<double>> rphicell; // rphicell[R][PHI]
for(int r = 0; r < fNSegment[IR]; r++)
std::vector<std::vector<G4double>> rphicell; // rphicell[R][PHI]
for(G4int r = 0; r < fNSegment[IR]; r++)
rphicell.push_back(ephi);
// projections
@@ -502,16 +511,16 @@ void G4ScoringCylinder::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
// search min./max. values
G4double rzmin = DBL_MAX, zphimin = DBL_MAX, rphimin = DBL_MAX;
G4double rzmax = 0., zphimax = 0., rphimax = 0.;
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
{
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
{
if(rphimin > rphicell[r][phi])
rphimin = rphicell[r][phi];
if(rphimax < rphicell[r][phi])
rphimax = rphicell[r][phi];
}
for(int z = 0; z < fNSegment[IZ]; z++)
for(G4int z = 0; z < fNSegment[IZ]; z++)
{
if(rzmin > rzcell[r][z])
rzmin = rzcell[r][z];
@@ -519,9 +528,9 @@ void G4ScoringCylinder::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
rzmax = rzcell[r][z];
}
}
for(int z = 0; z < fNSegment[IZ]; z++)
for(G4int z = 0; z < fNSegment[IZ]; z++)
{
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
{
if(zphimin > zphicell[z][phi])
zphimin = zphicell[z][phi];
@@ -593,9 +602,9 @@ void G4ScoringCylinder::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
}
G4double rsize = (fSize[1] - fSize[0]) / fNSegment[IR];
for(int phi = 0; phi < fNSegment[IPHI]; phi++)
for(G4int phi = 0; phi < fNSegment[IPHI]; phi++)
{
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
{
G4double rs[2] = { fSize[0] + rsize * r, fSize[0] + rsize * (r + 1) };
G4double angle = fAngle[0] + fAngle[1] / fNSegment[IPHI] * phi;
@@ -639,9 +648,9 @@ void G4ScoringCylinder::DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
G4double zhalf = fSize[2] / fNSegment[IZ];
G4double angle = fAngle[0] + fAngle[1] / fNSegment[IPHI] * idxColumn;
G4double dphi = fAngle[1] / fNSegment[IPHI];
for(int z = 0; z < fNSegment[IZ]; z++)
for(G4int z = 0; z < fNSegment[IZ]; z++)
{
for(int r = 0; r < fNSegment[IR]; r++)
for(G4int r = 0; r < fNSegment[IR]; r++)
{
G4double rs[2] = { fSize[0] + rsize * r, fSize[0] + rsize * (r + 1) };
G4Tubs cylinder("z-phi", rs[0], rs[1], zhalf, angle, dphi);
@@ -692,14 +701,6 @@ void G4ScoringCylinder::GetRZPhi(G4int index, G4int q[3]) const
q[k] = index - q[j] * fNSegment[k] - q[i] * jk;
}
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include "G4VSensitiveDetector.hh"
#include "G4VSolid.hh"
void G4ScoringCylinder::DumpVolumes()
{
G4int lvl = 2;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4ScoringManager
// --------------------------------------------------------------------
#include "G4ScoringManager.hh"
#include "G4ScoringMessenger.hh"
@@ -102,7 +102,7 @@ G4VScoringMesh* G4ScoringManager::FindMesh(G4VHitsCollection* map)
auto msh = fMeshMap.find(colID);
if(msh == fMeshMap.end())
{
auto wName = map->GetSDname();
const auto& wName = map->GetSDname();
sm = FindMesh(wName);
fMeshMap[colID] = sm;
}
@@ -263,7 +263,7 @@ void G4ScoringManager::ListScoreColorMaps()
void G4ScoringManager::Merge(const G4ScoringManager* mgr)
{
for(G4int i = 0; i < (G4int)GetNumberOfMesh(); ++i)
for(auto i = 0; i < (G4int)GetNumberOfMesh(); ++i)
{
G4VScoringMesh* fMesh = GetMesh(i);
G4VScoringMesh* scMesh = mgr->GetMesh(i);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// ---------------------------------------------------------------------
// G4ScoringMessenger
// --------------------------------------------------------------------
#include "G4ScoringMessenger.hh"
#include "G4ScoringManager.hh"
@@ -47,6 +47,9 @@
#include "G4UnitsTable.hh"
#include "G4VScoreColorMap.hh"
#include "G4VPrimitivePlotter.hh"
#include "G4VScoreHistFiller.hh"
G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
: fSMan(SManager)
{
@@ -927,7 +930,7 @@ G4String G4ScoringMessenger::GetCurrentValue(G4UIcommand* command)
return val;
}
void G4ScoringMessenger::FillTokenVec(G4String newValues, G4TokenVec& token)
void G4ScoringMessenger::FillTokenVec(const G4String& newValues, G4TokenVec& token)
{
G4Tokenizer next(newValues);
G4String val;
@@ -970,10 +973,7 @@ void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh, G4TokenVec& token)
mesh->SetNumberOfSegments(nSegment);
}
#include "G4VPrimitivePlotter.hh"
#include "G4VScoreHistFiller.hh"
void G4ScoringMessenger::Fill1D(G4UIcommand* cmd, G4String newVal)
void G4ScoringMessenger::Fill1D(G4UIcommand* cmd, const G4String& newVal)
{
using MeshShape = G4VScoringMesh::MeshShape;
+11 -8
View File
@@ -23,7 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// G4ScoringProbe
// --------------------------------------------------------------------
#include "G4ScoringProbe.hh"
#include "G4Box.hh"
@@ -46,7 +48,14 @@
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
G4ScoringProbe::G4ScoringProbe(G4String lvName, G4double half_size,
#include "G4AutoLock.hh"
namespace
{
G4Mutex logvolmutex = G4MUTEX_INITIALIZER;
}
G4ScoringProbe::G4ScoringProbe(const G4String& lvName, G4double half_size,
G4bool checkOverlap)
: G4VScoringMesh(lvName)
, chkOverlap(checkOverlap)
@@ -78,12 +87,6 @@ void G4ScoringProbe::List() const
G4VScoringMesh::List();
}
#include "G4AutoLock.hh"
namespace
{
G4Mutex logvolmutex = G4MUTEX_INITIALIZER;
}
void G4ScoringProbe::SetupGeometry(G4VPhysicalVolume* worldPhys)
{
if(G4Threading::IsMasterThread())
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ScoringRealWorld
// --------------------------------------------------------------------
#include "G4ScoringRealWorld.hh"
#include "G4LogicalVolume.hh"
@@ -39,7 +42,14 @@
#include "G4SystemOfUnits.hh"
G4ScoringRealWorld::G4ScoringRealWorld(G4String lvName)
#include "G4AutoLock.hh"
namespace
{
G4Mutex logvolmutex = G4MUTEX_INITIALIZER;
}
G4ScoringRealWorld::G4ScoringRealWorld(const G4String& lvName)
: G4VScoringMesh(lvName)
{
fShape = MeshShape::realWorldLogVol;
@@ -56,17 +66,12 @@ void G4ScoringRealWorld::List() const
G4VScoringMesh::List();
}
#include "G4AutoLock.hh"
namespace
{
G4Mutex logvolmutex = G4MUTEX_INITIALIZER;
}
void G4ScoringRealWorld::SetupGeometry(G4VPhysicalVolume*)
{
G4AutoLock l(&logvolmutex);
auto store = G4LogicalVolumeStore::GetInstance();
auto itr = store->begin();
for(; itr != store->end(); itr++)
for(; itr != store->end(); ++itr)
{
if((*itr)->GetName() == logVolName)
{
@@ -74,7 +79,7 @@ void G4ScoringRealWorld::SetupGeometry(G4VPhysicalVolume*)
G4int nb = 0;
auto pvStore = G4PhysicalVolumeStore::GetInstance();
auto pvItr = pvStore->begin();
for(; pvItr != pvStore->end(); pvItr++)
for(; pvItr != pvStore->end(); ++pvItr)
{
if((*pvItr)->GetLogicalVolume() == (*itr))
{
@@ -23,14 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4VScoreColorMap
// --------------------------------------------------------------------
#include "G4VScoreColorMap.hh"
#include <string>
#include <sstream>
#include <iomanip>
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
#include "G4Text.hh"
@@ -39,7 +35,11 @@
#include "G4Colour.hh"
#include "G4Polyhedron.hh"
G4VScoreColorMap::G4VScoreColorMap(G4String mName)
#include <string>
#include <sstream>
#include <iomanip>
G4VScoreColorMap::G4VScoreColorMap(const G4String& mName)
: fName(mName)
{}
@@ -91,13 +91,13 @@ void G4VScoreColorMap::DrawColorChartText(G4int _nPoint)
fVisManager->BeginDraw2D();
for(int n = 0; n < _nPoint; n++)
for(G4int n = 0; n < _nPoint; n++)
{
G4double a = n / (_nPoint - 1.), b = 1. - a;
G4double v = (a * max + b * min) / (a + b);
// background color
for(int l = 0; l < 21; l++)
for(G4int l = 0; l < 21; l++)
{
G4Polyline line;
line.push_back(G4Point3D(-0.9, -0.905 + 0.05 * n + 0.002 * l, 0.));
@@ -128,7 +128,7 @@ void G4VScoreColorMap::DrawColorChartText(G4int _nPoint)
G4double lpsname = 2. + fPSName.size() * 0.95;
if(lpsname > 0)
{
for(int l = 0; l < 22; l++)
for(G4int l = 0; l < 22; l++)
{
G4Polyline line;
line.push_back(G4Point3D(-0.92, -0.965 + 0.002 * l, 0.));
@@ -154,7 +154,7 @@ void G4VScoreColorMap::DrawColorChartText(G4int _nPoint)
G4double len = 2. + fPSUnit.size();
if(len > 0)
{
for(int l = 0; l < 21; l++)
for(G4int l = 0; l < 21; l++)
{
G4Polyline line;
line.push_back(G4Point3D(-0.7, -0.9 + 0.002 * l, 0.));
@@ -23,8 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VScoreNtupleWriter
//
// Author: Ivana Hrivnacova, 11/09/2018 (ivana@ipno.in2p3.fr)
// Author: Ivana Hrivnacova, 11/09/2018
// ---------------------------------------------------------------------
#include "G4VScoreNtupleWriter.hh"
+11 -11
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4VScoreWriter
// --------------------------------------------------------------------
#include "G4VScoreWriter.hh"
@@ -110,13 +110,13 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
}
// write quantity
long count = 0;
G4long count = 0;
ofile << std::setprecision(16); // for double value with 8 bytes
for(int x = 0; x < fNMeshSegments[0]; x++)
for(G4int x = 0; x < fNMeshSegments[0]; x++)
{
for(int y = 0; y < fNMeshSegments[1]; y++)
for(G4int y = 0; y < fNMeshSegments[1]; y++)
{
for(int z = 0; z < fNMeshSegments[2]; z++)
for(G4int z = 0; z < fNMeshSegments[2]; z++)
{
G4int idx = GetIndex(x, y, z);
@@ -161,7 +161,7 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
{
// change the option string into lowercase to the case-insensitive.
G4String opt = option;
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
std::transform(opt.begin(), opt.end(), opt.begin(), (G4int (*)(G4int))(tolower));
// confirm the option
if(opt.empty())
@@ -220,13 +220,13 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
}
// write quantity
long count = 0;
G4long count = 0;
ofile << std::setprecision(16); // for double value with 8 bytes
for(int x = 0; x < fNMeshSegments[0]; x++)
for(G4int x = 0; x < fNMeshSegments[0]; x++)
{
for(int y = 0; y < fNMeshSegments[1]; y++)
for(G4int y = 0; y < fNMeshSegments[1]; y++)
{
for(int z = 0; z < fNMeshSegments[2]; z++)
for(G4int z = 0; z < fNMeshSegments[2]; z++)
{
G4int idx = GetIndex(x, y, z);
+3 -10
View File
@@ -23,14 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ---------------------------------------------------------------------
// Modifications
// 17-Apr-2012 T.Aso SetSize() and SetNumberOfSegments() is not allowed
// to call twice in same geometrical mesh. Add warning
// message to notify.
//
// G4VScoringMesh
// ---------------------------------------------------------------------
#include "G4VScoringMesh.hh"
@@ -384,7 +377,7 @@ void G4VScoringMesh::Accumulate(G4THitsMap<G4double>* map)
{
G4String psName = map->GetName();
const auto fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if (fMapItr != fMap.cend()) { *(fMapItr->second) += *map; }
if(verboseLevel > 9)
{
@@ -408,7 +401,7 @@ void G4VScoringMesh::Accumulate(G4THitsMap<G4StatDouble>* map)
{
G4String psName = map->GetName();
const auto fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if (fMapItr != fMap.cend()) { *(fMapItr->second) += *map; }
if(verboseLevel > 9)
{