Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4PSSphereSurfaceFlux3D Class Reference

#include <G4PSSphereSurfaceFlux3D.hh>

Inheritance diagram for G4PSSphereSurfaceFlux3D:
G4PSSphereSurfaceFlux G4VPrimitiveScorer

Public Member Functions

virtual void clear ()
 
void DivideByArea (G4bool flg=true)
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
 G4PSSphereSurfaceFlux3D (G4String name, G4int direction, const G4String &unit, G4int ni=1, G4int nj=1, G4int nk=1, G4int depi=2, G4int depj=1, G4int depk=0)
 
 G4PSSphereSurfaceFlux3D (G4String name, G4int direction, G4int ni=1, G4int nj=1, G4int nk=1, G4int depi=2, G4int depj=1, G4int depk=0)
 
G4int GetCollectionID (G4int)
 
G4VSDFilterGetFilter () const
 
G4MultiFunctionalDetectorGetMultiFunctionalDetector () const
 
G4String GetName () const
 
const G4StringGetUnit () const
 
G4double GetUnitValue () const
 
G4int GetVerboseLevel () const
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual void PrintAll ()
 
void SetFilter (G4VSDFilter *f)
 
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
 
void SetNijk (G4int i, G4int j, G4int k)
 
virtual void SetUnit (const G4String &unit)
 
void SetVerboseLevel (G4int vl)
 
void Weighted (G4bool flg=true)
 
virtual ~G4PSSphereSurfaceFlux3D ()
 

Protected Member Functions

void CheckAndSetUnit (const G4String &unit, const G4String &category)
 
G4VSolidComputeCurrentSolid (G4Step *aStep)
 
G4VSolidComputeSolid (G4Step *aStep, G4int replicaIdx)
 
virtual void DefineUnitAndCategory ()
 
virtual G4int GetIndex (G4Step *)
 
G4int IsSelectedSurface (G4Step *, G4Sphere *)
 
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 

Protected Attributes

G4MultiFunctionalDetectordetector
 
G4VSDFilterfilter
 
G4int fNi
 
G4int fNj
 
G4int fNk
 
G4int indexDepth
 
G4String primitiveName
 
G4String unitName
 
G4double unitValue
 
G4int verboseLevel
 

Private Member Functions

G4bool HitPrimitive (G4Step *aStep, G4TouchableHistory *ROhis)
 

Private Attributes

G4bool divideByArea
 
G4THitsMap< G4double > * EvtMap
 
G4int fDepthi
 
G4int fDepthj
 
G4int fDepthk
 
G4int fDirection
 
G4int HCID
 
G4bool weighted
 

Detailed Description

Definition at line 52 of file G4PSSphereSurfaceFlux3D.hh.

Constructor & Destructor Documentation

◆ G4PSSphereSurfaceFlux3D() [1/2]

G4PSSphereSurfaceFlux3D::G4PSSphereSurfaceFlux3D ( G4String  name,
G4int  direction,
G4int  ni = 1,
G4int  nj = 1,
G4int  nk = 1,
G4int  depi = 2,
G4int  depj = 1,
G4int  depk = 0 
)

Definition at line 49 of file G4PSSphereSurfaceFlux3D.cc.

53 : G4PSSphereSurfaceFlux(name, direction)
54 , fDepthi(depi)
55 , fDepthj(depj)
56 , fDepthk(depk)
57{
58 fNi = ni;
59 fNj = nj;
60 fNk = nk;
61}
G4PSSphereSurfaceFlux(G4String name, G4int direction, G4int depth=0)
const char * name(G4int ptype)

References G4VPrimitiveScorer::fNi, G4VPrimitiveScorer::fNj, and G4VPrimitiveScorer::fNk.

◆ G4PSSphereSurfaceFlux3D() [2/2]

G4PSSphereSurfaceFlux3D::G4PSSphereSurfaceFlux3D ( G4String  name,
G4int  direction,
const G4String unit,
G4int  ni = 1,
G4int  nj = 1,
G4int  nk = 1,
G4int  depi = 2,
G4int  depj = 1,
G4int  depk = 0 
)

Definition at line 63 of file G4PSSphereSurfaceFlux3D.cc.

67 : G4PSSphereSurfaceFlux(name, direction)
68 , fDepthi(depi)
69 , fDepthj(depj)
70 , fDepthk(depk)
71{
72 fNi = ni;
73 fNj = nj;
74 fNk = nk;
75 SetUnit(unit);
76}
virtual void SetUnit(const G4String &unit)

References G4VPrimitiveScorer::fNi, G4VPrimitiveScorer::fNj, G4VPrimitiveScorer::fNk, and G4PSSphereSurfaceFlux::SetUnit().

◆ ~G4PSSphereSurfaceFlux3D()

G4PSSphereSurfaceFlux3D::~G4PSSphereSurfaceFlux3D ( )
virtual

Definition at line 78 of file G4PSSphereSurfaceFlux3D.cc.

78{ ; }

Member Function Documentation

◆ CheckAndSetUnit()

