Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+20 -2
View File
@@ -34,6 +34,8 @@
#include "G4VPhysicalVolume.hh"
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
///////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring cell flux.
@@ -48,11 +50,13 @@
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. cell flux * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSCellFlux::G4PSCellFlux(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),weighted(true)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0),weighted(true)
{
DefineUnitAndCategory();
SetUnit("percm2");
@@ -60,7 +64,7 @@ G4PSCellFlux::G4PSCellFlux(G4String name, G4int depth)
}
G4PSCellFlux::G4PSCellFlux(G4String name, const G4String& unit, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),weighted(true)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0),weighted(true)
{
DefineUnitAndCategory();
SetUnit(unit);
@@ -84,6 +88,20 @@ G4bool G4PSCellFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4int index = GetIndex(aStep);
EvtMap->add(index,CellFlux);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSCellFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetPreStepPoint()->GetKineticEnergy(),CellFlux);
}
}
return TRUE;
}
@@ -36,6 +36,8 @@
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4GeometryTolerance.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only Surface Current.
@@ -49,13 +51,15 @@
//
// Created: 2007-03-21 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. surface current * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSCylinderSurfaceCurrent::G4PSCylinderSurfaceCurrent(G4String name,
G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -66,7 +70,7 @@ G4PSCylinderSurfaceCurrent::G4PSCylinderSurfaceCurrent(G4String name,
G4int direction,
const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -100,6 +104,20 @@ G4bool G4PSCylinderSurfaceCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*
G4int index = GetIndex(aStep);
EvtMap->add(index,current);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSCylinderSurfaceCurrent::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],preStep->GetKineticEnergy(),current);
}
}
}
}
@@ -36,6 +36,8 @@
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4GeometryTolerance.hh"
#include "G4VScoreHistFiller.hh"
// ////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Surface Flux.
@@ -52,11 +54,14 @@
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted and divideByArea options
// 2011-02-21 Get correct momentum direction in Flux_Out.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. surface flux * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFlux(G4String name,
G4int direction, G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -67,7 +72,7 @@ G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFlux(G4String name,
G4int direction,
const G4String& unit,
G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -124,6 +129,21 @@ G4bool G4PSCylinderSurfaceFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
//Flux with angle.
G4int index = GetIndex(aStep);
EvtMap->add(index,flux);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSCylinderSurfaceFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],thisStep->GetKineticEnergy(),flux);
}
}
return TRUE;
}else{
return FALSE;
@@ -31,6 +31,7 @@
#include "G4VPhysicalVolume.hh"
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
@@ -39,18 +40,20 @@
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of dose deposit (x)
// vs. weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSDoseDeposit::G4PSDoseDeposit(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit("Gy");
}
G4PSDoseDeposit::G4PSDoseDeposit(G4String name, const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit(unit);
}
@@ -70,9 +73,25 @@ G4bool G4PSDoseDeposit::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4double density = aStep->GetTrack()->GetStep()->GetPreStepPoint()->GetMaterial()->GetDensity();
G4double dose = edep / ( density * cubicVolume );
dose *= aStep->GetPreStepPoint()->GetWeight();
G4double wei = aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,dose);
G4double dosew = dose*wei;
EvtMap->add(index,dosew);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSDoseDeposit::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],dose,wei);
}
}
return TRUE;
}
@@ -27,6 +27,7 @@
//
// G4PSEnergyDeposit
#include "G4PSEnergyDeposit.hh"
#include "G4VScoreHistFiller.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// Description:
@@ -34,18 +35,20 @@
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-09-03 Use G4VPrimitivePlotter and fill 1-D histo of energy deposit (x)
// vs. track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSEnergyDeposit::G4PSEnergyDeposit(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit("MeV");
}
G4PSEnergyDeposit::G4PSEnergyDeposit(G4String name, const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit(unit);
}
@@ -57,9 +60,25 @@ G4bool G4PSEnergyDeposit::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ( edep == 0. ) return FALSE;
edep *= aStep->GetPreStepPoint()->GetWeight(); // (Particle Weight)
G4double wei = aStep->GetPreStepPoint()->GetWeight(); // (Particle Weight)
G4int index = GetIndex(aStep);
EvtMap->add(index,edep);
G4double edepwei = edep*wei;
EvtMap->add(index,edepwei);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSEnergyDeposit::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],edep,wei);
}
}
return TRUE;
}
@@ -101,3 +120,4 @@ void G4PSEnergyDeposit::SetUnit(const G4String& unit)
{
CheckAndSetUnit(unit,"Energy");
}
@@ -36,6 +36,8 @@
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4GeometryTolerance.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only Surface Flux.
@@ -51,13 +53,15 @@
// 17-Nov-2005 T.Aso, Bug fix for area definition.
// 31-Mar-2007 T.Aso, Add option for normalizing by the area.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. Surface Current * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSFlatSurfaceCurrent::G4PSFlatSurfaceCurrent(G4String name,
G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -68,7 +72,7 @@ G4PSFlatSurfaceCurrent::G4PSFlatSurfaceCurrent(G4String name,
G4int direction,
const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -110,6 +114,21 @@ G4bool G4PSFlatSurfaceCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*)
current = current/square; // Normalized by Area
}
EvtMap->add(index,current);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSFlatSurfaceCurrent::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],preStep->GetKineticEnergy(),current);
}
}
}
}
@@ -36,6 +36,8 @@
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4GeometryTolerance.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Surface Flux.
@@ -54,11 +56,13 @@
// 29-Mar-2007 T.Aso, Bug fix for momentum direction at outgoing flux.
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted and divideByAre options
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. cell flux * track weight (Makoto Asai)
///////////////////////////////////////////////////////////////////////////////
G4PSFlatSurfaceFlux::G4PSFlatSurfaceFlux(G4String name,
G4int direction, G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -69,7 +73,7 @@ G4PSFlatSurfaceFlux::G4PSFlatSurfaceFlux(G4String name,
G4int direction,
const G4String& unit,
G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
weighted(true),divideByArea(true)
{
DefineUnitAndCategory();
@@ -129,6 +133,21 @@ G4bool G4PSFlatSurfaceFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
//
G4int index = GetIndex(aStep);
EvtMap->add(index,flux);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSFlatSurfaceFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],preStep->GetKineticEnergy(),flux);
}
}
}
}
#ifdef debug
@@ -28,6 +28,7 @@
// G4PSMinKinEAtGeneration
#include "G4PSMinKinEAtGeneration.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
// (Description)
// This is a primitive scorer class for scoring minimum energy of
@@ -36,10 +37,12 @@
// Created: 2005-11-17 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2011-09-09 Modify comment in PrintAll(). T.Aso
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. track weight (y) (Makoto Asai)
//
G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit("MeV");
}
@@ -47,7 +50,7 @@ G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration(G4String name, G4int depth)
G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration(G4String name,
const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0)
{
SetUnit(unit);
}
@@ -76,10 +79,24 @@ G4bool G4PSMinKinEAtGeneration::ProcessHits(G4Step* aStep,G4TouchableHistory*)
//
// -Kinetic energy of this particle at the starting point.
G4int index = GetIndex(aStep);
G4double kinetic = aStep->GetPreStepPoint()->GetKineticEnergy();
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSMinKinEAtGeneration::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],kinetic,aStep->GetPreStepPoint()->GetWeight());
}
}
// -Stored value in the current HitsMap.
G4int index = GetIndex(aStep);
G4double* mapValue= ((*EvtMap)[index]);
// -
@@ -27,6 +27,7 @@
//
// G4PSNofSecondary
#include "G4PSNofSecondary.hh"
#include "G4VScoreHistFiller.hh"
// (Description)
// This is a primitive scorer class for scoring number of secondaries
@@ -34,10 +35,13 @@
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// Modify: 2011-09-09 T.Aso modify comment in PrintAll().
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic
// energy of the secondary in MeV (x) vs. track weight (y)
// (Makoto Asai)
//
G4PSNofSecondary::G4PSNofSecondary(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),particleDef(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0),particleDef(0),
weighted(true)
{;}
@@ -59,6 +63,21 @@ G4bool G4PSNofSecondary::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4double weight = 1.0;
if ( weighted ) weight *= aStep->GetPreStepPoint()->GetWeight();
EvtMap->add(index,weight);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSVolumeFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetPreStepPoint()->GetKineticEnergy(),weight);
}
}
return TRUE;
}
+19 -1
View File
@@ -28,6 +28,7 @@
// G4PSNofStep
#include "G4PSNofStep.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
// (Description)
// This is a primitive scorer class for scoring number of steps in the
@@ -35,10 +36,12 @@
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of step length
// in mm vs. number of steps (not weighted) (Makoto Asai)
//
G4PSNofStep::G4PSNofStep(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),boundaryFlag(false)
:G4VPrimitivePlotter(name,depth),HCID(-1),EvtMap(0),boundaryFlag(false)
{
SetUnit("");
}
@@ -54,6 +57,21 @@ G4bool G4PSNofStep::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4int index = GetIndex(aStep);
G4double val = 1.0;
EvtMap->add(index,val);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSNofStep::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetStepLength(),val);
}
}
return TRUE;
}
@@ -31,6 +31,8 @@
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring number of tracks,
@@ -40,11 +42,13 @@
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. current * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageCellCurrent::G4PSPassageCellCurrent(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCurrent(0),
:G4VPrimitivePlotter(name,depth),HCID(-1),fCurrentTrkID(-1),fCurrent(0),
EvtMap(0),weighted(true)
{
SetUnit("");
@@ -57,9 +61,25 @@ G4bool G4PSPassageCellCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
if ( IsPassed(aStep) ) {
fCurrent = 1.;
if(weighted) fCurrent = aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,fCurrent);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSVolumeFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetPreStepPoint()->GetKineticEnergy(),fCurrent);
}
}
}
return TRUE;
@@ -35,6 +35,8 @@
#include "G4VPhysicalVolume.hh"
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring cell flux.
@@ -48,11 +50,13 @@
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. cell flux * track weight (y) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageCellFlux::G4PSPassageCellFlux(G4String name, G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCellFlux(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fCurrentTrkID(-1),fCellFlux(0),
EvtMap(0),weighted(true)
{
DefineUnitAndCategory();
@@ -61,7 +65,7 @@ G4PSPassageCellFlux::G4PSPassageCellFlux(G4String name, G4int depth)
G4PSPassageCellFlux::G4PSPassageCellFlux(G4String name, const G4String& unit,
G4int depth)
: G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCellFlux(0),
: G4VPrimitivePlotter(name,depth),HCID(-1),fCurrentTrkID(-1),fCellFlux(0),
EvtMap(0),weighted(true)
{
DefineUnitAndCategory();
@@ -83,6 +87,21 @@ G4bool G4PSPassageCellFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
fCellFlux /= cubicVolume;
G4int index = GetIndex(aStep);
EvtMap->add(index,fCellFlux);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSPassageCellFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetPreStepPoint()->GetKineticEnergy(),fCellFlux);
}
}
}
return TRUE;
@@ -30,6 +30,7 @@
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
@@ -39,11 +40,13 @@
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of track length
// vs. number of tracks (not weighted) (Makoto Asai)
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageTrackLength::G4PSPassageTrackLength(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fTrackLength(0.),
:G4VPrimitivePlotter(name,depth),HCID(-1),fCurrentTrkID(-1),fTrackLength(0.),
EvtMap(0),weighted(false)
{
SetUnit("mm");
@@ -52,7 +55,7 @@ G4PSPassageTrackLength::G4PSPassageTrackLength(G4String name, G4int depth)
G4PSPassageTrackLength::G4PSPassageTrackLength(G4String name,
const G4String& unit,
G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fTrackLength(0.),
:G4VPrimitivePlotter(name,depth),HCID(-1),fCurrentTrkID(-1),fTrackLength(0.),
EvtMap(0),weighted(false)
{
SetUnit(unit);
@@ -68,6 +71,21 @@ G4bool G4PSPassageTrackLength::ProcessHits(G4Step* aStep,G4TouchableHistory*)
if ( IsPassed(aStep) ) {
G4int index = GetIndex(aStep);
EvtMap->add(index,fTrackLength);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSPassageTrackLength::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],fTrackLength,1.);
}
}
}
return TRUE;
@@ -28,6 +28,7 @@
// G4PSTrackCounter
#include "G4PSTrackCounter.hh"
#include "G4UnitsTable.hh"
#include "G4VScoreHistFiller.hh"
///////////////////////////////////////////////////////////////////////////////
// (Description)
@@ -39,7 +40,7 @@
///////////////////////////////////////////////////////////////////////////////
G4PSTrackCounter::G4PSTrackCounter(G4String name, G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),
:G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),
EvtMap(0),weighted(false)
{
SetUnit("");
@@ -77,6 +78,21 @@ G4bool G4PSTrackCounter::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4double val = 1.0;
if(weighted) val *= aStep->GetPreStepPoint()->GetWeight();
EvtMap->add(index,val);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSTrackCounter::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],aStep->GetPreStepPoint()->GetKineticEnergy(),val);
}
}
}
return TRUE;
@@ -0,0 +1,160 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Class G4PSVolumeFlux
//
// Class description:
// Scorer that scores number of tracks coming into the associated volume.
// Optionally number of tracks can be divided by the surface area to
// score the volume current and divided by cos(theta) for volume flux
// where theta is the incident angle
//
// - Created M. Asai, Sept. 2020
//
//
#include "G4PSVolumeFlux.hh"
#include "G4SystemOfUnits.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
#include "G4GeometryTolerance.hh"
#include "G4VScoreHistFiller.hh"
G4PSVolumeFlux::G4PSVolumeFlux(G4String name, G4int direction, G4int depth)
: G4VPrimitivePlotter(name,depth),HCID(-1),fDirection(direction),EvtMap(nullptr)
{;}
G4PSVolumeFlux::~G4PSVolumeFlux()
{;}
G4bool G4PSVolumeFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
G4StepPoint* thisStepPoint = nullptr;
if(fDirection==1) // Score only the inward particle
{
if(preStepPoint->GetStepStatus()==fGeomBoundary)
{ thisStepPoint = preStepPoint; }
else
{ return false; }
}
else if(fDirection==2) // Score only the outward particle
{
if(postStepPoint->GetStepStatus()==fGeomBoundary)
{ thisStepPoint = postStepPoint; }
else
{ return false; }
}
G4double flux = preStepPoint->GetWeight();
if(divare||divcos)
{
G4VPhysicalVolume* physVol = preStepPoint->GetPhysicalVolume();
G4VPVParameterisation* physParam = physVol->GetParameterisation();
G4VSolid * solid = nullptr;
if(physParam)
{ // for parameterized volume
auto idx = ((G4TouchableHistory*)(preStepPoint->GetTouchable()))->GetReplicaNumber(indexDepth);
solid = physParam->ComputeSolid(idx, physVol);
solid->ComputeDimensions(physParam,idx,physVol);
}
else
{ // for ordinary volume
solid = physVol->GetLogicalVolume()->GetSolid();
}
if(divare)
{ flux /= solid->GetSurfaceArea(); }
if(divcos)
{
G4TouchableHandle theTouchable = thisStepPoint->GetTouchableHandle();
G4ThreeVector pdirection = thisStepPoint->GetMomentumDirection();
G4ThreeVector localdir = theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection);
G4ThreeVector globalPos = thisStepPoint->GetPosition();
G4ThreeVector localPos = theTouchable->GetHistory()->GetTopTransform().TransformPoint(globalPos);
G4ThreeVector surfNormal = solid->SurfaceNormal(localPos);
G4double cosT = surfNormal.cosTheta(localdir);
if(cosT!=0.) flux /= std::abs(cosT);
}
}
G4int index = GetIndex(aStep);
EvtMap->add(index,flux);
if(hitIDMap.size()>0 && hitIDMap.find(index)!=hitIDMap.end())
{
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4Exception("G4PSVolumeFlux::ProcessHits","SCORER0123",JustWarning,
"G4TScoreHistFiller is not instantiated!! Histogram is not filled.");
}
else
{
filler->FillH1(hitIDMap[index],thisStepPoint->GetKineticEnergy(),flux);
}
}
return true;
}
void G4PSVolumeFlux::Initialize(G4HCofThisEvent* HCE)
{
if ( HCID < 0 ) HCID = GetCollectionID(0);
EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName());
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSVolumeFlux::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSVolumeFlux::clear(){
EvtMap->clear();
}
void G4PSVolumeFlux::DrawAll()
{;}
void G4PSVolumeFlux::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer" << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " flux : " << *(itr->second)
<< G4endl;
}
}
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Class G4PSVolumeFlux3D
//
// Class description:
// 3-dimentional extension of G4PSVolumeFlux scorer. This scorer should
// be assigned to 3-dimensional mesh.
//
// - Created M. Asai, Sept. 2020
//
//
//
// G4PSVolumeFlux3D
#include "G4PSVolumeFlux3D.hh"
G4PSVolumeFlux3D::G4PSVolumeFlux3D(G4String name,G4int direction,
G4int ni, G4int nj, G4int nk,
G4int depi, G4int depj, G4int depk)
:G4PSVolumeFlux(name,direction),
fDepthi(depi),fDepthj(depj),fDepthk(depk)
{
fNi=ni;
fNj=nj;
fNk=nk;
}
G4PSVolumeFlux3D::~G4PSVolumeFlux3D()
{;}
G4int G4PSVolumeFlux3D::GetIndex(G4Step* aStep)
{
const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
G4int i = touchable->GetReplicaNumber(fDepthi);
G4int j = touchable->GetReplicaNumber(fDepthj);
G4int k = touchable->GetReplicaNumber(fDepthk);
return i*fNj*fNk+j*fNk+k;
}