File indexing completed on 2026-04-10 07:50:31
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include "U4_API_EXPORT.hh"
0024 struct U4_API U4OpBoundaryProcess
0025 {
0026 template <typename T>
0027 static T* Get() ;
0028
0029 template <typename T>
0030 static unsigned GetStatus() ;
0031 };
0032
0033 #include "G4ProcessManager.hh"
0034 #include "G4OpBoundaryProcess.hh" // need standard enum from here even when using customized boundary process
0035
0036
0037 #if defined(WITH_CUSTOM4)
0038 #include "C4OpBoundaryProcess.hh"
0039 #elif defined(WITH_PMTSIM)
0040 #include "CustomG4OpBoundaryProcess.hh"
0041 #elif defined(WITH_INSTRUMENTED_DEBUG)
0042 #include "InstrumentedG4OpBoundaryProcess.hh"
0043 #else
0044 #include "G4OpBoundaryProcess.hh"
0045 #endif
0046
0047
0048 template <typename T>
0049 inline T* U4OpBoundaryProcess::Get()
0050 {
0051 T* bp = nullptr ;
0052 G4ProcessManager* mgr = G4OpticalPhoton::OpticalPhoton()->GetProcessManager() ;
0053 assert(mgr);
0054
0055 G4int pmax = mgr ? mgr->GetPostStepProcessVector()->entries() : 0 ;
0056 G4ProcessVector* pvec = mgr ? mgr->GetPostStepProcessVector(typeDoIt) : nullptr ;
0057
0058 for (int i=0; i < pmax ; i++)
0059 {
0060 G4VProcess* p = (*pvec)[i];
0061 T* t = dynamic_cast<T*>(p);
0062 if(t)
0063 {
0064 bp = t ;
0065 break;
0066 }
0067 }
0068 return bp ;
0069 }
0070
0071 template <typename T>
0072 inline unsigned U4OpBoundaryProcess::GetStatus()
0073 {
0074 T* proc = Get<T>();
0075 G4OpBoundaryProcessStatus status = proc ? proc->GetStatus() : Undefined ;
0076 return (unsigned)status ;
0077 }
0078
0079
0080 #if defined(WITH_CUSTOM4)
0081 template unsigned U4OpBoundaryProcess::GetStatus<C4OpBoundaryProcess>() ;
0082 #elif defined(WITH_PMTSIM)
0083 template unsigned U4OpBoundaryProcess::GetStatus<CustomG4OpBoundaryProcess>() ;
0084 #elif defined(WITH_INSTRUMENTED_DEBUG)
0085 template unsigned U4OpBoundaryProcess::GetStatus<InstrumentedG4OpBoundaryProcess>() ;
0086 #else
0087 template unsigned U4OpBoundaryProcess::GetStatus<G4OpBoundaryProcess>() ;
0088 #endif
0089