void G4VPrimitiveScorer::CheckAndSetUnit ( const G4String unit,
const G4String category 
)
protectedinherited

Definition at line 81 of file G4VPrimitiveScorer.cc.

83{
84 if(G4UnitDefinition::GetCategory(unit) == category)
85 {
86 unitName = unit;
88 }
89 else
90 {
91 G4String msg = "Invalid unit [" + unit + "] (Current unit is [" +
92 GetUnit() + "] ) requested for " + GetName();
93 G4Exception("G4VPrimitiveScorer::CheckAndSetUnit", "Det0151", JustWarning,
94 msg);
95 }
96}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)
G4String GetName() const
const G4String & GetUnit() const

References G4Exception(), G4UnitDefinition::GetCategory(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), G4UnitDefinition::GetValueOf(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.

Referenced by G4PSCellCharge::SetUnit(), G4PSCellFlux::SetUnit(), G4PSCylinderSurfaceCurrent::SetUnit(), G4PSCylinderSurfaceFlux::SetUnit(), G4PSDoseDeposit::SetUnit(), G4PSEnergyDeposit::SetUnit(), G4PSFlatSurfaceCurrent::SetUnit(), G4PSFlatSurfaceFlux::SetUnit(), G4PSMinKinEAtGeneration::SetUnit(), G4PSPassageCellFlux::SetUnit(), G4PSPassageTrackLength::SetUnit(), G4PSSphereSurfaceCurrent::SetUnit(), G4PSSphereSurfaceFlux::SetUnit(), and G4PSTrackLength::SetUnit().

◆ clear()

void G4PSSphereSurfaceFlux::clear ( )
virtualinherited

Reimplemented from G4VPrimitiveScorer.

Definition at line 233 of file G4PSSphereSurfaceFlux.cc.

233{ EvtMap->clear(); }
G4THitsMap< G4double > * EvtMap
void clear()
Definition: G4THitsMap.hh:524

References G4VTHitsMap< T, Map_t >::clear(), and G4PSSphereSurfaceFlux::EvtMap.

◆ ComputeCurrentSolid()

G4VSolid * G4VPrimitiveScorer::ComputeCurrentSolid ( G4Step aStep)
protectedinherited

Definition at line 128 of file G4VPrimitiveScorer.cc.

129{
130 G4StepPoint* preStep = aStep->GetPreStepPoint();
131 // The only difference: did not know the replica number
132 G4int replicaIdx =
133 (static_cast<const G4TouchableHistory*>(preStep->GetTouchable()))
134 ->GetReplicaNumber(indexDepth);
135
136 return ComputeSolid(aStep, replicaIdx);
137}
int G4int
Definition: G4Types.hh:85
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPreStepPoint() const
G4VSolid * ComputeSolid(G4Step *aStep, G4int replicaIdx)

References G4VPrimitiveScorer::ComputeSolid(), G4Step::GetPreStepPoint(), G4StepPoint::GetTouchable(), and G4VPrimitiveScorer::indexDepth.

Referenced by G4PSCylinderSurfaceCurrent::ProcessHits(), G4PSCylinderSurfaceFlux::ProcessHits(), and G4PSSphereSurfaceCurrent::ProcessHits().

◆ ComputeSolid()

G4VSolid * G4VPrimitiveScorer::ComputeSolid ( G4Step aStep,
G4int  replicaIdx 
)
protectedinherited

Definition at line 98 of file G4VPrimitiveScorer.cc.

99{
100 G4VSolid* solid = nullptr;
101 G4StepPoint* preStep = aStep->GetPreStepPoint();
102
103 auto physVol = preStep->GetPhysicalVolume();
104 G4VPVParameterisation* physParam = physVol->GetParameterisation();
105
106 if(physParam)
107 { // for parameterized volume
108 if(replicaIdx < 0)
109 {
111 desc << "Incorrect replica number --- GetReplicaNumber : " << replicaIdx
112 << G4endl;
113 G4Exception("G4VPrimitiveScorer::ComputeSolid", "DetPS0001", JustWarning,
114 desc);
115 // replicaIdx= 0; // You must ensure that it's in range !!!
116 }
117 solid = physParam->ComputeSolid(replicaIdx, physVol);
118 solid->ComputeDimensions(physParam, replicaIdx, physVol);
119 }
120 else
121 { // for ordinary volume
122 solid = physVol->GetLogicalVolume()->GetSolid();
123 }
124
125 return solid;
126}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4endl
Definition: G4ios.hh:57
G4VPhysicalVolume * GetPhysicalVolume() const
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:137

References G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), G4endl, G4Exception(), G4StepPoint::GetPhysicalVolume(), G4Step::GetPreStepPoint(), and JustWarning.

Referenced by G4VPrimitiveScorer::ComputeCurrentSolid(), G4PSCellFlux::ComputeVolume(), G4PSDoseDeposit::ComputeVolume(), and G4PSPassageCellFlux::ComputeVolume().

◆ DefineUnitAndCategory()

