Geant4 9.6.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)
 

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

Constructor & Destructor Documentation

◆ G4PSTrackLength() [1/2]

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

Definition at line 44 of file G4PSTrackLength.cc.

45 :G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false),multiplyKinE(false),
46 divideByVelocity(false)
47{
49 SetUnit("mm");
50}
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 52 of file G4PSTrackLength.cc.

54 :G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false),multiplyKinE(false),
55 divideByVelocity(false)
56{
58 SetUnit(unit);
59}

◆ ~G4PSTrackLength()

G4PSTrackLength::~G4PSTrackLength ( )
virtual

Definition at line 61 of file G4PSTrackLength.cc.

62{;}

Member Function Documentation

◆ clear()

void G4PSTrackLength::clear ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 100 of file G4PSTrackLength.cc.

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

◆ DefineUnitAndCategory()

void G4PSTrackLength::DefineUnitAndCategory ( )
protectedvirtual

Definition at line 161 of file G4PSTrackLength.cc.

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

Referenced by G4PSTrackLength().

◆ DivideByVelocity()

void G4PSTrackLength::DivideByVelocity ( G4bool  flg = true)

Definition at line 71 of file G4PSTrackLength.cc.

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

Referenced by G4ScoreQuantityMessenger::SetNewValue().

◆ DrawAll()

void G4PSTrackLength::DrawAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 104 of file G4PSTrackLength.cc.

105{;}

◆ EndOfEvent()

void G4PSTrackLength::EndOfEvent ( G4HCofThisEvent )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 97 of file G4PSTrackLength.cc.

98{;}

◆ Initialize()

void G4PSTrackLength::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 90 of file G4PSTrackLength.cc.

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

◆ MultiplyKineticEnergy()

void G4PSTrackLength::MultiplyKineticEnergy ( G4bool  flg = true)

Definition at line 64 of file G4PSTrackLength.cc.

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

Referenced by G4ScoreQuantityMessenger::SetNewValue().

◆ PrintAll()

void G4PSTrackLength::PrintAll ( )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 107 of file G4PSTrackLength.cc.

108{
109 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
110 G4cout << " PrimitiveScorer " << GetName() << G4endl;
111 G4cout << " Number of entries " << EvtMap->entries() << G4endl;
112 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
113 for(; itr != EvtMap->GetMap()->end(); itr++) {
114 G4cout << " copy no.: " << itr->first ;
115 if ( multiplyKinE ){
116 if ( divideByVelocity ) G4cout << " EnergyFlux: ";
117 else G4cout << " EnergyFlow: ";
118 }else{
119 if ( divideByVelocity ) G4cout << " Time: ";
120 else G4cout << " Length: ";
121 }
122 G4cout << *(itr->second)/GetUnitValue()
123 << " ["<< GetUnit() << "]";
124 G4cout << G4endl;
125 }
126}
#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 G4PSTrackLength::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
protectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 78 of file G4PSTrackLength.cc.

79{
80 G4double trklength = aStep->GetStepLength();
81 if ( trklength == 0. ) return FALSE;
82 if(weighted) trklength *= aStep->GetPreStepPoint()->GetWeight();
83 if(multiplyKinE) trklength *= aStep->GetPreStepPoint()->GetKineticEnergy();
84 if(divideByVelocity) trklength /= aStep->GetPreStepPoint()->GetVelocity();
85 G4int index = GetIndex(aStep);
86 EvtMap->add(index,trklength);
87 return TRUE;
88}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4double GetVelocity() const
G4double GetKineticEnergy() const
G4double GetWeight() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4int add(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:138
virtual G4int GetIndex(G4Step *)
#define TRUE
Definition: globals.hh:55
#define FALSE
Definition: globals.hh:52

◆ SetUnit()

void G4PSTrackLength::SetUnit ( const G4String unit)
virtual

Definition at line 128 of file G4PSTrackLength.cc.

129{
130 if ( multiplyKinE ){
131 if ( divideByVelocity ){
132 if ( unit == "" ) {
133 CheckAndSetUnit("MeV_second","EnergyFlux");
134 } else {
135 CheckAndSetUnit(unit,"EnergyFlux");
136 }
137 }else {
138 if ( unit == "" ) {
139 CheckAndSetUnit("MeV_mm","EnergyFlow");
140 } else {
141 CheckAndSetUnit(unit,"EnergyFlow");
142 }
143 }
144 }else {
145 if ( divideByVelocity ){
146 if ( unit == "" ) {
147 CheckAndSetUnit("second","Time");
148 } else {
149 CheckAndSetUnit(unit,"Time");
150 }
151 }else {
152 if ( unit == "") {
153 CheckAndSetUnit("mm","Length");
154 } else {
155 CheckAndSetUnit(unit,"Length");
156 }
157 }
158 }
159}
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 57 of file G4PSTrackLength.hh.

57{ weighted = flg; }

Referenced by G4ScoreQuantityMessenger::SetNewValue().


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