Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PSCellCharge Class Reference

#include <G4PSCellCharge.hh>

+ Inheritance diagram for G4PSCellCharge:

Public Member Functions

 G4PSCellCharge (G4String name, G4int depth=0)
 
 G4PSCellCharge (G4String name, const G4String &unit, G4int depth=0)
 
 ~G4PSCellCharge () override=default
 
void Initialize (G4HCofThisEvent *) override
 
void clear () override
 
void PrintAll () override
 
virtual void SetUnit (const G4String &unit)
 
- Public Member Functions inherited from G4VPrimitiveScorer
 G4VPrimitiveScorer (G4String name, G4int depth=0)
 
virtual ~G4VPrimitiveScorer ()=default
 
G4int GetCollectionID (G4int)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
virtual void DrawAll ()
 
void SetUnit (const G4String &unit)
 
const G4StringGetUnit () const
 
G4double GetUnitValue () const
 
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
 
G4MultiFunctionalDetectorGetMultiFunctionalDetector () const
 
G4String GetName () const
 
void SetFilter (G4VSDFilter *f)
 
G4VSDFilterGetFilter () const
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
void SetNijk (G4int i, G4int j, G4int k)
 

Protected Member Functions

G4bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
- Protected Member Functions inherited from G4VPrimitiveScorer
G4VSolidComputeSolid (G4Step *aStep, G4int replicaIdx)
 
G4VSolidComputeCurrentSolid (G4Step *aStep)
 
virtual G4int GetIndex (G4Step *)
 
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Additional Inherited Members

- Protected Attributes inherited from G4VPrimitiveScorer
G4String primitiveName
 
G4MultiFunctionalDetectordetector {nullptr}
 
G4VSDFilterfilter {nullptr}
 
G4int verboseLevel {0}
 
G4int indexDepth
 
G4String unitName {"NoUnit"}
 
G4double unitValue {1.0}
 
G4int fNi {0}
 
G4int fNj {0}
 
G4int fNk {0}
 

Detailed Description

Definition at line 44 of file G4PSCellCharge.hh.

Constructor & Destructor Documentation

◆ G4PSCellCharge() [1/2]

G4PSCellCharge::G4PSCellCharge ( G4String name,
G4int depth = 0 )

Definition at line 41 of file G4PSCellCharge.cc.

42 : G4PSCellCharge(name, "e+", depth)
43{}
G4PSCellCharge(G4String name, G4int depth=0)

◆ G4PSCellCharge() [2/2]

G4PSCellCharge::G4PSCellCharge ( G4String name,
const G4String & unit,
G4int depth = 0 )

Definition at line 45 of file G4PSCellCharge.cc.

46 : G4VPrimitiveScorer(name, depth)
47 , HCID(-1)
48 , EvtMap(nullptr)
49{
50 SetUnit(unit);
51}
virtual void SetUnit(const G4String &unit)
G4VPrimitiveScorer(G4String name, G4int depth=0)

◆ ~G4PSCellCharge()

G4PSCellCharge::~G4PSCellCharge ( )
overridedefault

Member Function Documentation

◆ clear()

void G4PSCellCharge::clear ( )
overridevirtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 87 of file G4PSCellCharge.cc.

87{ EvtMap->clear(); }

◆ Initialize()

void G4PSCellCharge::Initialize ( G4HCofThisEvent * HCE)
overridevirtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 79 of file G4PSCellCharge.cc.

80{
81 EvtMap = new G4THitsMap<G4double>(detector->GetName(), GetName());
82 if(HCID < 0)
83 HCID = GetCollectionID(0);
84 HCE->AddHitsCollection(HCID, EvtMap);
85}
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4String GetName() const
G4MultiFunctionalDetector * detector

◆ PrintAll()

void G4PSCellCharge::PrintAll ( )
overridevirtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 89 of file G4PSCellCharge.cc.

90{
91 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
92 G4cout << " PrimitiveScorer " << GetName() << G4endl;
93 G4cout << " Number of entries " << EvtMap->entries() << G4endl;
94 for(const auto& [copy, charge] : *(EvtMap->GetMap()))
95 {
96 G4cout << " copy no.: " << copy
97 << " cell charge : " << *(charge) / GetUnitValue() << " ["
98 << GetUnit() << "]" << G4endl;
99 }
100}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
const G4String & GetUnit() const
G4double GetUnitValue() const
Map_t * GetMap() const
size_t entries() const
void copy(G4double dst[], const G4double src[], std::size_t size=G4FieldTrack::ncompSVEC)

◆ ProcessHits()

G4bool G4PSCellCharge::ProcessHits ( G4Step * aStep,
G4TouchableHistory *  )
overrideprotectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 53 of file G4PSCellCharge.cc.

54{
55 // Enter or First step of primary.
57 (aStep->GetTrack()->GetParentID() == 0 &&
58 aStep->GetTrack()->GetCurrentStepNumber() == 1))
59 {
60 G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
61 CellCharge *= aStep->GetPreStepPoint()->GetWeight();
62 G4int index = GetIndex(aStep);
63 EvtMap->add(index, CellCharge);
64 }
65
66 // Exit
68 {
69 G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
70 CellCharge *= aStep->GetPreStepPoint()->GetWeight();
71 G4int index = GetIndex(aStep);
72 CellCharge *= -1.0;
73 EvtMap->add(index, CellCharge);
74 }
75
76 return true;
77}
@ fGeomBoundary
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
G4StepStatus GetStepStatus() const
G4double GetCharge() const
G4double GetWeight() const
G4Track * GetTrack() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
G4int GetCurrentStepNumber() const
G4int GetParentID() const
virtual G4int GetIndex(G4Step *)
size_t add(const G4int &key, U *&aHit) const

◆ SetUnit()

void G4PSCellCharge::SetUnit ( const G4String & unit)
virtual

Definition at line 102 of file G4PSCellCharge.cc.

103{
104 CheckAndSetUnit(unit, "Electric charge");
105}
void CheckAndSetUnit(const G4String &unit, const G4String &category)

Referenced by G4PSCellCharge(), G4PSCellCharge3D::G4PSCellCharge3D(), and G4ScoreQuantityMessenger::SetNewValue().


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