void G4PSSphereSurfaceFlux::DefineUnitAndCategory ( )
protectedvirtualinherited

Definition at line 274 of file G4PSSphereSurfaceFlux.cc.

275{
276 // Per Unit Surface
277 new G4UnitDefinition("percentimeter2", "percm2", "Per Unit Surface",
278 (1. / cm2));
279 new G4UnitDefinition("permillimeter2", "permm2", "Per Unit Surface",
280 (1. / mm2));
281 new G4UnitDefinition("permeter2", "perm2", "Per Unit Surface", (1. / m2));
282}
static constexpr double mm2
Definition: G4SIunits.hh:96
static constexpr double cm2
Definition: G4SIunits.hh:100
static constexpr double m2
Definition: G4SIunits.hh:110

References cm2, m2, and mm2.

Referenced by G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux().

◆ DivideByArea()

void G4PSSphereSurfaceFlux::DivideByArea ( G4bool  flg = true)
inlineinherited

Definition at line 70 of file G4PSSphereSurfaceFlux.hh.

References G4PSSphereSurfaceFlux::divideByArea.

◆ DrawAll()

void G4PSSphereSurfaceFlux::DrawAll ( )
virtualinherited

Reimplemented from G4VPrimitiveScorer.

Definition at line 235 of file G4PSSphereSurfaceFlux.cc.

235{ ; }

◆ EndOfEvent()

void G4PSSphereSurfaceFlux::EndOfEvent ( G4HCofThisEvent )
virtualinherited

Reimplemented from G4VPrimitiveScorer.

Definition at line 231 of file G4PSSphereSurfaceFlux.cc.

231{ ; }

◆ GetCollectionID()

G4int G4VPrimitiveScorer::GetCollectionID ( G4int  )
inherited

Definition at line 55 of file G4VPrimitiveScorer.cc.

56{
57 if(detector)
59 "/" + primitiveName);
60 else
61 return -1;
62}
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:38
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:142
G4MultiFunctionalDetector * detector

References G4VPrimitiveScorer::detector, G4SDManager::GetCollectionID(), G4VSensitiveDetector::GetName(), G4SDManager::GetSDMpointer(), and G4VPrimitiveScorer::primitiveName.

Referenced by G4PSCellCharge::Initialize(), G4PSCellFlux::Initialize(), G4PSCylinderSurfaceCurrent::Initialize(), G4PSCylinderSurfaceFlux::Initialize(), G4PSDoseDeposit::Initialize(), G4PSEnergyDeposit::Initialize(), G4PSFlatSurfaceCurrent::Initialize(), G4PSFlatSurfaceFlux::Initialize(), G4PSMinKinEAtGeneration::Initialize(), G4PSNofCollision::Initialize(), G4PSNofSecondary::Initialize(), G4PSNofStep::Initialize(), G4PSPassageCellCurrent::Initialize(), G4PSPassageCellFlux::Initialize(), G4PSPassageTrackLength::Initialize(), G4PSPopulation::Initialize(), G4PSSphereSurfaceCurrent::Initialize(), G4PSSphereSurfaceFlux::Initialize(), G4PSTermination::Initialize(), G4PSTrackCounter::Initialize(), G4PSTrackLength::Initialize(), and G4PSVolumeFlux::Initialize().

◆ GetFilter()

G4VSDFilter * G4VPrimitiveScorer::GetFilter ( ) const
inlineinherited

Definition at line 108 of file G4VPrimitiveScorer.hh.

108{ return filter; }

References G4VPrimitiveScorer::filter.

Referenced by G4VScoringMesh::List(), and G4VScoringMesh::SetFilter().

◆ GetIndex()

G4int G4PSSphereSurfaceFlux3D::GetIndex ( G4Step aStep)
protectedvirtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 80 of file G4PSSphereSurfaceFlux3D.cc.

81{
82 const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
83 G4int i = touchable->GetReplicaNumber(fDepthi);
84 G4int j = touchable->GetReplicaNumber(fDepthj);
85 G4int k = touchable->GetReplicaNumber(fDepthk);
86
87 return i * fNj * fNk + j * fNk + k;
88}
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:50

References fDepthi, fDepthj, fDepthk, G4VPrimitiveScorer::fNj, G4VPrimitiveScorer::fNk, G4Step::GetPreStepPoint(), G4VTouchable::GetReplicaNumber(), and G4StepPoint::GetTouchable().

◆ GetMultiFunctionalDetector()

G4MultiFunctionalDetector * G4VPrimitiveScorer::GetMultiFunctionalDetector ( ) const
inlineinherited

◆ GetName()

G4String G4VPrimitiveScorer::GetName ( ) const
inlineinherited

Definition at line 106 of file G4VPrimitiveScorer.hh.

106{ return primitiveName; }

References G4VPrimitiveScorer::primitiveName.

