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

#include <G4PSTrackLength.hh>

+ Inheritance diagram for G4PSTrackLength:

Public Member Functions

 G4PSTrackLength (G4String name, G4int depth=0)
 
 G4PSTrackLength (G4String name, const G4String &unit, G4int depth=0)
 
virtual ~G4PSTrackLength ()
 
void Weighted (G4bool flg=true)
 
void MultiplyKineticEnergy (G4bool flg=true)
 
void DivideByVelocity (G4bool flg=true)
 
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 *)
 
virtual void DefineUnitAndCategory ()
 
- Protected Member Functions inherited from G4VPrimitiveScorer
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)=0
 
virtual G4int GetIndex (G4Step *)
 
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 
G4VSolidComputeSolid (G4Step *aStep, G4int replicaIdx)
 
G4VSolidComputeCurrentSolid (G4Step *aStep)
 

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 48 of file G4PSTrackLength.hh.

Constructor & Destructor Documentation

◆ G4PSTrackLength() [1/2]

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

Definition at line 43 of file G4PSTrackLength.cc.

44 :G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),weighted(false),
45 multiplyKinE(false),divideByVelocity(false)
46{
48 SetUnit("mm");
49}
virtual void SetUnit(const G4String &unit)
virtual void DefineUnitAndCategory()

◆ G4PSTrackLength() [2/2]

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

Definition at line 51 of file G4PSTrackLength.cc.

53 :G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),weighted(false),
54 multiplyKinE(false),divideByVelocity(false)
55{
57 SetUnit(unit);
58}

◆ ~G4PSTrackLength()

G4PSTrackLength::~G4PSTrackLength ( )
virtual

Definition at line 60 of file G4PSTrackLength.cc.

61{;}

Member Function Documentation

◆ clear()

void G4PSTrackLength::clear ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 99 of file G4PSTrackLength.cc.

99 {
100 EvtMap->clear();
101}
void clear()
Definition: G4THitsMap.hh:537

◆ DefineUnitAndCategory()

void G4PSTrackLength::DefineUnitAndCategory ( )
protectedvirtual

Definition at line 160 of file G4PSTrackLength.cc.

160 {
161 // EnergyFlux
162 new G4UnitDefinition("eV_second","eV_s","EnergyFlux",(eV*second));
163 new G4UnitDefinition("keV_second","keV_s","EnergyFlux",(keV*second));
164 new G4UnitDefinition("MeV_second","MeV_s","EnergyFlux",(MeV*second));
165 new G4UnitDefinition("eV_millisecond","eV_ms","EnergyFlux",(eV*ms));
166 new G4UnitDefinition("keV_millisecond","keV_ms","EnergyFlux",(keV*ms));
167 new G4UnitDefinition("MeV_millisecond","MeV_ms","EnergyFlux",(MeV*ms));
168 //EnergyFlow
169 new G4UnitDefinition("eV_millimeter","eV_mm","EnergyFlow",(eV*mm));
170 new G4UnitDefinition("keV_millimeter","keV_mm","EnergyFlow",(keV*mm));
171 new G4UnitDefinition("MeV_millimeter","MeV_mm","EnergyFlow",(MeV*mm));
172 new G4UnitDefinition("eV_centimeter","eV_cm","EnergyFlow",(eV*cm));
173 new G4UnitDefinition("keV_centimeter","keV_cm","EnergyFlow",(keV*cm));
174 new G4UnitDefinition("MeV_centimeter","MeV_cm","EnergyFlow",(MeV*cm));
175 new G4UnitDefinition("eV_meter","eV_m","EnergyFlow",(eV*m));
176 new G4UnitDefinition("keV_meter","keV_m","EnergyFlow",(keV*m));
177 new G4UnitDefinition("MeV_meter","MeV_m","EnergyFlow",(MeV*m));
178}

Referenced by G4PSTrackLength().

◆ DivideByVelocity()

void G4PSTrackLength::DivideByVelocity ( G4bool  flg = true)

Definition at line 70 of file G4PSTrackLength.cc.

71{
72 divideByVelocity = flg;
73 // Default unit is set according to flags.
74 SetUnit("");
75}

Referenced by G4ScoreQuantityMessenger::SetNewValue().

◆ DrawAll()

void G4PSTrackLength::DrawAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 103 of file G4PSTrackLength.cc.

