Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -16,6 +16,17 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 15th, 2020 M.Asai (detutils-V10-06-10)
|
||||
- Adding Mutex lock to G4ScoringProbe::SetMaterial() to avoid the
|
||||
race condition.
|
||||
|
||||
September 16th, 2020 M.Asai (detutils-V10-06-09)
|
||||
- Adding /score/fill1D command that lets a primitive scorer to
|
||||
directly fill a 1D histogram.
|
||||
|
||||
September 3rd, 2020 M.Asai (detutils-V10-06-08)
|
||||
- Move G4VPrimitivePlotter.hh to digits_hits/detector
|
||||
|
||||
April 29th, 2020 M.Asai (detutils-V10-06-07)
|
||||
- G4ScoringProbe.cc : Minor cosmetic changes.
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ class G4ScoreQuantityMessenger: public G4UImessenger
|
||||
G4UIcommand* qPassTrackLengthCmd;
|
||||
G4UIcommand* qFlatSurfCurrCmd;
|
||||
G4UIcommand* qFlatSurfFluxCmd;
|
||||
G4UIcommand* qVolFluxCmd;
|
||||
// G4UIcommand* qSphereSurfCurrCmd;
|
||||
// G4UIcommand* qSphereSurfFluxCmd;
|
||||
// G4UIcommand* qCylSurfCurrCmd;
|
||||
|
||||
@@ -75,8 +75,8 @@ class G4ScoringMessenger: public G4UImessenger
|
||||
protected:
|
||||
|
||||
void FillTokenVec(G4String newValues,G4TokenVec& token);
|
||||
|
||||
void MeshBinCommand(G4VScoringMesh* mesh, G4TokenVec& token);
|
||||
void Fill1D(G4UIcommand* cmd, G4String newValues);
|
||||
|
||||
private:
|
||||
|
||||
@@ -138,6 +138,8 @@ class G4ScoringMessenger: public G4UImessenger
|
||||
G4UIcommand * dumpQtyWithFactorCmd;
|
||||
G4UIcommand * dumpAllQtsWithFactorCmd;
|
||||
//
|
||||
// Command for direcly plotting to a histogram
|
||||
G4UIcommand * fill1DCmd;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ geant4_define_module(NAME G4detutils
|
||||
HEADERS
|
||||
G4DefaultLinearColorMap.hh
|
||||
G4ScoreLogColorMap.hh
|
||||
G4VPrimitivePlotter.hh
|
||||
G4VScoreNtupleWriter.hh
|
||||
G4TScoreNtupleWriter.hh
|
||||
G4TScoreNtupleWriter.icc
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "G4PSSphereSurfaceFlux3D.hh"
|
||||
#include "G4PSCylinderSurfaceCurrent3D.hh"
|
||||
#include "G4PSCylinderSurfaceFlux3D.hh"
|
||||
#include "G4PSVolumeFlux3D.hh"
|
||||
#include "G4PSNofCollision3D.hh"
|
||||
#include "G4PSPopulation3D.hh"
|
||||
#include "G4PSTrackCounter3D.hh"
|
||||
@@ -217,6 +218,7 @@ G4ScoreQuantityMessenger::~G4ScoreQuantityMessenger()
|
||||
delete qPassTrackLengthCmd;
|
||||
delete qFlatSurfCurrCmd;
|
||||
delete qFlatSurfFluxCmd;
|
||||
delete qVolFluxCmd;
|
||||
// delete qSphereSurfCurrCmd;
|
||||
// delete qSphereSurfFluxCmd;
|
||||
// delete qCylSurfCurrCmd;
|
||||
@@ -437,6 +439,17 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
}
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qVolFluxCmd) {
|
||||
if( CheckMeshPS(mesh, token[0],command )) {
|
||||
G4PSVolumeFlux* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
|
||||
{ ps = new G4PSVolumeFlux(token[0],StoI(token[2]),mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSVolumeFlux3D(token[0],StoI(token[2])); }
|
||||
ps->SetDivCos(StoI(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
|
||||
// } else if(command== qSphereSurfCurrCmd){
|
||||
// if( CheckMeshPS(mesh, token[0],command )) {
|
||||
// G4PSSphereSurfaceCurrent3D* ps =
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "G4PSSphereSurfaceFlux3D.hh"
|
||||
#include "G4PSCylinderSurfaceCurrent3D.hh"
|
||||
#include "G4PSCylinderSurfaceFlux3D.hh"
|
||||
#include "G4PSVolumeFlux3D.hh"
|
||||
#include "G4PSNofCollision3D.hh"
|
||||
#include "G4PSPopulation3D.hh"
|
||||
#include "G4PSTrackCounter3D.hh"
|
||||
@@ -291,6 +292,24 @@ void G4ScoreQuantityMessenger::QuantityCommands()
|
||||
param->SetDefaultValue("percm2");
|
||||
qFlatSurfFluxCmd->SetParameter(param);
|
||||
//
|
||||
|
||||
qVolFluxCmd = new G4UIcommand("/score/quantity/volumeFlux",this);
|
||||
qVolFluxCmd->SetGuidance("Volume flux scorer.");
|
||||
qVolFluxCmd->SetGuidance("This scorer scores the number of particles getting into the volume without normalized by the surface area.");
|
||||
qVolFluxCmd->SetGuidance("[usage] /score/quantity/volumeFlux qname divcos dflag");
|
||||
qVolFluxCmd->SetGuidance(" qname :(String) scorer name");
|
||||
qVolFluxCmd->SetGuidance(" divcos :(Bool) divide by cos(theta), where theta is the incident angle (default : false)");
|
||||
qVolFluxCmd->SetGuidance(" dflag :(Int) direction, 1 : inward (default), 2 : outward");
|
||||
param = new G4UIparameter("qname",'s',false);
|
||||
qVolFluxCmd->SetParameter(param);
|
||||
param = new G4UIparameter("divcos",'b',true);
|
||||
param->SetDefaultValue(false);
|
||||
qVolFluxCmd->SetParameter(param);
|
||||
param = new G4UIparameter("dflag",'i',true);
|
||||
param->SetParameterRange("dflag>=1 && dflag<=2");
|
||||
param->SetDefaultValue(1);
|
||||
qVolFluxCmd->SetParameter(param);
|
||||
|
||||
// qSphereSurfCurrCmd = new G4UIcommand("/score/quantity/sphereSurfaceCurrent",this);
|
||||
// qSphereSurfCurrCmd->SetGuidance("Sphere surface current Scorer.");
|
||||
// qSphereSurfCurrCmd->
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "G4ScoringMessenger.hh"
|
||||
@@ -360,6 +359,23 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
|
||||
dumpAllQtsWithFactorCmd->SetParameter(param);
|
||||
dumpAllQtsWithFactorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fill1DCmd = new G4UIcommand("/score/fill1D", this);
|
||||
fill1DCmd->SetGuidance("Let a primitive scorer fill 1-D histogram");
|
||||
fill1DCmd->SetGuidance("Before using this command, primitive scorer must be defined and assigned.");
|
||||
fill1DCmd->SetGuidance("Also before using this command, a histogram has to be defined by /analysis/h1/create command.");
|
||||
fill1DCmd->SetGuidance("This command is available only for real-world volume or probe.");
|
||||
fill1DCmd->SetGuidance("Please note that this command has to be applied to each copy number of the scoring volume.");
|
||||
fill1DCmd->SetGuidance("If same histogram ID is used more than once, more than one scorers fill that histogram.");
|
||||
param = new G4UIparameter("histID", 'i', false);
|
||||
fill1DCmd->SetParameter(param);
|
||||
param = new G4UIparameter("meshName", 's', false);
|
||||
fill1DCmd->SetParameter(param);
|
||||
param = new G4UIparameter("scorerName", 's', false);
|
||||
fill1DCmd->SetParameter(param);
|
||||
param = new G4UIparameter("copyNo", 'i', true);
|
||||
param->SetDefaultValue(0);
|
||||
fill1DCmd->SetParameter(param);
|
||||
|
||||
}
|
||||
|
||||
G4ScoringMessenger::~G4ScoringMessenger()
|
||||
@@ -411,6 +427,7 @@ G4ScoringMessenger::~G4ScoringMessenger()
|
||||
delete dumpQtyWithFactorCmd;
|
||||
delete dumpAllQtsToFileCmd;
|
||||
delete dumpAllQtsWithFactorCmd;
|
||||
delete fill1DCmd;
|
||||
//
|
||||
delete scoreDir;
|
||||
}
|
||||
@@ -510,6 +527,8 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
|
||||
fSMan->SetFactor(fac);
|
||||
fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
|
||||
fSMan->SetFactor(1.0);
|
||||
} else if(command==fill1DCmd) {
|
||||
Fill1D(command,newVal);
|
||||
} else if(command==verboseCmd) {
|
||||
fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
|
||||
} else if(command==meshBoxCreateCmd) {
|
||||
@@ -827,4 +846,66 @@ void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh,G4TokenVec& token){
|
||||
mesh->SetNumberOfSegments(nSegment);
|
||||
}
|
||||
|
||||
|
||||
#include "G4VPrimitivePlotter.hh"
|
||||
#include "G4VScoreHistFiller.hh"
|
||||
|
||||
void G4ScoringMessenger::Fill1D(G4UIcommand* cmd, G4String newVal)
|
||||
{
|
||||
using MeshShape = G4VScoringMesh::MeshShape;
|
||||
|
||||
G4Tokenizer next(newVal);
|
||||
G4int histID = StoI(next());
|
||||
G4String meshName = next();
|
||||
G4String primName = next();
|
||||
G4int copyNo = StoI(next());
|
||||
|
||||
auto filler = G4VScoreHistFiller::Instance();
|
||||
if(!filler)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "G4TScoreHistFiller is not instantiated in this application.";
|
||||
cmd->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
//
|
||||
// To do : check the validity of histID
|
||||
//
|
||||
|
||||
auto sm = G4ScoringManager::GetScoringManagerIfExist();
|
||||
auto mesh = sm->FindMesh(meshName);
|
||||
if(mesh==nullptr)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh name <" << meshName << "> is not found.";
|
||||
cmd->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
auto shape = mesh->GetShape();
|
||||
if(shape!=MeshShape::realWorldLogVol && shape!=MeshShape::probe)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh <" << meshName << "> is not real-world logical volume or probe.";
|
||||
cmd->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
|
||||
auto prim = mesh->GetPrimitiveScorer(primName);
|
||||
if(prim==nullptr)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Primitive scorer name <" << primName << "> is not found.";
|
||||
cmd->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
auto pp = dynamic_cast<G4VPrimitivePlotter*>(prim);
|
||||
if(pp==nullptr)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Primitive scorer <" << primName << "> does not support direct histogram filling.";
|
||||
cmd->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
|
||||
pp->Plot(copyNo,histID);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ void G4ScoringProbe::SetupGeometry(G4VPhysicalVolume* worldPhys)
|
||||
|
||||
G4bool G4ScoringProbe::SetMaterial(G4String val)
|
||||
{
|
||||
G4AutoLock l(&logvolmutex);
|
||||
if(val == "none")
|
||||
{
|
||||
layeredMaterialName = val;
|
||||
|
||||
Reference in New Issue
Block a user