52 G4Track& track = *aStep->GetTrack();
53 if (track.GetDefinition()->GetParticleName() !=
"opticalphoton")
return false;
56 const G4double globalTime = track.GetGlobalTime();
58 const G4StepPoint& postStep = *aStep->GetPostStepPoint();
59 const G4ThreeVector& postworldPosition = postStep.GetPosition();
61 const G4StepPoint& preStep = *aStep->GetPreStepPoint();
62 const G4ThreeVector& preworldPosition = preStep.GetPosition();
66 if (postworldPosition.z() - preworldPosition.z() > 0) dir = +1;
69 if (dir == 1 && postStep.GetStepStatus() != fGeomBoundary) {
return false;}
70 if (dir == -1 && preStep.GetStepStatus() != fGeomBoundary) {
return false;}
72 if ((track.GetNextVolume())->GetName() ==
"ARICH.HAPDWall") {
73 track.SetTrackStatus(fStopAndKill);
78 G4OpBoundaryProcessStatus theStatus = Undefined;
80 G4ProcessManager* OpManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
83 G4int MAXofPostStepLoops =
84 OpManager->GetPostStepProcessVector()->entries();
85 G4ProcessVector* fPostStepDoItVector =
86 OpManager->GetPostStepProcessVector(typeDoIt);
87 for (G4int i = 0; i < MAXofPostStepLoops; i++) {
88 G4VProcess* fCurrentProcess = (*fPostStepDoItVector)[i];
89 G4OpBoundaryProcess* opProcess =
dynamic_cast<G4OpBoundaryProcess*
>(fCurrentProcess);
90 if (opProcess) { theStatus = opProcess->GetStatus();
break;}
95 if (theStatus == 3 && dir < 0)
return 0;
96 if (theStatus == 4 && dir < 0) {
if (gRandom->Uniform() < 0.5) track.SetTrackStatus(fStopAndKill);
return 0; }
100 Simulation::TrackInfo* info =
101 dynamic_cast<Simulation::TrackInfo*
>(track.GetUserInformation());
102 if (info) applyQE = info->getStatus() < 2;
106 double energy = track.GetKineticEnergy() / CLHEP::eV;
109 double fraction = 1.;
110 if (info) fraction = info->getFraction();
112 if (theStatus == 3) qeffi *=
m_simPar->getQEScaling();
113 if (gRandom->Uniform() * fraction > qeffi) {
115 if (theStatus == 3 && gRandom->Uniform() <
m_simPar->getWindowAbsorbtion()) track.SetTrackStatus(fStopAndKill);
121 const G4int moduleID = dir > 0 ? postStep.GetTouchableHandle()->GetReplicaNumber(1) :
122 preStep.GetTouchableHandle()->GetReplicaNumber(2);
124 if (moduleID <= 0)
return false;
128 G4ThreeVector localPosition = dir > 0 ? postStep.GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(
130 preStep.GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(preworldPosition);
133 const G4double energy = track.GetKineticEnergy() / CLHEP::eV;
139 ROOT::Math::XYVector locpos(localPosition.x() / CLHEP::cm, localPosition.y() / CLHEP::cm);
149 track.SetTrackStatus(fStopAndKill);