Referenced by G4VPrimitiveScorer::CheckAndSetUnit(), G4VScoringMesh::GetPrimitiveScorer(), G4PSCellCharge::Initialize(), G4PSCellFlux::Initialize(), G4PSCylinderSurfaceCurrent::Initialize(), G4PSCylinderSurfaceFlux::Initialize(), G4PSDoseDeposit::Initialize(), G4PSEnergyDeposit::Initialize(), G4PSFlatSurfaceCurrent::Initialize(), G4PSFlatSurfaceFlux::Initialize(), G4PSMinKinEAtGeneration::Initialize(), G4PSNofCollision::Initialize(), G4PSNofSecondary::Initialize(), G4PSNofStep::Initialize(), G4PSPassageCellCurrent::Initialize(), G4PSPassageCellFlux::Initialize(), G4PSPassageTrackLength::Initialize(), G4PSPopulation::Initialize(), G4PSSphereSurfaceCurrent::Initialize(), G4PSSphereSurfaceFlux::Initialize(), G4PSTermination::Initialize(), G4PSTrackCounter::Initialize(), G4PSTrackLength::Initialize(), G4PSVolumeFlux::Initialize(), G4VScoringMesh::List(), G4PSCellCharge::PrintAll(), G4PSCellFlux::PrintAll(), G4PSCylinderSurfaceCurrent::PrintAll(), G4PSCylinderSurfaceFlux::PrintAll(), G4PSDoseDeposit::PrintAll(), G4PSEnergyDeposit::PrintAll(), G4PSFlatSurfaceCurrent::PrintAll(), G4PSFlatSurfaceFlux::PrintAll(), G4PSMinKinEAtGeneration::PrintAll(), G4PSNofCollision::PrintAll(), G4PSNofSecondary::PrintAll(), G4PSNofStep::PrintAll(), G4PSPassageCellCurrent::PrintAll(), G4PSPassageCellFlux::PrintAll(), G4PSPassageTrackLength::PrintAll(), G4PSPopulation::PrintAll(), G4PSSphereSurfaceCurrent::PrintAll(), G4PSSphereSurfaceFlux::PrintAll(), G4PSTermination::PrintAll(), G4PSTrackCounter::PrintAll(), G4PSTrackLength::PrintAll(), G4PSVolumeFlux::PrintAll(), G4MultiFunctionalDetector::RegisterPrimitive(), G4MultiFunctionalDetector::RemovePrimitive(), G4VScoringMesh::SetFilter(), G4VScoringMesh::SetPrimitiveScorer(), G4PSCylinderSurfaceCurrent::SetUnit(), G4PSCylinderSurfaceFlux::SetUnit(), G4PSFlatSurfaceCurrent::SetUnit(), G4PSFlatSurfaceFlux::SetUnit(), G4PSNofCollision::SetUnit(), G4PSNofSecondary::SetUnit(), G4PSNofStep::SetUnit(), G4PSPassageCellCurrent::SetUnit(), G4PSPopulation::SetUnit(), G4PSSphereSurfaceCurrent::SetUnit(), G4PSSphereSurfaceFlux::SetUnit(), G4PSTermination::SetUnit(), and G4PSTrackCounter::SetUnit().

◆ GetUnit()

const G4String & G4VPrimitiveScorer::GetUnit ( ) const
inlineinherited

◆ GetUnitValue()

G4double G4VPrimitiveScorer::GetUnitValue ( ) const
inlineinherited

◆ GetVerboseLevel()

G4int G4VPrimitiveScorer::GetVerboseLevel ( ) const
inlineinherited

Definition at line 110 of file G4VPrimitiveScorer.hh.

110{ return verboseLevel; }

References G4VPrimitiveScorer::verboseLevel.

◆ HitPrimitive()

G4bool G4VPrimitiveScorer::HitPrimitive ( G4Step aStep,
G4TouchableHistory ROhis 
)
inlineprivateinherited

Definition at line 113 of file G4VPrimitiveScorer.hh.

114 {
115 if(filter)
116 {
117 if(!(filter->Accept(aStep)))
118 return false;
119 }
120 return ProcessHits(aStep, ROhis);
121 }
virtual G4bool ProcessHits(G4Step *, G4TouchableHistory *)=0
virtual G4bool Accept(const G4Step *) const =0

References G4VSDFilter::Accept(), G4VPrimitiveScorer::filter, and G4VPrimitiveScorer::ProcessHits().

◆ Initialize()

void G4PSSphereSurfaceFlux::Initialize ( G4HCofThisEvent HCE)
virtualinherited

◆ IsSelectedSurface()

G4int G4PSSphereSurfaceFlux::IsSelectedSurface ( G4Step aStep,
G4Sphere sphereSolid 
)
protectedinherited

Definition at line 168 of file G4PSSphereSurfaceFlux.cc.

