Geant4 9.6.0
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)
 
virtual ~G4PSCellCharge ()
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
virtual void SetUnit (const G4String &unit)
 
- Public Member Functions inherited from G4VPrimitiveScorer
 G4VPrimitiveScorer (G4String name, G4int depth=0)
 
virtual ~G4VPrimitiveScorer ()
 
G4int GetCollectionID (G4int)
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
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

virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
- Protected Member Functions inherited from G4VPrimitiveScorer
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)=0
 
virtual G4int GetIndex (G4Step *)
 
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Additional Inherited Members

- Protected Attributes inherited from G4VPrimitiveScorer
G4String primitiveName
 
G4MultiFunctionalDetectordetector
 
G4VSDFilterfilter
 
G4int verboseLevel
 
G4int indexDepth
 
G4String unitName
 
G4double unitValue
 
G4int fNi
 
G4int fNj
 
G4int fNk
 

Detailed Description

Definition at line 46 of file G4PSCellCharge.hh.

Constructor & Destructor Documentation

◆ G4PSCellCharge() [1/2]

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

Definition at line 43 of file G4PSCellCharge.cc.

44 :G4VPrimitiveScorer(name,depth),HCID(-1)
45{
46 SetUnit("e+");
47}
virtual void SetUnit(const G4String &unit)

◆ G4PSCellCharge() [2/2]

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

Definition at line 49 of file G4PSCellCharge.cc.

51 :G4VPrimitiveScorer(name,depth),HCID(-1)
52{
53 SetUnit(unit);
54}

◆ ~G4PSCellCharge()

G4PSCellCharge::~G4PSCellCharge ( )
virtual

Definition at line 56 of file G4PSCellCharge.cc.

57{;}

Member Function Documentation

◆ clear()

void G4PSCellCharge::clear ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 95 of file G4PSCellCharge.cc.

95 {
96 EvtMap->clear();
97}
void clear()
Definition: G4THitsMap.hh:209

◆ DrawAll()

void G4PSCellCharge::DrawAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 99 of file G4PSCellCharge.cc.

100{;}

◆ EndOfEvent()

void G4PSCellCharge::EndOfEvent ( G4HCofThisEvent )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 92 of file G4PSCellCharge.cc.

93{;}

◆ Initialize()

void G4PSCellCharge::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 84 of file G4PSCellCharge.cc.

85{
87 GetName());
88 if ( HCID < 0 ) HCID = GetCollectionID(0);
89 HCE->AddHitsCollection(HCID,EvtMap);
90}
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4String GetName() const
G4MultiFunctionalDetector * detector
G4int GetCollectionID(G4int)

◆ PrintAll()

void G4PSCellCharge::PrintAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 102 of file G4PSCellCharge.cc.

103{
104 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
105 G4cout << " PrimitiveScorer " << GetName() <<G4endl;
106 G4cout << " Number of entries " << EvtMap->entries() << G4endl;
107 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
108 for(; itr != EvtMap->GetMap()->end(); itr++) {
109 G4cout << " copy no.: " << itr->first
110 << " cell charge : " << *(itr->second)/GetUnitValue()
111 << " [" << GetUnit() << "]"
112 << G4endl;
113 }
114}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
G4int entries() const
Definition: G4THitsMap.hh:79
const G4String & GetUnit() const
G4double GetUnitValue() const

◆ ProcessHits()

G4bool G4PSCellCharge::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
protectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 59 of file G4PSCellCharge.cc.

60{
61
62 // Enter or First step of primary.
64 || ( aStep->GetTrack()->GetParentID() == 0 &&
65 aStep->GetTrack()->GetCurrentStepNumber() == 1 ) ){
66 G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
67 CellCharge *= aStep->GetPreStepPoint()->GetWeight();
68 G4int index = GetIndex(aStep);
69 EvtMap->add(index,CellCharge);
70 }
71
72 // Exit
74 G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
75 CellCharge *= aStep->GetPreStepPoint()->GetWeight();
76 G4int index = GetIndex(aStep);
77 CellCharge *= -1.0;
78 EvtMap->add(index,CellCharge);
79 }
80
81 return TRUE;
82}
@ fGeomBoundary
Definition: G4StepStatus.hh:54
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4StepStatus GetStepStatus() const
G4double GetCharge() const
G4double GetWeight() const
G4Track * GetTrack() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
G4int add(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:138
G4int GetCurrentStepNumber() const
G4int GetParentID() const
virtual G4int GetIndex(G4Step *)
#define TRUE
Definition: globals.hh:55

◆ SetUnit()

void G4PSCellCharge::SetUnit ( const G4String unit)
virtual

Definition at line 116 of file G4PSCellCharge.cc.

117{
118 CheckAndSetUnit(unit,"Electric charge");
119}
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: