#include <G4PSTrackCounter.hh>
Inheritance diagram for G4PSTrackCounter:
Public Member Functions | |
G4PSTrackCounter (G4String name, G4int direction, G4int depth=0) | |
virtual | ~G4PSTrackCounter () |
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 *) |
Definition at line 47 of file G4PSTrackCounter.hh.
Definition at line 42 of file G4PSTrackCounter.cc.
References SetUnit().
00043 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),weighted(false) 00044 { 00045 SetUnit(""); 00046 }
G4PSTrackCounter::~G4PSTrackCounter | ( | ) | [virtual] |
void G4PSTrackCounter::clear | ( | ) | [virtual] |
void G4PSTrackCounter::DrawAll | ( | ) | [virtual] |
void G4PSTrackCounter::EndOfEvent | ( | G4HCofThisEvent * | ) | [virtual] |
void G4PSTrackCounter::Initialize | ( | G4HCofThisEvent * | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 85 of file G4PSTrackCounter.cc.
References G4HCofThisEvent::AddHitsCollection(), G4VPrimitiveScorer::detector, G4VPrimitiveScorer::GetCollectionID(), G4VPrimitiveScorer::GetName(), and G4VSensitiveDetector::GetName().
00086 { 00087 EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName()); 00088 if(HCID < 0) {HCID = GetCollectionID(0);} 00089 HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); 00090 //G4cout << "----- PS Initialize " << G4endl; 00091 }
void G4PSTrackCounter::PrintAll | ( | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 103 of file G4PSTrackCounter.cc.
References G4VPrimitiveScorer::detector, G4cout, G4endl, G4VPrimitiveScorer::GetName(), and G4VSensitiveDetector::GetName().
00104 { 00105 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; 00106 G4cout << " PrimitiveScorer " << GetName() << G4endl; 00107 G4cout << " Number of entries " << EvtMap->entries() << G4endl; 00108 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin(); 00109 for(; itr != EvtMap->GetMap()->end(); itr++) { 00110 G4cout << " copy no.: " << itr->first 00111 << " track count: " << *(itr->second) 00112 << " [tracks] " 00113 << G4endl; 00114 } 00115 }
G4bool G4PSTrackCounter::ProcessHits | ( | G4Step * | , | |
G4TouchableHistory * | ||||
) | [protected, virtual] |
Implements G4VPrimitiveScorer.
Definition at line 51 of file G4PSTrackCounter.cc.
References FALSE, fCurrent_In, fCurrent_InOut, fCurrent_Out, fGeomBoundary, G4VPrimitiveScorer::GetIndex(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetStepStatus(), G4StepPoint::GetWeight(), and TRUE.
00052 { 00053 00054 G4StepPoint* preStep = aStep->GetPreStepPoint(); 00055 G4StepPoint* posStep = aStep->GetPostStepPoint(); 00056 G4bool IsEnter = preStep->GetStepStatus()==fGeomBoundary; 00057 G4bool IsExit = posStep->GetStepStatus()==fGeomBoundary; 00058 00059 // Regular : count in prestep volume. 00060 G4int index = GetIndex(aStep); 00061 00062 // G4cout << " trk " << aStep->GetTrack()->GetTrackID() 00063 // << " index " << index << " In " << IsEnter << " Out " <<IsExit 00064 // << " PreStatus " << preStep->GetStepStatus() 00065 // << " PostStatus " << posStep->GetStepStatus() 00066 // << " w " << aStep->GetPreStepPoint()->GetWeight() 00067 // << G4endl; 00068 00069 G4bool flag = FALSE; 00070 00071 if ( IsEnter && fDirection == fCurrent_In ) flag = TRUE; 00072 else if ( IsExit && fDirection == fCurrent_Out ) flag = TRUE; 00073 else if ( (IsExit||IsEnter) && fDirection == fCurrent_InOut ) flag = TRUE; 00074 00075 if ( flag ){ 00076 //G4cout << " Count " << G4endl; 00077 G4double val = 1.0; 00078 if(weighted) val *= aStep->GetPreStepPoint()->GetWeight(); 00079 EvtMap->add(index,val); 00080 } 00081 00082 return TRUE; 00083 }
void G4PSTrackCounter::SetUnit | ( | const G4String & | unit | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 117 of file G4PSTrackCounter.cc.
References G4Exception(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.
Referenced by G4PSTrackCounter().
00118 { 00119 if (unit == "" ){ 00120 unitName = unit; 00121 unitValue = 1.0; 00122 }else{ 00123 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] ) for " + GetName(); 00124 G4Exception("G4PSTrackCounter::SetUnit","DetPS0018",JustWarning,msg); 00125 } 00126 00127 }
void G4PSTrackCounter::Weighted | ( | G4bool | flg = true |
) | [inline] |