170{
171 G4TouchableHandle theTouchable =
175
177 {
178 // Entering Geometry
179 G4ThreeVector stppos1 = aStep->GetPreStepPoint()->GetPosition();
180 G4ThreeVector localpos1 =
181 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
182 G4double localR2 = localpos1.x() * localpos1.x() +
183 localpos1.y() * localpos1.y() +
184 localpos1.z() * localpos1.z();
185 // G4double InsideRadius2 =
186 // sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius();
187 // if(std::fabs( localR2 - InsideRadius2 ) < kCarTolerance ){
188 G4double InsideRadius = sphereSolid->GetInnerRadius();
189 if(localR2 >
190 (InsideRadius - kCarTolerance) * (InsideRadius - kCarTolerance) &&
191 localR2 <
192 (InsideRadius + kCarTolerance) * (InsideRadius + kCarTolerance))
193 {
194 return fFlux_In;
195 }
196 }
197
199 {
200 // Exiting Geometry
201 G4ThreeVector stppos2 = aStep->GetPostStepPoint()->GetPosition();
202 G4ThreeVector localpos2 =
203 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
204 G4double localR2 = localpos2.x() * localpos2.x() +
205 localpos2.y() * localpos2.y() +
206 localpos2.z() * localpos2.z();
207 // G4double InsideRadius2 =
208 // sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius();
209 // if(std::facb(localR2 - InsideRadius2) ) < kCarTolerance ){
210 G4double InsideRadius = sphereSolid->GetInnerRadius();
211 if(localR2 >
212 (InsideRadius - kCarTolerance) * (InsideRadius - kCarTolerance) &&
213 localR2 <
214 (InsideRadius + kCarTolerance) * (InsideRadius + kCarTolerance))
215 {
216 return fFlux_Out;
217 }
218 }
219
220 return -1;
221}
const G4double kCarTolerance
@ fFlux_Out
@ fFlux_In
@ fGeomBoundary
Definition: G4StepStatus.hh:43
double G4double
Definition: G4Types.hh:83
double z() const
double x() const
double y() const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
const G4AffineTransform & GetTopTransform() const
G4double GetInnerRadius() const
G4StepStatus GetStepStatus() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4StepPoint * GetPostStepPoint() const
virtual const G4NavigationHistory * GetHistory() const
Definition: G4VTouchable.cc:82

