Geant4  10.02.p03
G4PSCellCharge Class Reference

#include <G4PSCellCharge.hh>

Inheritance diagram for G4PSCellCharge:
Collaboration 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)
 
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 G4int GetIndex (G4Step *)
 
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Private Attributes

G4int HCID
 
G4THitsMap< G4double > * EvtMap
 

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),EvtMap(0)
45 {
46  SetUnit("e+");
47 }
virtual void SetUnit(const G4String &unit)
G4THitsMap< G4double > * EvtMap
G4VPrimitiveScorer(G4String name, G4int depth=0)
Here is the call graph for this function:

◆ 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),EvtMap(0)
52 {
53  SetUnit(unit);
54 }
virtual void SetUnit(const G4String &unit)
G4THitsMap< G4double > * EvtMap
G4VPrimitiveScorer(G4String name, G4int depth=0)
Here is the call graph for this function:

◆ ~G4PSCellCharge()

G4PSCellCharge::~G4PSCellCharge ( )
virtual

Definition at line 56 of file G4PSCellCharge.cc.

57 {;}

Member Function Documentation

◆ clear()

void G4PSCellCharge::clear ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 95 of file G4PSCellCharge.cc.

95  {
96  EvtMap->clear();
97 }
void clear()
Definition: G4THitsMap.hh:209
G4THitsMap< G4double > * EvtMap
Here is the call graph for this function:

◆ DrawAll()

void G4PSCellCharge::DrawAll ( void  )
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);
90 }
G4String GetName() const
G4int GetCollectionID(G4int)
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4MultiFunctionalDetector * detector
G4THitsMap< G4double > * EvtMap
Here is the call graph for this function:

◆ PrintAll()

void G4PSCellCharge::PrintAll ( void  )
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 }
G4double GetUnitValue() const
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
G4String GetName() const
G4GLOB_DLL std::ostream G4cout
G4int entries() const
Definition: G4THitsMap.hh:79
#define G4endl
Definition: G4ios.hh:61
G4MultiFunctionalDetector * detector
G4THitsMap< G4double > * EvtMap
const G4String & GetUnit() const
Here is the call graph for this function:

◆ 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.
63  if( aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary
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
73  if( aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary){
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 }
Int_t index
G4int add(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:138
int G4int
Definition: G4Types.hh:78
virtual G4int GetIndex(G4Step *)
#define TRUE
Definition: globals.hh:55
double G4double
Definition: G4Types.hh:76
G4THitsMap< G4double > * EvtMap
Here is the call graph for this function:

◆ 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)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ EvtMap

G4THitsMap<G4double>* G4PSCellCharge::EvtMap
private

Definition at line 67 of file G4PSCellCharge.hh.

◆ HCID

G4int G4PSCellCharge::HCID
private

Definition at line 66 of file G4PSCellCharge.hh.


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