File indexing completed on 2026-04-09 07:50:01
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
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #include <vector>
0038 #include <string>
0039
0040 class G4Run ;
0041 class G4Event ;
0042 class G4Track ;
0043 class G4Step ;
0044 class G4VSolid ;
0045 class G4StepPoint ;
0046
0047 struct U4Tree ;
0048 struct NP ;
0049 struct spho ;
0050 struct quad4 ;
0051 struct SEvt ;
0052 struct stimer ;
0053
0054 #include "NPU.hh" // UName
0055
0056 #include "plog/Severity.h"
0057 #include "G4TrackStatus.hh"
0058 #include "U4_API_EXPORT.hh"
0059
0060 struct U4_API U4Recorder
0061 {
0062 static const plog::Severity LEVEL ;
0063 static UName SPECS ;
0064
0065 static const int STATES ;
0066 static const int RERUN ;
0067 static constexpr int STATE_ITEMS = 2*17+4 ;
0068 static const bool SEvt_NPFold_VERBOSE ;
0069 static const bool PIDX_ENABLED ;
0070 static const bool EndOfRunAction_Simtrace ;
0071 static const int UseGivenVelocity_KLUDGE ;
0072 static constexpr const char* _UseGivenVelocity_KLUDGE = "U4Recorder__PreUserTrackingAction_Optical_UseGivenVelocity_KLUDGE" ;
0073
0074 static const char* REPLICA_NAME_SELECT ;
0075 static const int PIDX ;
0076 static const int EIDX ;
0077 static const int GIDX ;
0078
0079 static std::string Desc();
0080 static std::string DescFull();
0081 static std::string Switches();
0082 static std::string EnabledLabel();
0083 static bool Enabled(const spho& label);
0084 std::string desc() const ;
0085
0086 static U4Recorder* INSTANCE ;
0087 static U4Recorder* Get();
0088
0089 U4Recorder();
0090 private:
0091 void init();
0092 void init_SEvt();
0093 public:
0094 void addProcessHits_EPH(NP* eph_stats);
0095
0096 int eventID ;
0097 const G4Track* transient_fSuspend_track ;
0098 NP* rerun_rand ;
0099 SEvt* sev ;
0100 const U4Tree* tree ;
0101
0102 void setU4Tree(const U4Tree* _tree);
0103 const U4Tree* getU4Tree() const ;
0104
0105 void BeginOfRunAction(const G4Run*);
0106 void EndOfRunAction(const G4Run*);
0107
0108 void BeginOfEventAction(const G4Event*);
0109 void EndOfEventAction(const G4Event*);
0110
0111 void BeginOfEventAction_(int eventID_);
0112 void EndOfEventAction_(int eventID_);
0113
0114 void PreUserTrackingAction(const G4Track* );
0115 void PostUserTrackingAction(const G4Track* );
0116
0117 void PreUserTrackingAction_( const G4Track*, int* label );
0118 void PostUserTrackingAction_(const G4Track*, int* label );
0119
0120 void PreUserTrackingAction_Optical(const G4Track*);
0121 void PreUserTrackingAction_Optical_(const G4Track*, int* label );
0122
0123 void PreUserTrackingAction_Optical_GetLabel( spho& ulabel, const G4Track* track );
0124 void PreUserTrackingAction_Optical_FabricateLabel( const G4Track* track ) ;
0125 void PreUserTrackingAction_Optical_FabricateLabel_( const G4Track* track, int* label );
0126
0127 void GetLabel( spho& ulabel, const G4Track* track );
0128
0129
0130 void saveOrLoadStates(int id);
0131 void saveRerunRand(const char* dir) const ;
0132
0133 static NP* MakeMetaArray() ;
0134 static void SaveMeta(const char* savedir);
0135
0136 void PostUserTrackingAction_Optical( const G4Track*);
0137 void PostUserTrackingAction_Optical_(const G4Track*, int* label);
0138
0139
0140 void UserSteppingAction(const G4Step*);
0141
0142
0143 template<typename T>
0144 void UserSteppingAction_Optical(const G4Step*);
0145
0146 static unsigned EPH_EFFICIENCY_COLLECT_OR_CULL(unsigned eph);
0147 static void EPH_FlagCheck(unsigned original_flag, unsigned eph);
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164 static constexpr const char* UserSteppingAction_Optical_ClearNumberOfInteractionLengthLeft_ = "U4Recorder__UserSteppingAction_Optical_ClearNumberOfInteractionLengthLeft" ;
0165 static const bool UserSteppingAction_Optical_ClearNumberOfInteractionLengthLeft ;
0166
0167
0168 template <typename T>
0169 static void CollectBoundaryAux(quad4* current_aux );
0170
0171
0172 static const double EPSILON ;
0173 static const bool ClassifyFake_FindPV_r ;
0174 static stimer* TIMER ;
0175
0176 unsigned ClassifyFake(const G4Step* step, unsigned flag, const char* spec, bool dump, double* duration );
0177
0178 static const double SLOW_FAKE ;
0179 static std::vector<std::string>* FAKES ;
0180 static bool FAKES_SKIP ;
0181
0182 static bool IsListed( const std::vector<std::string>* LIST, const char* spec ) ;
0183 static bool IsListedFake( const char* spec );
0184 static std::string DescFakes();
0185
0186
0187 void Check_TrackStatus_Flag(G4TrackStatus tstat, unsigned flag, const char* from );
0188 };
0189