References fFlux_In, fFlux_Out, fGeomBoundary, G4VTouchable::GetHistory(), G4Sphere::GetInnerRadius(), G4GeometryTolerance::GetInstance(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetStepStatus(), G4GeometryTolerance::GetSurfaceTolerance(), G4NavigationHistory::GetTopTransform(), G4StepPoint::GetTouchableHandle(), kCarTolerance, G4AffineTransform::TransformPoint(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4PSSphereSurfaceFlux::ProcessHits().

◆ PrintAll()

void G4PSSphereSurfaceFlux::PrintAll ( )
virtualinherited

Reimplemented from G4VPrimitiveScorer.

Definition at line 237 of file G4PSSphereSurfaceFlux.cc.

238{
239 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
240 G4cout << " PrimitiveScorer " << GetName() << G4endl;
241 G4cout << " Number of entries " << EvtMap->entries() << G4endl;
242 std::map<G4int, G4double*>::iterator itr = EvtMap->GetMap()->begin();
243 for(; itr != EvtMap->GetMap()->end(); itr++)
244 {
245 G4cout << " copy no.: " << itr->first
246 << " Flux : " << *(itr->second) / GetUnitValue() << " ["
247 << GetUnit() << "]" << G4endl;
248 }
249}
G4GLOB_DLL std::ostream G4cout
G4double GetUnitValue() const
Map_t * GetMap() const
Definition: G4THitsMap.hh:155
size_t entries() const
Definition: G4THitsMap.hh:158

References G4VPrimitiveScorer::detector, G4VTHitsMap< T, Map_t >::entries(), G4PSSphereSurfaceFlux::EvtMap, G4cout, G4endl, G4VTHitsMap< T, Map_t >::GetMap(), G4VPrimitiveScorer::GetName(), G4VSensitiveDetector::GetName(), G4VPrimitiveScorer::GetUnit(), and G4VPrimitiveScorer::GetUnitValue().

◆ ProcessHits()

G4bool G4PSSphereSurfaceFlux::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
protectedvirtualinherited

Implements G4VPrimitiveScorer.

Definition at line 87 of file G4PSSphereSurfaceFlux.cc.

88{
89 G4StepPoint* preStep = aStep->GetPreStepPoint();
90
91 G4VPhysicalVolume* physVol = preStep->GetPhysicalVolume();
92 G4VPVParameterisation* physParam = physVol->GetParameterisation();
93 G4VSolid* solid = 0;
94 if(physParam)
95 { // for parameterized volume
96 G4int idx =
98 ->GetReplicaNumber(indexDepth);
99 solid = physParam->ComputeSolid(idx, physVol);
100 solid->ComputeDimensions(physParam, idx, physVol);
101 }
102 else
103 { // for ordinary volume
104 solid = physVol->GetLogicalVolume()->GetSolid();
105 }
106
107 G4Sphere* sphereSolid = (G4Sphere*) (solid);
108
109 G4int dirFlag = IsSelectedSurface(aStep, sphereSolid);
110 if(dirFlag > 0)
111 {
112 if(fDirection == fFlux_InOut || fDirection == dirFlag)
113 {
114 G4StepPoint* thisStep = 0;
115 if(dirFlag == fFlux_In)
116 {
117 thisStep = preStep;
118 }
119 else if(dirFlag == fFlux_Out)
120 {
121 thisStep = aStep->GetPostStepPoint();
122 }
123 else
124 {
125 return FALSE;
126 }
127
128 G4TouchableHandle theTouchable = thisStep->GetTouchableHandle();
129 G4ThreeVector pdirection = thisStep->GetMomentumDirection();
130 G4ThreeVector localdir =
131 theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection);
132 G4double localdirL2 = localdir.x() * localdir.x() +
133 localdir.y() * localdir.y() +
134 localdir.z() * localdir.z();
135 G4ThreeVector stppos1 = aStep->GetPreStepPoint()->GetPosition();
136 G4ThreeVector localpos1 =
137 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
138 G4double localR2 = localpos1.x() * localpos1.x() +
139 localpos1.y() * localpos1.y() +
140 localpos1.z() * localpos1.z();
141 G4double anglefactor =
142 (localdir.x() * localpos1.x() + localdir.y() * localpos1.y() +
143 localdir.z() * localpos1.z()) /
144 std::sqrt(localdirL2) / std::sqrt(localR2);
145 if(anglefactor < 0.0)
146 anglefactor *= -1.0;
147
148 G4double current = 1.0 / anglefactor;
149 if(weighted)
150 current *= thisStep->GetWeight(); // Flux (Particle Weight)
151 if(divideByArea) // Flux with angle.
152 {
153 G4double radi = sphereSolid->GetInnerRadius();
154 G4double dph = sphereSolid->GetDeltaPhiAngle() / radian;
155 G4double stth = sphereSolid->GetStartThetaAngle() / radian;
156 G4double enth = stth + sphereSolid->GetDeltaThetaAngle() / radian;
157 current /= radi * radi * dph * (-std::cos(enth) + std::cos(stth));
158 }
159
160 G4int index = GetIndex(aStep);
161 EvtMap->add(index, current);
162 }
163 }
164
165 return TRUE;
166}
@ fFlux_InOut
static constexpr double radian
Definition: G4SIunits.hh:122
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
G4VSolid * GetSolid() const
G4int IsSelectedSurface(G4Step *, G4Sphere *)
G4double GetDeltaPhiAngle() const
G4double GetDeltaThetaAngle() const
G4double GetStartThetaAngle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetWeight() const
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual G4int GetIndex(G4Step *)
size_t add(const G4int &key, U *&aHit) const
Definition: G4THitsMap.hh:177

References G4VTHitsMap< T, Map_t >::add(), G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), G4PSSphereSurfaceFlux::divideByArea, G4PSSphereSurfaceFlux::EvtMap, FALSE, G4PSSphereSurfaceFlux::fDirection, fFlux_In, fFlux_InOut, fFlux_Out, G4Sphere::GetDeltaPhiAngle(), G4Sphere::GetDeltaThetaAngle(), G4VTouchable::GetHistory(), G4VPrimitiveScorer::GetIndex(), G4Sphere::GetInnerRadius(), G4VPhysicalVolume::GetLogicalVolume(), G4StepPoint::GetMomentumDirection(), G4VPhysicalVolume::GetParameterisation(), G4StepPoint::GetPhysicalVolume(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4LogicalVolume::GetSolid(), G4Sphere::GetStartThetaAngle(), G4NavigationHistory::GetTopTransform(), G4StepPoint::GetTouchable(), G4StepPoint::GetTouchableHandle(), G4StepPoint::GetWeight(), G4VPrimitiveScorer::indexDepth, G4PSSphereSurfaceFlux::IsSelectedSurface(), radian, G4AffineTransform::TransformAxis(), G4AffineTransform::TransformPoint(), TRUE, G4PSSphereSurfaceFlux::weighted, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ SetFilter()

void G4VPrimitiveScorer::SetFilter ( G4VSDFilter f)
inlineinherited

Definition at line 107 of file G4VPrimitiveScorer.hh.

107{ filter = f; }

References G4VPrimitiveScorer::filter.

Referenced by G4VScoringMesh::SetFilter().

◆ SetMultiFunctionalDetector()

void G4VPrimitiveScorer::SetMultiFunctionalDetector ( G4MultiFunctionalDetector d)
inlineinherited

◆ SetNijk()

void G4VPrimitiveScorer::SetNijk ( G4int  i,
G4int  j,
G4int  k 
)
inlineinherited

Definition at line 133 of file G4VPrimitiveScorer.hh.

134 {
135 fNi = i;
136 fNj = j;
137 fNk = k;
138 }

References G4VPrimitiveScorer::fNi, G4VPrimitiveScorer::fNj, and G4VPrimitiveScorer::fNk.

Referenced by G4VScoringMesh::SetPrimitiveScorer().

◆ SetUnit()

void G4PSSphereSurfaceFlux::SetUnit ( const G4String unit)
virtualinherited

Definition at line 251 of file G4PSSphereSurfaceFlux.cc.

252{
253 if(divideByArea)
254 {
255 CheckAndSetUnit(unit, "Per Unit Surface");
256 }
257 else
258 {
259 if(unit == "")
260 {
261 unitName = unit;
262 unitValue = 1.0;
263 }
264 else
265 {
266 G4String msg = "Invalid unit [" + unit + "] (Current unit is [" +
267 GetUnit() + "] ) for " + GetName();
268 G4Exception("G4PSSphereSurfaceFlux::SetUnit", "DetPS0016", JustWarning,
269 msg);
270 }
271 }
272}
void CheckAndSetUnit(const G4String &unit, const G4String &category)

References G4VPrimitiveScorer::CheckAndSetUnit(), G4PSSphereSurfaceFlux::divideByArea, G4Exception(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.

Referenced by G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux(), and G4PSSphereSurfaceFlux3D().

◆ SetVerboseLevel()

void G4VPrimitiveScorer::SetVerboseLevel ( G4int  vl)
inlineinherited

Definition at line 109 of file G4VPrimitiveScorer.hh.

109{ verboseLevel = vl; }

References G4VPrimitiveScorer::verboseLevel.

◆ Weighted()

void G4PSSphereSurfaceFlux::Weighted ( G4bool  flg = true)
inlineinherited

Definition at line 67 of file G4PSSphereSurfaceFlux.hh.

67{ weighted = flg; }

References G4PSSphereSurfaceFlux::weighted.

Field Documentation

◆ detector

G4MultiFunctionalDetector* G4VPrimitiveScorer::detector
protectedinherited

◆ divideByArea

G4bool G4PSSphereSurfaceFlux::divideByArea
privateinherited

◆ EvtMap

G4THitsMap<G4double>* G4PSSphereSurfaceFlux::EvtMap
privateinherited

◆ fDepthi

G4int G4PSSphereSurfaceFlux3D::fDepthi
private

Definition at line 69 of file G4PSSphereSurfaceFlux3D.hh.

Referenced by GetIndex().

◆ fDepthj

G4int G4PSSphereSurfaceFlux3D::fDepthj
private

Definition at line 69 of file G4PSSphereSurfaceFlux3D.hh.

Referenced by GetIndex().

◆ fDepthk

G4int G4PSSphereSurfaceFlux3D::fDepthk
private

Definition at line 69 of file G4PSSphereSurfaceFlux3D.hh.

Referenced by GetIndex().

◆ fDirection

G4int G4PSSphereSurfaceFlux::fDirection
privateinherited

Definition at line 91 of file G4PSSphereSurfaceFlux.hh.

Referenced by G4PSSphereSurfaceFlux::ProcessHits().

◆ filter

G4VSDFilter* G4VPrimitiveScorer::filter
protectedinherited

◆ fNi

G4int G4VPrimitiveScorer::fNi
protectedinherited

◆ fNj

G4int G4VPrimitiveScorer::fNj
protectedinherited

Definition at line 131 of file G4VPrimitiveScorer.hh.

Referenced by G4PSCellCharge3D::G4PSCellCharge3D(), G4PSCellFlux3D::G4PSCellFlux3D(), G4PSCylinderSurfaceCurrent3D::G4PSCylinderSurfaceCurrent3D(), G4PSCylinderSurfaceFlux3D::G4PSCylinderSurfaceFlux3D(), G4PSDoseDeposit3D::G4PSDoseDeposit3D(), G4PSEnergyDeposit3D::G4PSEnergyDeposit3D(), G4PSFlatSurfaceCurrent3D::G4PSFlatSurfaceCurrent3D(), G4PSFlatSurfaceFlux3D::G4PSFlatSurfaceFlux3D(), G4PSMinKinEAtGeneration3D::G4PSMinKinEAtGeneration3D(), G4PSNofCollision3D::G4PSNofCollision3D(), G4PSNofSecondary3D::G4PSNofSecondary3D(), G4PSNofStep3D::G4PSNofStep3D(), G4PSPassageCellCurrent3D::G4PSPassageCellCurrent3D(), G4PSPassageCellFlux3D::G4PSPassageCellFlux3D(), G4PSPassageTrackLength3D::G4PSPassageTrackLength3D(), G4PSPopulation3D::G4PSPopulation3D(), G4PSSphereSurfaceCurrent3D::G4PSSphereSurfaceCurrent3D(), G4PSSphereSurfaceFlux3D(), G4PSStepChecker3D::G4PSStepChecker3D(), G4PSTermination3D::G4PSTermination3D(), G4PSTrackCounter3D::G4PSTrackCounter3D(), G4PSTrackLength3D::G4PSTrackLength3D(), G4PSVolumeFlux3D::G4PSVolumeFlux3D(), G4PSCellCharge3D::GetIndex(), G4PSCellFlux3D::GetIndex(), G4PSCylinderSurfaceCurrent3D::GetIndex(), G4PSCylinderSurfaceFlux3D::GetIndex(), G4PSDoseDeposit3D::GetIndex(), G4PSEnergyDeposit3D::GetIndex(), G4PSFlatSurfaceCurrent3D::GetIndex(), G4PSFlatSurfaceFlux3D::GetIndex(), G4PSMinKinEAtGeneration3D::GetIndex(), G4PSNofCollision3D::GetIndex(), G4PSNofSecondary3D::GetIndex(), G4PSNofStep3D::GetIndex(), G4PSPassageCellCurrent3D::GetIndex(), G4PSPassageCellFlux3D::GetIndex(), G4PSPassageTrackLength3D::GetIndex(), G4PSPopulation3D::GetIndex(), G4PSSphereSurfaceCurrent3D::GetIndex(), GetIndex(), G4PSStepChecker3D::GetIndex(), G4PSTermination3D::GetIndex(), G4PSTrackCounter3D::GetIndex(), G4PSTrackLength3D::GetIndex(), G4PSVolumeFlux3D::GetIndex(), and G4VPrimitiveScorer::SetNijk().

◆ fNk

G4int G4VPrimitiveScorer::fNk
protectedinherited

Definition at line 131 of file G4VPrimitiveScorer.hh.

Referenced by G4PSCellCharge3D::G4PSCellCharge3D(), G4PSCellFlux3D::G4PSCellFlux3D(), G4PSCylinderSurfaceCurrent3D::G4PSCylinderSurfaceCurrent3D(), G4PSCylinderSurfaceFlux3D::G4PSCylinderSurfaceFlux3D(), G4PSDoseDeposit3D::G4PSDoseDeposit3D(), G4PSEnergyDeposit3D::G4PSEnergyDeposit3D(), G4PSFlatSurfaceCurrent3D::G4PSFlatSurfaceCurrent3D(), G4PSFlatSurfaceFlux3D::G4PSFlatSurfaceFlux3D(), G4PSMinKinEAtGeneration3D::G4PSMinKinEAtGeneration3D(), G4PSNofCollision3D::G4PSNofCollision3D(), G4PSNofSecondary3D::G4PSNofSecondary3D(), G4PSNofStep3D::G4PSNofStep3D(), G4PSPassageCellCurrent3D::G4PSPassageCellCurrent3D(), G4PSPassageCellFlux3D::G4PSPassageCellFlux3D(), G4PSPassageTrackLength3D::G4PSPassageTrackLength3D(), G4PSPopulation3D::G4PSPopulation3D(), G4PSSphereSurfaceCurrent3D::G4PSSphereSurfaceCurrent3D(), G4PSSphereSurfaceFlux3D(), G4PSStepChecker3D::G4PSStepChecker3D(), G4PSTermination3D::G4PSTermination3D(), G4PSTrackCounter3D::G4PSTrackCounter3D(), G4PSTrackLength3D::G4PSTrackLength3D(), G4PSVolumeFlux3D::G4PSVolumeFlux3D(), G4PSCellCharge3D::GetIndex(), G4PSCellFlux3D::GetIndex(), G4PSCylinderSurfaceCurrent3D::GetIndex(), G4PSCylinderSurfaceFlux3D::GetIndex(), G4PSDoseDeposit3D::GetIndex(), G4PSEnergyDeposit3D::GetIndex(), G4PSFlatSurfaceCurrent3D::GetIndex(), G4PSFlatSurfaceFlux3D::GetIndex(), G4PSMinKinEAtGeneration3D::GetIndex(), G4PSNofCollision3D::GetIndex(), G4PSNofSecondary3D::GetIndex(), G4PSNofStep3D::GetIndex(), G4PSPassageCellCurrent3D::GetIndex(), G4PSPassageCellFlux3D::GetIndex(), G4PSPassageTrackLength3D::GetIndex(), G4PSPopulation3D::GetIndex(), G4PSSphereSurfaceCurrent3D::GetIndex(), GetIndex(), G4PSStepChecker3D::GetIndex(), G4PSTermination3D::GetIndex(), G4PSTrackCounter3D::GetIndex(), G4PSTrackLength3D::GetIndex(), G4PSVolumeFlux3D::GetIndex(), and G4VPrimitiveScorer::SetNijk().

◆ HCID

G4int G4PSSphereSurfaceFlux::HCID
privateinherited

Definition at line 90 of file G4PSSphereSurfaceFlux.hh.

Referenced by G4PSSphereSurfaceFlux::Initialize().

◆ indexDepth

G4int G4VPrimitiveScorer::indexDepth
protectedinherited

◆ primitiveName

G4String G4VPrimitiveScorer::primitiveName
protectedinherited

◆ unitName

G4String G4VPrimitiveScorer::unitName
protectedinherited

◆ unitValue

G4double G4VPrimitiveScorer::unitValue
protectedinherited

◆ verboseLevel

G4int G4VPrimitiveScorer::verboseLevel
protectedinherited

◆ weighted

G4bool G4PSSphereSurfaceFlux::weighted
privateinherited

The documentation for this class was generated from the following files: