#include "PrtOpBoundaryProcess.h" #include "PrtManager.h" PrtOpBoundaryProcess::PrtOpBoundaryProcess() : G4OpBoundaryProcess() { fLensId = PrtManager::Instance()->GetLens(); } G4VParticleChange* PrtOpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep) { G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint(); G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint(); G4VParticleChange* particleChange = G4OpBoundaryProcess::PostStepDoIt(aTrack, aStep); // int parentId = aTrack.GetParentID(); // std::cout<<"parentId "<ProposeTrackStatus(fStopAndKill); // ideal focusing if(PrtManager::Instance()->GetLens() == 10){ G4String ParticleName = aTrack.GetDynamicParticle()->GetParticleDefinition()->GetParticleName(); if (ParticleName == "opticalphoton"){ double endofbar = 1250/2.; G4ThreeVector theGlobalPoint1 = pPostStepPoint->GetPosition(); G4TouchableHistory* touchable = (G4TouchableHistory*)(pPostStepPoint->GetTouchable()); G4ThreeVector lpoint = touchable->GetHistory()->GetTransform( 1 ).TransformPoint(theGlobalPoint1); if(lpoint.getZ() < endofbar+0.0001 && lpoint.getZ() > endofbar-0.0001){ G4ThreeVector ww = pPreStepPoint->GetTouchableHandle()->GetHistory()-> GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0,0,endofbar)); if(aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()!="wBar") particleChange->ProposeTrackStatus(fStopAndKill); else{ G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking(); theNavigator->LocateGlobalPointWithinVolume(ww); aParticleChange.ProposePosition(ww.getX(), ww.getY(),ww.getZ()); } return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); } } } if(PrtManager::Instance()->GetRunType() == 1 && pPostStepPoint->GetPosition().x()>pPreStepPoint->GetPosition().x()){ particleChange->ProposeTrackStatus(fStopAndKill); } if(PrtManager::Instance()->GetRunType() == 5 && aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()=="wDirc" && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wPrizm" && GetStatus() == FresnelRefraction){ particleChange->ProposeTrackStatus(fStopAndKill); } // kill photons outside bar and prizm if(GetStatus() == FresnelRefraction && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wDirc"){ particleChange->ProposeTrackStatus(fStopAndKill); } if((aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()=="wLens1" || aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()=="wLens2") && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wDirc"){ particleChange->ProposeTrackStatus(fStopAndKill); } return particleChange; }