Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions
G4PSTrackLength Class Reference

#include <G4PSTrackLength.hh>

Inheritance diagram for G4PSTrackLength:
G4VPrimitiveScorer G4PSTrackLength3D

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 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 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::G4PSTrackLength ( G4String  name,
G4int  depth = 0 
)

Definition at line 44 of file G4PSTrackLength.cc.

References DefineUnitAndCategory(), and SetUnit().

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

Definition at line 52 of file G4PSTrackLength.cc.

References DefineUnitAndCategory(), and SetUnit().

54  :G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false),multiplyKinE(false),
55  divideByVelocity(false)
56 {
58  SetUnit(unit);
59 }
virtual void DefineUnitAndCategory()
virtual void SetUnit(const G4String &unit)
G4VPrimitiveScorer(G4String name, G4int depth=0)
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.

References G4THitsMap< T >::clear().

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

Definition at line 161 of file G4PSTrackLength.cc.

References python.hepunit::cm, python.hepunit::eV, python.hepunit::keV, python.hepunit::m, python.hepunit::MeV, python.hepunit::mm, python.hepunit::ms, and python.hepunit::second.

Referenced by G4PSTrackLength().

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 }
void G4PSTrackLength::DivideByVelocity ( G4bool  flg = true)

Definition at line 71 of file G4PSTrackLength.cc.

References SetUnit().

Referenced by B03ImportanceDetectorConstruction::ConstructSD(), B02ImportanceDetectorConstruction::ConstructSD(), B01DetectorConstruction::ConstructSDandField(), and G4ScoreQuantityMessenger::SetNewValue().

72 {
73  divideByVelocity = flg;
74  // Default unit is set according to flags.
75  SetUnit("");
76 }
virtual void SetUnit(const G4String &unit)
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
void G4PSTrackLength::MultiplyKineticEnergy ( G4bool  flg = true)

Definition at line 64 of file G4PSTrackLength.cc.

References SetUnit().

Referenced by B03ImportanceDetectorConstruction::ConstructSD(), B02ImportanceDetectorConstruction::ConstructSD(), B01DetectorConstruction::ConstructSDandField(), and G4ScoreQuantityMessenger::SetNewValue().

65 {
66  multiplyKinE = flg;
67  // Default unit is set according to flags.
68  SetUnit("");
69 }
virtual void SetUnit(const G4String &unit)
void G4PSTrackLength::PrintAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 107 of file G4PSTrackLength.cc.

References G4VPrimitiveScorer::detector, G4THitsMap< T >::entries(), G4cout, G4endl, G4THitsMap< T >::GetMap(), G4VPrimitiveScorer::GetName(), G4VSensitiveDetector::GetName(), G4VPrimitiveScorer::GetUnit(), and G4VPrimitiveScorer::GetUnitValue().

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:79
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
#define G4endl
Definition: G4ios.hh:61
G4MultiFunctionalDetector * detector
const G4String & GetUnit() const
G4bool G4PSTrackLength::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
protectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 78 of file G4PSTrackLength.cc.

References G4THitsMap< T >::add(), FALSE, G4VPrimitiveScorer::GetIndex(), G4StepPoint::GetKineticEnergy(), G4Step::GetPreStepPoint(), G4Step::GetStepLength(), G4StepPoint::GetVelocity(), G4StepPoint::GetWeight(), and TRUE.

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
G4int add(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:138
#define FALSE
Definition: globals.hh:52
virtual G4int GetIndex(G4Step *)
#define TRUE
Definition: globals.hh:55
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
void G4PSTrackLength::SetUnit ( const G4String unit)
virtual

Definition at line 128 of file G4PSTrackLength.cc.

References G4VPrimitiveScorer::CheckAndSetUnit().

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

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)
void G4PSTrackLength::Weighted ( G4bool  flg = true)
inline

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