Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PSTrackLength Class Reference

#include <G4PSTrackLength.hh>

Inheritance diagram for G4PSTrackLength:
Collaboration 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)
 
void SetUnit (const G4String &unit)
 
const G4String & GetUnit () const
 
G4double GetUnitValue () const
 
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
 
G4MultiFunctionalDetector * GetMultiFunctionalDetector () const
 
G4String GetName () const
 
void SetFilter (G4VSDFilter *f)
 
G4VSDFilter * GetFilter () 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 G4int GetIndex (G4Step *)
 
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Additional Inherited Members

- Protected Attributes inherited from G4VPrimitiveScorer
G4String primitiveName
 
G4MultiFunctionalDetector * detector
 
G4VSDFilter * filter
 
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::G4PSTrackLength ( G4String  name,
G4int  depth = 0 
)

Definition at line 44 of file G4PSTrackLength.cc.

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

Here is the call graph for this function:

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

Definition at line 52 of file G4PSTrackLength.cc.

54  :G4VPrimitiveScorer(name,depth),HCID(-1),EvtMap(0),weighted(false),
55  multiplyKinE(false),divideByVelocity(false)
56 {
58  SetUnit(unit);
59 }
virtual void DefineUnitAndCategory()
virtual void SetUnit(const G4String &unit)
G4VPrimitiveScorer(G4String name, G4int depth=0)

Here is the call graph for this function:

G4PSTrackLength::~G4PSTrackLength ( )
virtual

Definition at line 61 of file G4PSTrackLength.cc.

62 {;}

Member Function Documentation

void G4PSTrackLength::clear ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 100 of file G4PSTrackLength.cc.

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

Here is the call graph for this function:

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 }
static constexpr double mm
Definition: G4SIunits.hh:115
static constexpr double second
Definition: G4SIunits.hh:157
static constexpr double m
Definition: G4SIunits.hh:129
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double eV
Definition: G4SIunits.hh:215
static constexpr double MeV
Definition: G4SIunits.hh:214
static constexpr double ms
Definition: G4SIunits.hh:170
static constexpr double keV
Definition: G4SIunits.hh:216

Here is the caller graph for this function:

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 }
virtual void SetUnit(const G4String &unit)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PSTrackLength::DrawAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 104 of file G4PSTrackLength.cc.

105 {;}
void G4PSTrackLength::EndOfEvent ( G4HCofThisEvent *  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 97 of file G4PSTrackLength.cc.

98 {;}
void G4PSTrackLength::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 90 of file G4PSTrackLength.cc.

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

Here is the call graph for this function:

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 }
virtual void SetUnit(const G4String &unit)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PSTrackLength::PrintAll ( void  )
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 }
G4String GetName() const
G4GLOB_DLL std::ostream G4cout
G4double GetUnitValue() const
G4int entries() const
Definition: G4THitsMap.hh:200
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:99
#define G4endl
Definition: G4ios.hh:61
G4MultiFunctionalDetector * detector
const G4String & GetUnit() const

Here is the call graph for this function:

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 }
G4double GetWeight() const
G4double GetStepLength() const
G4double GetVelocity() const
int G4int
Definition: G4Types.hh:78
G4StepPoint * GetPreStepPoint() const
#define FALSE
Definition: globals.hh:52
virtual G4int GetIndex(G4Step *)
#define TRUE
Definition: globals.hh:55
G4int add(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:106
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 57 of file G4PSTrackLength.hh.

57 { weighted = flg; }

Here is the caller graph for this function:


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