104{;}

◆ EndOfEvent()

void G4PSTrackLength::EndOfEvent ( G4HCofThisEvent )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 96 of file G4PSTrackLength.cc.

97{;}

◆ Initialize()

void G4PSTrackLength::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 89 of file G4PSTrackLength.cc.

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

◆ MultiplyKineticEnergy()

void G4PSTrackLength::MultiplyKineticEnergy ( G4bool  flg = true)

Definition at line 63 of file G4PSTrackLength.cc.

64{
65 multiplyKinE = flg;
66 // Default unit is set according to flags.
67 SetUnit("");
68}

Referenced by G4ScoreQuantityMessenger::SetNewValue().

◆ PrintAll()

void G4PSTrackLength::PrintAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 106 of file G4PSTrackLength.cc.

107{
108 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
109 G4cout << " PrimitiveScorer " << GetName() << G4endl;
110 G4cout << " Number of entries " << EvtMap->entries() << G4endl;
111 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
112 for(; itr != EvtMap->GetMap()->end(); itr++) {
113 G4cout << " copy no.: " << itr->first ;
114 if ( multiplyKinE ){
115 if ( divideByVelocity ) G4cout << " EnergyFlux: ";
116 else G4cout << " EnergyFlow: ";
117 }else{
118 if ( divideByVelocity ) G4cout << " Time: ";
119 else G4cout << " Length: ";
120 }
121 G4cout << *(itr->second)/GetUnitValue()
122 << " ["<< GetUnit() << "]";
123 G4cout << G4endl;
124 }
125}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetUnit() const
G4double GetUnitValue() const
Map_t * GetMap() const
Definition: G4THitsMap.hh:151
size_t entries() const
Definition: G4THitsMap.hh:155

◆ ProcessHits()

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

Implements G4VPrimitiveScorer.

Definition at line 77 of file G4PSTrackLength.cc.

78{
79 G4double trklength = aStep->GetStepLength();
80 if ( trklength == 0. ) return FALSE;
81 if(weighted) trklength *= aStep->GetPreStepPoint()->GetWeight();
82 if(multiplyKinE) trklength *= aStep->GetPreStepPoint()->GetKineticEnergy();
83 if(divideByVelocity) trklength /= aStep->GetPreStepPoint()->GetVelocity();
84 G4int index = GetIndex(aStep);
85 EvtMap->add(index,trklength);
86 return TRUE;
87}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23
G4double GetVelocity() const
G4double GetKineticEnergy() const
G4double GetWeight() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
virtual G4int GetIndex(G4Step *)
size_t add(const G4int &key, U *&aHit) const
Definition: G4THitsMap.hh:177

◆ SetUnit()

void G4PSTrackLength::SetUnit ( const G4String unit)
virtual

Definition at line 127 of file G4PSTrackLength.cc.

128{
129 if ( multiplyKinE ){
130 if ( divideByVelocity ){
131 if ( unit == "" ) {
132 CheckAndSetUnit("MeV_second","EnergyFlux");
133 } else {
134 CheckAndSetUnit(unit,"EnergyFlux");
135 }
136 }else {
137 if ( unit == "" ) {
138 CheckAndSetUnit("MeV_mm","EnergyFlow");
139 } else {
140 CheckAndSetUnit(unit,"EnergyFlow");
141 }
142 }
143 }else {
144 if ( divideByVelocity ){
145 if ( unit == "" ) {
146 CheckAndSetUnit("second","Time");
147 } else {
148 CheckAndSetUnit(unit,"Time");
149 }
150 }else {
151 if ( unit == "") {
152 CheckAndSetUnit("mm","Length");
153 } else {
154 CheckAndSetUnit(unit,"Length");
155 }
156 }
157 }
158}
void CheckAndSetUnit(const G4String &unit, const G4String &category)

Referenced by DivideByVelocity(), G4PSTrackLength(), G4PSTrackLength3D::G4PSTrackLength3D(), MultiplyKineticEnergy(), and G4ScoreQuantityMessenger::SetNewValue().

◆ Weighted()

void G4PSTrackLength::Weighted ( G4bool  flg = true)
inline

Definition at line 56 of file G4PSTrackLength.hh.

56{ weighted = flg; }

Referenced by G4ScoreQuantityMessenger::SetNewValue().


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