Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
-17
View File
@@ -1,17 +0,0 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4detutils
# Package: Geant4.src.G4digits_hits.G4detutils
#
# CMakeLists.txt for building a single granular library.
#
# Generated on : 24/9/2010
#
#
#------------------------------------------------------------------------------
if(GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
endif()
+23 -5
View File
@@ -16,12 +16,30 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
February 12th, 2020 T.Aso (detutils-V10-05-06)
- In G4ScoreQuantityMessenger, changed SetDefaultUnit() in trackLength
scorer to SetDefaultValue() to support various unit category.
Addressing problem report #2216.
April 29th, 2020 M.Asai (detutils-V10-06-07)
- G4ScoringProbe.cc : Minor cosmetic changes.
December 29th, 2019 M.Asai (detutils-V10-05-05)
April 22nd, 2020 M.Asai (detutils-V10-06-06)
- Introducing G4VPrimitivePlotter.hh that enables the user to extend
a primitive scorer and directly fill 1D histogram.
April 13th, 2020 M.Asai (detutils-V10-06-05)
- Introducing Probe mesh.
April 7th, 2020 M.Asai (detutils-V10-06-04)
- G4VScoringMesh.hh, .cc : further extension for Proble scoring mesh.
April 2nd, 2020 M.Asai (detutils-V10-06-03)
- G4ScoringMessenger.cc: Fix Coverity error.
March 31st, 2020 M.Asai (detutils-V10-06-02)
- G4VScoringMesh.hh: Add a new enum entry for future extension.
Feburary 13th, 2020 T.Aso (detutils-V10-06-01)
- G4ScoreQuantityMessengerQCmd.cc: default parameter for unit
in trackLength scorer was changed.
December 29th, 2019 M.Asai (detutils-V10-06-00)
- G4ScoringManager, G4VScoreWriter, G4ScoringMessenger:
Add missing setter/getter functions.
@@ -91,6 +91,7 @@ class G4ScoringMessenger: public G4UImessenger
G4UIcmdWithAString* meshCylinderCreateCmd;
// G4UIcmdWithAString* meshSphereCreateCmd;
G4UIcommand* meshRWLogVolCreateCmd;
G4UIcommand* probeCreateCmd;
//
// Mesh commands
G4UIdirectory* meshDir;
@@ -117,6 +118,11 @@ class G4ScoringMessenger: public G4UImessenger
G4UIcmdWithADoubleAndUnit* mRotYCmd;
G4UIcmdWithADoubleAndUnit* mRotZCmd;
//
// Probe commands
G4UIdirectory* probeDir;
G4UIcmdWithAString* probeMatCmd;
G4UIcmdWith3VectorAndUnit* probeLocateCmd;
//
// Draw Command
G4UIcommand * drawCmd;
G4UIcommand * drawColumnCmd;
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
#ifndef G4ScoringProbe_h
#define G4ScoringProbe_h 1
#include "globals.hh"
#include "G4VScoringMesh.hh"
class G4VPhysicalVolume;
class G4Material;
#include <vector>
class G4ScoringProbe : public G4VScoringMesh
{
public:
G4ScoringProbe(G4String lvName,G4double half_size,G4bool checkOverlap=false);
~G4ScoringProbe();
protected:
// construct scoring volume
virtual void SetupGeometry(G4VPhysicalVolume* );
protected:
G4String logVolName;
std::vector<G4ThreeVector> posVec;
G4double probeSize;
G4bool chkOverlap;
G4String layeredMaterialName;
G4Material* layeredMaterial;
G4String regName;
public:
void LocateProbe(G4ThreeVector pos)
{
posVec.push_back(pos);
G4int nbin[] = {static_cast<G4int>(posVec.size()),1,1};
SetNumberOfSegments(nbin);
}
G4int GetNumberOfProbes() const
{ return posVec.size(); }
void SetProbeSize(G4double val)
{ probeSize = val; }
G4double GetProbeSize() const
{ return probeSize; }
G4bool SetMaterial(G4String val);
public:
virtual void List() const;
public:
//++++++++++ visualization method not yet implemented
virtual void Draw(RunScore * /*map*/, G4VScoreColorMap* /*colorMap*/, G4int /*axflg=111*/)
{;}
virtual void DrawColumn(RunScore * /*map*/, G4VScoreColorMap* /*colorMap*/,
G4int /*idxProj*/, G4int /*idxColumn*/)
{;}
};
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
#ifndef G4VPrimitivePlotter_H
#define G4VPrimitivePlotter_H 1
#include "G4VPrimitiveScorer.hh"
#include <map>
class G4VPrimitivePlotter : public G4VPrimitiveScorer
{
public: // with description
G4VPrimitivePlotter(G4String name, G4int depth=0)
:G4VPrimitiveScorer(name,depth)
{;}
virtual ~G4VPrimitivePlotter()
{;}
public:
void Plot(G4int copyNo,G4int histID)
{ hitIDMap[copyNo] = histID; }
protected:
std::map<G4int,G4int> hitIDMap;
public:
G4int GetNumberOfHist() const
{ return hitIDMap.size(); }
};
#endif
@@ -53,7 +53,7 @@ class G4ParallelWorldProcess;
class G4VScoringMesh
{
public:
enum class MeshShape { box, cylinder, sphere, realWorldLogVol, undefined = -1};
enum class MeshShape { box, cylinder, sphere, realWorldLogVol, probe, undefined = -1};
using EventScore = G4THitsMap< G4double >;
using RunScore = G4THitsMap< G4StatDouble >;
using MeshScoreMap = std::map< G4String, RunScore* >;
@@ -174,7 +174,7 @@ public: // with description
inline G4bool ReadyForQuantity() const
{ return (sizeIsSet && nMeshIsSet); }
protected:
//protected:
// get registered primitive socrer by the name
G4VPrimitiveScorer * GetPrimitiveScorer(const G4String & name);
@@ -235,6 +235,15 @@ public:
{ copyNumberLevel = val; }
inline G4int GetCopyNumberLevel() const
{ return copyNumberLevel; }
protected:
// This flag may be set to true for Probe scoring mesh.
// There is no public set method for this boolean flag, but it should be set to true
// through SetMaterial() method of Probe scoring mesh.
G4bool layeredMassFlg;
public:
G4bool LayeredMassFlg()
{ return layeredMassFlg; }
};
#endif
+59 -93
View File
@@ -1,104 +1,70 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4detutils
# Package: Geant4.src.G4digits_hits.G4detutils
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/detector/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/scorer/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/divisions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPNumerics/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4detutils
HEADERS
G4DefaultLinearColorMap.hh
G4ScoreLogColorMap.hh
G4VScoreNtupleWriter.hh
G4TScoreNtupleWriter.hh
G4TScoreNtupleWriter.icc
G4TScoreNtupleWriterMessenger.hh
G4TScoreNtupleWriterMessenger.icc
G4ScoreQuantityMessenger.hh
G4ScoringBox.hh
G4ScoringCylinder.hh
G4ScoringManager.hh
G4ScoringMessenger.hh
G4ScoringRealWorld.hh
G4VScoreColorMap.hh
G4VScoreWriter.hh
G4VScoringMesh.hh
SOURCES
G4DefaultLinearColorMap.cc
G4ScoreLogColorMap.cc
G4VScoreNtupleWriter.cc
G4ScoreQuantityMessenger.cc
G4ScoreQuantityMessengerQCmd.cc
G4ScoringBox.cc
G4ScoringCylinder.cc
G4ScoringManager.cc
G4ScoringMessenger.cc
G4ScoringRealWorld.cc
G4VScoreColorMap.cc
G4VScoreWriter.cc
G4VScoringMesh.cc
GRANULAR_DEPENDENCIES
G4csg
G4detector
G4detscorer
G4digits
G4geomdivision
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4navigation
G4partman
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4particles
G4track
LINK_LIBRARIES
geant4_define_module(NAME G4detutils
HEADERS
G4DefaultLinearColorMap.hh
G4ScoreLogColorMap.hh
G4VPrimitivePlotter.hh
G4VScoreNtupleWriter.hh
G4TScoreNtupleWriter.hh
G4TScoreNtupleWriter.icc
G4TScoreNtupleWriterMessenger.hh
G4TScoreNtupleWriterMessenger.icc
G4ScoreQuantityMessenger.hh
G4ScoringBox.hh
G4ScoringCylinder.hh
G4ScoringManager.hh
G4ScoringMessenger.hh
G4ScoringRealWorld.hh
G4ScoringProbe.hh
G4VScoreColorMap.hh
G4VScoreWriter.hh
G4VScoringMesh.hh
SOURCES
G4DefaultLinearColorMap.cc
G4ScoreLogColorMap.cc
G4VScoreNtupleWriter.cc
G4ScoreQuantityMessenger.cc
G4ScoreQuantityMessengerQCmd.cc
G4ScoringBox.cc
G4ScoringCylinder.cc
G4ScoringManager.cc
G4ScoringMessenger.cc
G4ScoringRealWorld.cc
G4ScoringProbe.cc
G4VScoreColorMap.cc
G4VScoreWriter.cc
G4VScoringMesh.cc
GRANULAR_DEPENDENCIES
G4csg
G4detector
G4detscorer
G4digits
G4geomdivision
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4navigation
G4partman
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4particles
G4track
)
# List any source specific properties here
@@ -269,7 +269,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qCellChgCmd) {
if ( CheckMeshPS(mesh,token[0],command) ){
G4PSCellCharge* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSCellCharge(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSCellCharge3D(token[0]); }
@@ -293,6 +293,8 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
ed<<"Cell flux for real world volume is not yet supported. Command ignored.";
command->CommandFailed(ed);
return;
} else if(shape==MeshShape::probe) {
ps = new G4PSCellFlux(token[0]);
}
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
@@ -314,6 +316,8 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
ed<<"Passing cell flux for real world volume is not yet supported. Command ignored.";
command->CommandFailed(ed);
return;
} else if(shape==MeshShape::probe) {
ps = new G4PSPassageCellFlux(token[0]);
}
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
@@ -321,7 +325,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command==qeDepCmd) {
if ( CheckMeshPS(mesh,token[0],command) ){
G4PSEnergyDeposit* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps =new G4PSEnergyDeposit(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps =new G4PSEnergyDeposit3D(token[0]); }
@@ -342,7 +346,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
mesh->GetNumberOfSegments(nSeg);
pps->SetNumberOfSegments(nSeg);
ps = pps;
} else if(shape==MeshShape::realWorldLogVol) {
} else if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe) {
ps = new G4PSDoseDeposit(token[0],mesh->GetCopyNumberLevel());
}
ps->SetUnit(token[1]);
@@ -351,7 +355,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qnOfStepCmd) {
if ( CheckMeshPS(mesh,token[0],command) ){
G4PSNofStep* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSNofStep(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSNofStep3D(token[0]); }
@@ -361,7 +365,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qnOfSecondaryCmd) {
if ( CheckMeshPS(mesh,token[0],command) ){
G4PSNofSecondary* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSNofSecondary(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSNofSecondary3D(token[0]); }
@@ -370,7 +374,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qTrackLengthCmd) {
if ( CheckMeshPS(mesh,token[0],command) ){
G4PSTrackLength* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSTrackLength(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSTrackLength3D(token[0]); }
@@ -383,7 +387,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qPassCellCurrCmd){
if( CheckMeshPS(mesh,token[0],command) ) {
G4PSPassageCellCurrent* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSPassageCellCurrent(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSPassageCellCurrent3D(token[0]); }
@@ -393,7 +397,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qPassTrackLengthCmd){
if( CheckMeshPS(mesh,token[0],command) ) {
G4PSPassageTrackLength* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSPassageTrackLength(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSPassageTrackLength3D(token[0]); }
@@ -404,7 +408,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qFlatSurfCurrCmd){
if( CheckMeshPS(mesh,token[0],command)) {
G4PSFlatSurfaceCurrent* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSFlatSurfaceCurrent(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1])); }
@@ -420,7 +424,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qFlatSurfFluxCmd){
if( CheckMeshPS(mesh, token[0],command )) {
G4PSFlatSurfaceFlux* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSFlatSurfaceFlux(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])); }
@@ -487,7 +491,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qNofCollisionCmd){
if( CheckMeshPS(mesh,token[0],command)) {
G4PSNofCollision* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSNofCollision3D(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSNofCollision3D(token[0]); }
@@ -497,7 +501,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qPopulationCmd){
if( CheckMeshPS(mesh,token[0],command) ) {
G4PSPopulation* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSPopulation(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSPopulation3D(token[0]); }
@@ -507,7 +511,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qTrackCountCmd){
if( CheckMeshPS(mesh,token[0],command)) {
G4PSTrackCounter* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSTrackCounter(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSTrackCounter3D(token[0],StoI(token[1])); }
@@ -517,7 +521,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qTerminationCmd){
if( CheckMeshPS(mesh,token[0],command)) {
G4PSTermination* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSTermination(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSTermination3D(token[0]); }
@@ -528,7 +532,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qMinKinEAtGeneCmd){
if( CheckMeshPS(mesh,token[0],command) ){
G4PSMinKinEAtGeneration* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSMinKinEAtGeneration(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSMinKinEAtGeneration3D(token[0]); }
@@ -538,7 +542,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
} else if(command== qStepCheckerCmd){
if( CheckMeshPS(mesh,token[0],command) ){
G4PSStepChecker* ps = nullptr;
if(shape==MeshShape::realWorldLogVol)
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSStepChecker(token[0],mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSStepChecker3D(token[0]); }
@@ -33,6 +33,7 @@
#include "G4ScoringBox.hh"
#include "G4ScoringCylinder.hh"
#include "G4ScoringRealWorld.hh"
#include "G4ScoringProbe.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
@@ -66,9 +67,6 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
verboseCmd->SetGuidance(" 0) errors or warnings,");
verboseCmd->SetGuidance(" 1) information with 0)");
meshDir = new G4UIdirectory("/score/mesh/");
meshDir->SetGuidance(" Mesh processing commands.");
meshCreateDir = new G4UIdirectory("/score/create/");
meshCreateDir->SetGuidance(" Mesh creation commands.");
//
@@ -98,6 +96,20 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
param->SetDefaultValue(0);
meshRWLogVolCreateCmd->SetParameter(param);
//
probeCreateCmd = new G4UIcommand("/score/create/probe",this);
probeCreateCmd->SetGuidance("Define scoring probe.");
probeCreateCmd->SetGuidance(" halfSize defines the half-width of the probing cube.");
param = new G4UIparameter("pname",'s',false);
probeCreateCmd->SetParameter(param);
param = new G4UIparameter("halfSize",'d',false);
probeCreateCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultUnit("mm");
probeCreateCmd->SetParameter(param);
param = new G4UIparameter("checkOverlap",'b',true);
param->SetDefaultValue(false);
probeCreateCmd->SetParameter(param);
//
meshOpnCmd = new G4UIcmdWithAString("/score/open",this);
meshOpnCmd->SetGuidance("Open scoring mesh.");
meshOpnCmd->SetParameterName("MeshName",false);
@@ -108,6 +120,9 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
// meshActCmd = new G4UIcmdWithABool("/score/mesh/activate",this);
// meshActCmd->SetGuidance("Activate scoring mesh.");
// meshActCmd->SetParameterName("MeshName",false);
//
meshDir = new G4UIdirectory("/score/mesh/");
meshDir->SetGuidance(" Mesh processing commands.");
//
mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/boxSize",this);
mBoxSizeCmd->SetGuidance("Define size of the scoring mesh.");
@@ -192,6 +207,23 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
mRotZCmd->SetParameterName("Rz",false);
mRotZCmd->SetDefaultUnit("deg");
//
probeDir = new G4UIdirectory("/score/probe/");
probeDir->SetGuidance("Probe commands");
probeMatCmd = new G4UIcmdWithAString("/score/probe/material",this);
probeMatCmd->SetGuidance("Specify a material to the probe cube.");
probeMatCmd->SetGuidance("Material name has to be taken from G4NistManager.");
probeMatCmd->SetGuidance("Once this command is used, the specified material overlays the material in the mass geometry");
probeMatCmd->SetGuidance("with \"Layered Mass Geometry\" mechanism so that physics quantities such as energy deposition");
probeMatCmd->SetGuidance("or dose will be calculated with this material.");
probeMatCmd->SetGuidance("To switch-off this overlaying, use \"none\".");
probeMatCmd->SetParameterName("matName",true);
probeMatCmd->SetDefaultValue("none");
probeLocateCmd = new G4UIcmdWith3VectorAndUnit("/score/probe/locate",this);
probeLocateCmd->SetGuidance("Locate a probe in the global coordinate system.");
probeLocateCmd->SetParameterName("x","y","z",false);
probeLocateCmd->SetDefaultUnit("mm");
// Draw Scoring result
drawCmd = new G4UIcommand("/score/drawProjection",this);
@@ -335,10 +367,11 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete listCmd;
delete verboseCmd;
//
delete meshCreateDir;
delete meshBoxCreateCmd;
delete meshCylinderCreateCmd;
delete meshRWLogVolCreateCmd;
delete probeCreateCmd;
delete meshCreateDir;
// delete meshSphereCreateCmd;
//
delete meshOpnCmd;
@@ -362,6 +395,10 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete mRotZCmd;
delete mRotDir;
//
delete probeLocateCmd;
delete probeMatCmd;
delete probeDir;
//
//delete chartCmd;
delete dumpCmd;
delete drawCmd;
@@ -370,10 +407,10 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete floatMinMaxCmd;
delete colorMapMinMaxCmd;
delete colorMapDir;
delete dumpQtyToFileCmd;
delete dumpQtyWithFactorCmd;
delete dumpQtyWithFactorCmd;
delete dumpAllQtsToFileCmd;
delete dumpAllQtsWithFactorCmd;
delete dumpAllQtsWithFactorCmd;
//
delete scoreDir;
}
@@ -545,7 +582,70 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
command->CommandFailed(ed);
}
}
} else if(command==probeCreateCmd) {
auto mesh = fSMan->GetCurrentMesh();
if ( mesh ){
G4ExceptionDescription ed;
ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath()
<< "] : Mesh <" << mesh->GetWorldName()
<< "> is still open. Close it first. Command ignored.";
command->CommandFailed(ed);
}
else
{
G4Tokenizer next(newVal);
G4String qname = next();
G4double halfSize = StoD(next());
halfSize *= G4UIcommand::ValueOf(next());
G4bool checkOverlap = StoB(next());
mesh = fSMan->FindMesh(qname);
if(!mesh)
{
mesh = new G4ScoringProbe(qname,halfSize,checkOverlap);
fSMan->RegisterScoringMesh(mesh);
}
else
{
G4ExceptionDescription ed;
ed << "ERROR[" << probeCreateCmd->GetCommandPath()
<< "] : Mesh name <" << qname << "> already exists. Use another name.";
command->CommandFailed(ed);
}
}
} else if(command==probeMatCmd || command==probeLocateCmd) {
auto mesh = fSMan->GetCurrentMesh();
if(!mesh)
{
G4ExceptionDescription ed;
ed << "ERROR : No mesh is currently open. Open/create a mesh first. Command ignored.";
command->CommandFailed(ed);
return;
}
if(mesh->GetShape() != MeshShape::probe)
{
G4ExceptionDescription ed;
ed << "ERROR : Inconsistent mesh type. Close current mesh and open Scoring Probe.";
command->CommandFailed(ed);
return;
}
if(command==probeMatCmd)
{
G4bool succ = static_cast<G4ScoringProbe*>(mesh)->SetMaterial(newVal);
if(!succ)
{
G4ExceptionDescription ed;
ed << "Material <" << newVal << "> is not defind in G4NistManager. Command is ignored.\n"
<< "Use /material/nist/listMaterials command to see the available materials.";
command->CommandFailed(ed);
return;
}
}
else if(command==probeLocateCmd)
{
G4ThreeVector loc = probeLocateCmd->GetNew3VectorValue(newVal);
static_cast<G4ScoringProbe*>(mesh)->LocateProbe(loc);
}
} else if(command==listColorMapCmd) {
fSMan->ListScoreColorMaps();
} else if(command==floatMinMaxCmd) {
@@ -0,0 +1,140 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
#include "G4ScoringProbe.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Threading.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDParticleFilter.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4ScoringManager.hh"
#include "G4StatDouble.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
G4ScoringProbe::G4ScoringProbe(G4String lvName, G4double half_size, G4bool checkOverlap)
:G4VScoringMesh(lvName), chkOverlap(checkOverlap),
layeredMaterialName("none"), layeredMaterial(nullptr)
{
fShape = MeshShape::probe;
logVolName = lvName;
probeSize = half_size;
G4double hs[] = {half_size,half_size,half_size};
SetSize(hs);
G4int nBin[] = {1,1,1};
SetNumberOfSegments(nBin);
regName = lvName + "_region";
if(G4Threading::IsMasterThread())
{ new G4Region(regName); }
}
G4ScoringProbe::~G4ScoringProbe()
{
}
void G4ScoringProbe::List() const
{
G4cout << "G4ScoringProbe : " << logVolName << G4endl;
G4int np = posVec.size();
for(G4int i=0;i<np;i++)
{ G4cout << " >> probe #" << i << " at " << posVec[i] << G4endl; }
G4VScoringMesh::List();
}
#include "G4AutoLock.hh"
namespace { G4Mutex logvolmutex = G4MUTEX_INITIALIZER; }
void G4ScoringProbe::SetupGeometry(G4VPhysicalVolume* worldPhys)
{
if(G4Threading::IsMasterThread())
{
auto worldLog = worldPhys->GetLogicalVolume();
auto region = G4RegionStore::GetInstance()->GetRegion(regName);
assert(region!=nullptr);
region->AddRootLogicalVolume(worldLog);
region->SetWorld(worldPhys);
auto boxSolid = new G4Box(logVolName+"_solid",probeSize,probeSize,probeSize);
fMeshElementLogical = new G4LogicalVolume(boxSolid,layeredMaterial,logVolName+"_log");
G4int np = posVec.size();
for(G4int i=0;i<np;i++)
{ new G4PVPlacement(0,posVec[i],fMeshElementLogical,logVolName+"_phy",worldLog,false,i,chkOverlap); }
G4VisAttributes* wisatt = new G4VisAttributes(G4Colour(.5,.5,.5));
wisatt->SetVisibility(false);
worldLog->SetVisAttributes(wisatt);
G4VisAttributes* visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
visatt->SetVisibility(true);
fMeshElementLogical->SetVisAttributes(visatt);
}
else
{
G4AutoLock l(&logvolmutex);
fMeshElementLogical = G4LogicalVolumeStore::GetInstance()->GetVolume(logVolName,false);
assert(fMeshElementLogical!=nullptr);
l.unlock();
}
fMeshElementLogical->SetSensitiveDetector(fMFD);
}
G4bool G4ScoringProbe::SetMaterial(G4String val)
{
if(val == "none")
{
layeredMaterialName = val;
layeredMassFlg = false;
layeredMaterial = nullptr;
}
else
{
auto mat = G4NistManager::Instance()->FindOrBuildMaterial(val);
if(!mat)
{ return false; }
layeredMaterialName = val;
layeredMassFlg = true;
layeredMaterial = mat;
}
auto region = G4RegionStore::GetInstance()->GetRegion(regName);
assert(region!=nullptr);
region->UpdateMaterialList();
return true;
}
@@ -61,8 +61,11 @@ 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++)
@@ -49,7 +49,7 @@ G4VScoringMesh::G4VScoringMesh(const G4String& wName)
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
fDrawUnit(""), fDrawUnitValue(1.), fMeshElementLogical(nullptr),
fParallelWorldProcess(nullptr), fGeometryHasBeenDestroyed(false),
copyNumberLevel(0)
copyNumberLevel(0), layeredMassFlg(false)
{
G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
@@ -76,7 +76,7 @@ void G4VScoringMesh::SetSize(G4double size[3]) {
for(int i = 0; i < 3; i++) fSize[i] = size[i];
sizeIsSet = true;
}else{
G4String message = " The size of scoring mesh can not be changed.";
G4String message = " The size of scoring mesh is updated.";
G4Exception("G4VScoringMesh::SetSize()",
"DigiHitsUtilsScoreVScoringMesh000", JustWarning,
message);
@@ -92,7 +92,7 @@ void G4VScoringMesh::SetCenterPosition(G4double centerPosition[3]) {
fCenterPosition = G4ThreeVector(centerPosition[0], centerPosition[1], centerPosition[2]);
}
void G4VScoringMesh::SetNumberOfSegments(G4int nSegment[3]) {
if ( !nMeshIsSet || fShape==MeshShape::realWorldLogVol ){
if ( !nMeshIsSet || fShape==MeshShape::realWorldLogVol || fShape==MeshShape::probe ){
for(int i = 0; i < 3; i++) fNSegment[i] = nSegment[i];
nMeshIsSet = true;
} else {