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)

Protected Member Functions

virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
virtual void DefineUnitAndCategory ()

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().

00045     :G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false),multiplyKinE(false),
00046      divideByVelocity(false)
00047 {
00048     DefineUnitAndCategory();
00049     SetUnit("mm");
00050 }

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

Definition at line 52 of file G4PSTrackLength.cc.

References DefineUnitAndCategory(), and SetUnit().

00054     :G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false),multiplyKinE(false),
00055      divideByVelocity(false)
00056 {
00057     DefineUnitAndCategory();
00058     SetUnit(unit);
00059 }

G4PSTrackLength::~G4PSTrackLength (  )  [virtual]

Definition at line 61 of file G4PSTrackLength.cc.

00062 {;}


Member Function Documentation

void G4PSTrackLength::clear (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 100 of file G4PSTrackLength.cc.

00100                            {
00101   EvtMap->clear();
00102 }

void G4PSTrackLength::DefineUnitAndCategory (  )  [protected, virtual]

Definition at line 161 of file G4PSTrackLength.cc.

Referenced by G4PSTrackLength().

00161                                            {
00162     // EnergyFlux
00163     new G4UnitDefinition("eV_second","eV_s","EnergyFlux",(eV*second));
00164     new G4UnitDefinition("keV_second","keV_s","EnergyFlux",(keV*second));
00165     new G4UnitDefinition("MeV_second","MeV_s","EnergyFlux",(MeV*second));
00166     new G4UnitDefinition("eV_millisecond","eV_ms","EnergyFlux",(eV*ms));
00167     new G4UnitDefinition("keV_millisecond","keV_ms","EnergyFlux",(keV*ms));
00168     new G4UnitDefinition("MeV_millisecond","MeV_ms","EnergyFlux",(MeV*ms));
00169     //EnergyFlow
00170     new G4UnitDefinition("eV_millimeter","eV_mm","EnergyFlow",(eV*mm));
00171     new G4UnitDefinition("keV_millimeter","keV_mm","EnergyFlow",(keV*mm));
00172     new G4UnitDefinition("MeV_millimeter","MeV_mm","EnergyFlow",(MeV*mm));
00173     new G4UnitDefinition("eV_centimeter","eV_cm","EnergyFlow",(eV*cm));
00174     new G4UnitDefinition("keV_centimeter","keV_cm","EnergyFlow",(keV*cm));
00175     new G4UnitDefinition("MeV_centimeter","MeV_cm","EnergyFlow",(MeV*cm));
00176     new G4UnitDefinition("eV_meter","eV_m","EnergyFlow",(eV*m));
00177     new G4UnitDefinition("keV_meter","keV_m","EnergyFlow",(keV*m));
00178     new G4UnitDefinition("MeV_meter","MeV_m","EnergyFlow",(MeV*m));
00179 }

void G4PSTrackLength::DivideByVelocity ( G4bool  flg = true  ) 

Definition at line 71 of file G4PSTrackLength.cc.

References SetUnit().

Referenced by G4ScoreQuantityMessenger::SetNewValue().

00072 { 
00073     divideByVelocity = flg; 
00074     // Default unit is set according to flags.
00075     SetUnit(""); 
00076 }

void G4PSTrackLength::DrawAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 104 of file G4PSTrackLength.cc.

00105 {;}

void G4PSTrackLength::EndOfEvent ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 97 of file G4PSTrackLength.cc.

00098 {;}

void G4PSTrackLength::Initialize ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 90 of file G4PSTrackLength.cc.

References G4HCofThisEvent::AddHitsCollection(), G4VPrimitiveScorer::detector, G4VPrimitiveScorer::GetCollectionID(), G4VPrimitiveScorer::GetName(), and G4VSensitiveDetector::GetName().

00091 {
00092   EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
00093   if(HCID < 0) {HCID = GetCollectionID(0);}
00094   HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
00095 }

void G4PSTrackLength::MultiplyKineticEnergy ( G4bool  flg = true  ) 

Definition at line 64 of file G4PSTrackLength.cc.

References SetUnit().

Referenced by G4ScoreQuantityMessenger::SetNewValue().

00065 { 
00066     multiplyKinE = flg; 
00067     // Default unit is set according to flags.
00068     SetUnit(""); 
00069 }

void G4PSTrackLength::PrintAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 107 of file G4PSTrackLength.cc.

References G4VPrimitiveScorer::detector, G4cout, G4endl, G4VPrimitiveScorer::GetName(), G4VSensitiveDetector::GetName(), G4VPrimitiveScorer::GetUnit(), and G4VPrimitiveScorer::GetUnitValue().

00108 {
00109   G4cout << " MultiFunctionalDet  " << detector->GetName() << G4endl;
00110   G4cout << " PrimitiveScorer " << GetName() << G4endl;
00111   G4cout << " Number of entries " << EvtMap->entries() << G4endl;
00112   std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
00113   for(; itr != EvtMap->GetMap()->end(); itr++) {
00114       G4cout << "  copy no.: " << itr->first ;
00115       if ( multiplyKinE ){
00116         if ( divideByVelocity ) G4cout << " EnergyFlux: ";
00117         else                    G4cout << " EnergyFlow: ";
00118       }else{
00119         if ( divideByVelocity ) G4cout << " Time: ";
00120         else                    G4cout << " Length: ";
00121       }
00122       G4cout << *(itr->second)/GetUnitValue()
00123              << " ["<< GetUnit() << "]";
00124       G4cout << G4endl;
00125   }
00126 }

G4bool G4PSTrackLength::ProcessHits ( G4Step ,
G4TouchableHistory  
) [protected, virtual]

Implements G4VPrimitiveScorer.

Definition at line 78 of file G4PSTrackLength.cc.

References FALSE, G4VPrimitiveScorer::GetIndex(), G4StepPoint::GetKineticEnergy(), G4Step::GetPreStepPoint(), G4Step::GetStepLength(), G4StepPoint::GetVelocity(), G4StepPoint::GetWeight(), and TRUE.

00079 {
00080   G4double trklength  = aStep->GetStepLength();
00081   if ( trklength == 0. ) return FALSE;
00082   if(weighted) trklength *= aStep->GetPreStepPoint()->GetWeight();
00083   if(multiplyKinE) trklength *= aStep->GetPreStepPoint()->GetKineticEnergy();
00084   if(divideByVelocity) trklength /= aStep->GetPreStepPoint()->GetVelocity();
00085   G4int  index = GetIndex(aStep);
00086   EvtMap->add(index,trklength);  
00087   return TRUE;
00088 }

void G4PSTrackLength::SetUnit ( const G4String unit  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 128 of file G4PSTrackLength.cc.

References G4VPrimitiveScorer::CheckAndSetUnit().

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

00129 {
00130     if ( multiplyKinE ){
00131         if ( divideByVelocity ){
00132             if ( unit == "" ) {
00133                 CheckAndSetUnit("MeV_second","EnergyFlux");
00134             } else {
00135                 CheckAndSetUnit(unit,"EnergyFlux");
00136             }
00137         }else {
00138             if ( unit == "" ) {
00139                 CheckAndSetUnit("MeV_mm","EnergyFlow");
00140             } else {
00141                 CheckAndSetUnit(unit,"EnergyFlow");
00142             }
00143         }
00144     }else {
00145         if ( divideByVelocity ){
00146             if ( unit == "" ) {
00147                 CheckAndSetUnit("second","Time");
00148             } else {
00149                 CheckAndSetUnit(unit,"Time");
00150             }
00151         }else {
00152             if ( unit == "") {
00153                 CheckAndSetUnit("mm","Length");
00154             } else {
00155                 CheckAndSetUnit(unit,"Length");
00156             }
00157         }
00158     } 
00159 }

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

Definition at line 57 of file G4PSTrackLength.hh.

Referenced by G4ScoreQuantityMessenger::SetNewValue().

00057 { weighted = flg; }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:04 2013 for Geant4 by  doxygen 1.4.7