Commit ec52a20a authored by Chad Lantz's avatar Chad Lantz
Browse files

Changed from having multiple OPTICAL flag behaviors to just killing any photons outside of an SD

parent 5bfa11ed
......@@ -66,27 +66,15 @@ void SteppingAction::UserSteppingAction(__attribute__((unused)) const G4Step* th
}
//If we are tracking a gamma that came from the primary event
if(PI0 && theTrack->GetParentID()==1 && theTrack->GetCurrentStepNumber() == 1 && theTrack->GetDefinition() == G4Gamma::GammaDefinition() ){
m_Pi0Mom->push_back( theTrack->GetVertexMomentumDirection() );
m_Pi0Vert->push_back( theTrack->GetVertexPosition () );
}
else if(theTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition() ){ // If we are tracking an optical photon
// Get the SD for the volume we're in. Returns 0 if we aren't in an SD volume
if(PI0 && theTrack->GetParentID()==1 && theTrack->GetCurrentStepNumber() == 1 && theTrack->GetDefinition() == G4Gamma::GammaDefinition() ){
m_Pi0Mom->push_back( theTrack->GetVertexMomentumDirection() );
m_Pi0Vert->push_back( theTrack->GetVertexPosition () );
}else if(theTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition() ){
//If the particle is an optical photon outside of any SDs, kill it.
FiberSD* sd = (FiberSD*)theTrack->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
// If World OPTICAL is on
if(OPTICAL){
// Kill photons only in SD volumes with OPTICAL off
if(sd != 0 && !sd->OpticalIsOn() ){
theTrack->SetTrackStatus( fStopAndKill );
}
} else { // World OPTICAL is off
// Kill all photons except those in SD volumes with OPTICAL on
if(sd == 0 || !sd->OpticalIsOn() ){
theTrack->SetTrackStatus( fStopAndKill );
}
if(!sd){
theTrack->SetTrackStatus( fStopAndKill );
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment