G4PSPassageCellCurrent Class Reference

#include <G4PSPassageCellCurrent.hh>

Inheritance diagram for G4PSPassageCellCurrent:

G4VPrimitiveScorer G4PSPassageCellCurrent3D

Public Member Functions

 G4PSPassageCellCurrent (G4String name, G4int depth=0)
virtual ~G4PSPassageCellCurrent ()
void Weighted (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 G4bool IsPassed (G4Step *)

Detailed Description

Definition at line 49 of file G4PSPassageCellCurrent.hh.


Constructor & Destructor Documentation

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

Definition at line 47 of file G4PSPassageCellCurrent.cc.

References SetUnit().

00048     :G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCurrent(0),
00049      weighted(true)
00050 {
00051     SetUnit("");
00052 }

G4PSPassageCellCurrent::~G4PSPassageCellCurrent (  )  [virtual]

Definition at line 54 of file G4PSPassageCellCurrent.cc.

00055 {;}


Member Function Documentation

void G4PSPassageCellCurrent::clear (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 107 of file G4PSPassageCellCurrent.cc.

00107                                   {
00108   EvtMap->clear();
00109 }

void G4PSPassageCellCurrent::DrawAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 111 of file G4PSPassageCellCurrent.cc.

00112 {;}

void G4PSPassageCellCurrent::EndOfEvent ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 103 of file G4PSPassageCellCurrent.cc.

00104 {
00105 }

void G4PSPassageCellCurrent::Initialize ( G4HCofThisEvent  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 92 of file G4PSPassageCellCurrent.cc.

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

00093 {
00094   fCurrentTrkID = -1;
00095 
00096   EvtMap = new G4THitsMap<G4double>(detector->GetName(),
00097                                     GetName());
00098   if ( HCID < 0 ) HCID = GetCollectionID(0);
00099   HCE->AddHitsCollection(HCID,EvtMap);
00100 
00101 }

G4bool G4PSPassageCellCurrent::IsPassed ( G4Step  )  [protected, virtual]

Definition at line 69 of file G4PSPassageCellCurrent.cc.

References FALSE, fGeomBoundary, G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetStepStatus(), G4Step::GetTrack(), G4Track::GetTrackID(), and TRUE.

Referenced by ProcessHits().

00069                                                     {
00070   G4bool Passed = FALSE;
00071 
00072   G4bool IsEnter = aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary;
00073   G4bool IsExit  = aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary;
00074 
00075   G4int  trkid  = aStep->GetTrack()->GetTrackID();
00076 
00077   if ( IsEnter &&IsExit ){         // Passed at one step
00078     Passed = TRUE;                 
00079   }else if ( IsEnter ){            // Enter a new geometry
00080     fCurrentTrkID = trkid;         // Resetting the current track.
00081   }else if ( IsExit ){             // Exit a current geometry
00082     if ( fCurrentTrkID == trkid ) {
00083       Passed = TRUE;               // if the track is same as entered.
00084     }
00085   }else{                           // Inside geometry
00086     if ( fCurrentTrkID == trkid ){ // Adding the track length to current one ,
00087     }
00088   }
00089   return Passed;
00090 }

void G4PSPassageCellCurrent::PrintAll (  )  [virtual]

Reimplemented from G4VPrimitiveScorer.

Definition at line 114 of file G4PSPassageCellCurrent.cc.

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

00115 {
00116   G4cout << " MultiFunctionalDet  " << detector->GetName() << G4endl;
00117   G4cout << " PrimitiveScorer " << GetName() <<G4endl; 
00118   G4cout << " Number of entries " << EvtMap->entries() << G4endl;
00119   std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
00120   for(; itr != EvtMap->GetMap()->end(); itr++) {
00121     G4cout << "  copy no.: " << itr->first
00122            << "  cell current : " << *(itr->second)
00123            << " [tracks] "
00124            << G4endl;
00125   }
00126 }

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

Implements G4VPrimitiveScorer.

Definition at line 57 of file G4PSPassageCellCurrent.cc.

References G4VPrimitiveScorer::GetIndex(), G4Step::GetPreStepPoint(), G4StepPoint::GetWeight(), IsPassed(), and TRUE.

00058 {
00059 
00060   if ( IsPassed(aStep) ) {
00061     if(weighted) fCurrent = aStep->GetPreStepPoint()->GetWeight();
00062     G4int index = GetIndex(aStep);
00063     EvtMap->add(index,fCurrent);
00064   }
00065 
00066   return TRUE;
00067 }

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

Reimplemented from G4VPrimitiveScorer.

Definition at line 128 of file G4PSPassageCellCurrent.cc.

References G4Exception(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.

Referenced by G4PSPassageCellCurrent().

00129 {
00130   if (unit == "" ){
00131     unitName = unit;
00132     unitValue = 1.0;
00133   }else{
00134       G4String msg = "Invalid unit ["+unit+"] (Current  unit is [" +GetUnit()+"] ) for " + GetName();
00135     G4Exception("G4PSPassageCellCurrent::SetUnit","DetPS0012",JustWarning,msg);
00136   }
00137 }

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

Definition at line 56 of file G4PSPassageCellCurrent.hh.

Referenced by G4ScoreQuantityMessenger::SetNewValue().

00056 { weighted = flg; }


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