G4PSCellCharge Class Reference

#include <G4PSCellCharge.hh>

Inheritance diagram for G4PSCellCharge:

G4VPrimitiveScorer G4PSCellCharge3D

Public Member Functions

 G4PSCellCharge (G4String name, G4int depth=0)
 G4PSCellCharge (G4String name, const G4String &unit, G4int depth=0)
virtual ~G4PSCellCharge ()
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 *)

Detailed Description

Definition at line 46 of file G4PSCellCharge.hh.


Constructor & Destructor Documentation

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

Definition at line 43 of file G4PSCellCharge.cc.

References SetUnit().

00044     :G4VPrimitiveScorer(name,depth),HCID(-1)
00045 {
00046     SetUnit("e+");
00047 }

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

Definition at line 49 of file G4PSCellCharge.cc.

References SetUnit().

00051     :G4VPrimitiveScorer(name,depth),HCID(-1)
00052 {
00053     SetUnit(unit);
00054 }

G4PSCellCharge::~G4PSCellCharge (  )  [virtual]

Definition at line 56 of file G4PSCellCharge.cc.

00057 {;}


Member Function Documentation

void G4PSCellCharge::clear (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 95 of file G4PSCellCharge.cc.

00095                           {
00096   EvtMap->clear();
00097 }

void G4PSCellCharge::DrawAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 99 of file G4PSCellCharge.cc.

00100 {;}

void G4PSCellCharge::EndOfEvent ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 92 of file G4PSCellCharge.cc.

00093 {;}

void G4PSCellCharge::Initialize ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 84 of file G4PSCellCharge.cc.

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

00085 {
00086   EvtMap = new G4THitsMap<G4double>(detector->GetName(),
00087                                     GetName());
00088   if ( HCID < 0 ) HCID = GetCollectionID(0);
00089   HCE->AddHitsCollection(HCID,EvtMap);
00090 }

void G4PSCellCharge::PrintAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 102 of file G4PSCellCharge.cc.

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

00103 {
00104   G4cout << " MultiFunctionalDet  " << detector->GetName() << G4endl;
00105   G4cout << " PrimitiveScorer " << GetName() <<G4endl; 
00106   G4cout << " Number of entries " << EvtMap->entries() << G4endl;
00107   std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
00108   for(; itr != EvtMap->GetMap()->end(); itr++) {
00109     G4cout << "  copy no.: " << itr->first
00110            << "  cell charge : " << *(itr->second)/GetUnitValue()
00111            << " [" << GetUnit() << "]"
00112            << G4endl;
00113   }
00114 }

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

Implements G4VPrimitiveScorer.

Definition at line 59 of file G4PSCellCharge.cc.

References fGeomBoundary, G4StepPoint::GetCharge(), G4Track::GetCurrentStepNumber(), G4VPrimitiveScorer::GetIndex(), G4Track::GetParentID(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetStepStatus(), G4Step::GetTrack(), G4StepPoint::GetWeight(), and TRUE.

00060 {
00061 
00062     // Enter or First step of primary.
00063     if( aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary 
00064         || ( aStep->GetTrack()->GetParentID() == 0 &&
00065              aStep->GetTrack()->GetCurrentStepNumber() == 1 ) ){
00066         G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
00067         CellCharge *= aStep->GetPreStepPoint()->GetWeight();
00068         G4int index = GetIndex(aStep);
00069         EvtMap->add(index,CellCharge);
00070     }
00071 
00072     // Exit
00073     if( aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary){
00074         G4double CellCharge = aStep->GetPreStepPoint()->GetCharge();
00075         CellCharge *= aStep->GetPreStepPoint()->GetWeight();
00076         G4int index = GetIndex(aStep);
00077         CellCharge *= -1.0;
00078         EvtMap->add(index,CellCharge);
00079     }
00080 
00081   return TRUE;
00082 }

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

Reimplemented from G4VPrimitiveScorer.

Definition at line 116 of file G4PSCellCharge.cc.

References G4VPrimitiveScorer::CheckAndSetUnit().

Referenced by G4PSCellCharge(), G4PSCellCharge3D::G4PSCellCharge3D(), and G4ScoreQuantityMessenger::SetNewValue().

00117 {
00118     CheckAndSetUnit(unit,"Electric charge");
00119 }


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