#include <G4PSNofSecondary.hh>
Inheritance diagram for G4PSNofSecondary:
Public Member Functions | |
G4PSNofSecondary (G4String name, G4int depth=0) | |
void | SetParticle (const G4String &particleName) |
void | Weighted (G4bool flg=true) |
virtual | ~G4PSNofSecondary () |
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 53 of file G4PSNofSecondary.hh.
Definition at line 40 of file G4PSNofSecondary.cc.
00041 :G4VPrimitiveScorer(name,depth),HCID(-1),particleDef(0), 00042 weighted(true) 00043 {;}
G4PSNofSecondary::~G4PSNofSecondary | ( | ) | [virtual] |
void G4PSNofSecondary::clear | ( | ) | [virtual] |
void G4PSNofSecondary::DrawAll | ( | ) | [virtual] |
void G4PSNofSecondary::EndOfEvent | ( | G4HCofThisEvent * | ) | [virtual] |
void G4PSNofSecondary::Initialize | ( | G4HCofThisEvent * | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 79 of file G4PSNofSecondary.cc.
References G4HCofThisEvent::AddHitsCollection(), G4VPrimitiveScorer::detector, G4VPrimitiveScorer::GetCollectionID(), G4VPrimitiveScorer::GetName(), and G4VSensitiveDetector::GetName().
00080 { 00081 EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName()); 00082 if(HCID < 0) {HCID = GetCollectionID(0);} 00083 HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); 00084 }
void G4PSNofSecondary::PrintAll | ( | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 96 of file G4PSNofSecondary.cc.
References G4cout, G4endl, G4VPrimitiveScorer::GetName(), and G4VPrimitiveScorer::GetUnitValue().
00097 { 00098 G4cout << " PrimitiveScorer " << GetName() << G4endl; 00099 G4cout << " Number of entries " << EvtMap->entries() << G4endl; 00100 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin(); 00101 for(; itr != EvtMap->GetMap()->end(); itr++) { 00102 G4cout << " copy no.: " << itr->first 00103 << " num of secondaries: " << *(itr->second)/GetUnitValue() 00104 << G4endl; 00105 } 00106 }
G4bool G4PSNofSecondary::ProcessHits | ( | G4Step * | , | |
G4TouchableHistory * | ||||
) | [protected, virtual] |
Implements G4VPrimitiveScorer.
Definition at line 48 of file G4PSNofSecondary.cc.
References FALSE, G4Track::GetCurrentStepNumber(), G4Track::GetDefinition(), G4VPrimitiveScorer::GetIndex(), G4Track::GetParentID(), G4Step::GetPreStepPoint(), G4Step::GetTrack(), G4StepPoint::GetWeight(), and TRUE.
00049 { 00050 //- check for newly produced particle. e.g. first step. 00051 if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE; 00052 //- check for this is not a primary particle. e.g. ParentID > 0 . 00053 if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE; 00054 //- check the particle if the partifle definition is given. 00055 if ( particleDef && particleDef != aStep->GetTrack()->GetDefinition() ) 00056 return FALSE; 00057 // 00058 //- This is a newly produced secondary particle. 00059 G4int index = GetIndex(aStep); 00060 G4double weight = 1.0; 00061 if ( weighted ) weight *= aStep->GetPreStepPoint()->GetWeight(); 00062 EvtMap->add(index,weight); 00063 return TRUE; 00064 }
void G4PSNofSecondary::SetParticle | ( | const G4String & | particleName | ) |
Definition at line 66 of file G4PSNofSecondary.cc.
References FatalException, G4ParticleTable::FindParticle(), G4Exception(), and G4ParticleTable::GetParticleTable().
00066 { 00067 G4ParticleDefinition* pd = 00068 G4ParticleTable::GetParticleTable()->FindParticle(particleName); 00069 if(!pd) { 00070 G4String msg = "Particle <"; 00071 msg += particleName; 00072 msg += "> not found."; 00073 G4Exception("G4PSNofSecondary::SetParticle", 00074 "DetPS0101",FatalException,msg); 00075 } 00076 particleDef = pd; 00077 }
void G4PSNofSecondary::SetUnit | ( | const G4String & | unit | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 108 of file G4PSNofSecondary.cc.
References G4Exception(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.
00109 { 00110 if (unit == "" ){ 00111 unitName = unit; 00112 unitValue = 1.0; 00113 }else{ 00114 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] ) for " + GetName(); 00115 G4Exception("G4PSNofSecondary::SetUnit","DetPS0010",JustWarning,msg); 00116 } 00117 }
void G4PSNofSecondary::Weighted | ( | G4bool | flg = true |
) | [inline] |