Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4VSteppingVerbose 27 // 28 // Class description: 29 // 30 // This class manages the verbose outputs in G4SteppingManager. 31 // The instance should be a singleton. Users can inherit this 32 // class to make their own verbosity class. 33 34 // Contact: 35 // Questions and comments to this code should be sent to 36 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp) 37 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp) 38 // -------------------------------------------------------------------- 39 #ifndef G4VSteppingVerbose_hh 40 #define G4VSteppingVerbose_hh 1 41 42 #include "G4ForceCondition.hh" // enum 'track' 43 #include "G4GPILSelection.hh" // enum 'track' 44 #include "G4StepStatus.hh" // Include from 'track' 45 #include "G4TouchableHandle.hh" 46 #include "G4TrackVector.hh" // Include from 'tracking' 47 #include "G4VProcess.hh" 48 #include "globals.hh" // Include from 'global' 49 50 #include "trkgdefs.hh" 51 52 #include <vector> 53 54 class G4SteppingManager; 55 class G4Navigator; 56 class G4VPhysicalVolume; 57 class G4VSensitiveDetector; 58 class G4ProcessVector; 59 class G4SteppingManager; 60 class G4Track; 61 class G4UserSteppingAction; 62 class G4StepPoint; 63 class G4VParticleChange; 64 65 class G4VSteppingVerbose 66 { 67 public: 68 virtual ~G4VSteppingVerbose(); 69 70 // static methods to set/get the object's pointer 71 72 static void SetInstance(G4VSteppingVerbose* Instance); 73 static G4VSteppingVerbose* GetInstance(); 74 static G4VSteppingVerbose* GetMasterInstance(); 75 static G4int GetSilent(); 76 static void SetSilent(G4int fSilent); 77 static G4int GetSilentStepInfo(); 78 static void SetSilentStepInfo(G4int fSilent); 79 80 virtual G4VSteppingVerbose* Clone(); 81 82 // these method are invoked by G4SteppingManager 83 84 virtual void NewStep() = 0; 85 void CopyState(); 86 virtual void SetManager(G4SteppingManager* const); 87 virtual void AtRestDoItInvoked() = 0; 88 virtual void AlongStepDoItAllDone() = 0; 89 virtual void PostStepDoItAllDone() = 0; 90 virtual void AlongStepDoItOneByOne() = 0; 91 virtual void PostStepDoItOneByOne() = 0; 92 virtual void StepInfo() = 0; 93 virtual void TrackingStarted() = 0; 94 virtual void DPSLStarted() = 0; 95 virtual void DPSLUserLimit() = 0; 96 virtual void DPSLPostStep() = 0; 97 virtual void DPSLAlongStep() = 0; 98 virtual void VerboseTrack() = 0; 99 virtual void VerboseParticleChange() = 0; 100 101 protected: 102 G4VSteppingVerbose(); // 'singleton' 103 104 static G4ThreadLocal G4VSteppingVerbose* fInstance; // pointer to the instance 105 static G4VSteppingVerbose* fMasterInstance; // pointer to the instance in master thread 106 G4TRACKING_DLL static G4ThreadLocal G4int Silent; // flag for verbosity 107 G4TRACKING_DLL static G4ThreadLocal G4int SilentStepInfo; // another flag for verbosity 108 109 G4SteppingManager* fManager = nullptr; 110 G4UserSteppingAction* fUserSteppingAction = nullptr; 111 112 G4double PhysicalStep = 0.0; 113 G4double GeometricalStep = 0.0; 114 G4double CorrectedStep = 0.0; 115 G4bool PreStepPointIsGeom = false; 116 G4bool FirstStep = false; 117 G4StepStatus fStepStatus = fUndefined; 118 119 G4double TempInitVelocity = 0.0; 120 G4double TempVelocity = 0.0; 121 G4double Mass = 0.0; 122 123 G4double sumEnergyChange = 0.0; 124 125 G4VParticleChange* fParticleChange = nullptr; 126 G4Track* fTrack = nullptr; 127 G4TrackVector* fSecondary = nullptr; 128 G4Step* fStep = nullptr; 129 G4StepPoint* fPreStepPoint = nullptr; 130 G4StepPoint* fPostStepPoint = nullptr; 131 132 G4VPhysicalVolume* fCurrentVolume = nullptr; 133 G4VSensitiveDetector* fSensitive = nullptr; 134 G4VProcess* fCurrentProcess = nullptr; // The pointer to the process whose DoIt() or 135 // GetPhysicalInteractionLength() has been just executed 136 137 G4ProcessVector* fAtRestDoItVector = nullptr; 138 G4ProcessVector* fAlongStepDoItVector = nullptr; 139 G4ProcessVector* fPostStepDoItVector = nullptr; 140 141 G4ProcessVector* fAtRestGetPhysIntVector = nullptr; 142 G4ProcessVector* fAlongStepGetPhysIntVector = nullptr; 143 G4ProcessVector* fPostStepGetPhysIntVector = nullptr; 144 145 std::size_t MAXofAtRestLoops = 0; 146 std::size_t MAXofAlongStepLoops = 0; 147 std::size_t MAXofPostStepLoops = 0; 148 149 G4double currentMinimumStep = 0.0; 150 G4double numberOfInteractionLengthLeft = 0.0; 151 152 std::size_t fAtRestDoItProcTriggered = 0; 153 std::size_t fAlongStepDoItProcTriggered = 0; 154 std::size_t fPostStepDoItProcTriggered = 0; 155 156 G4int fN2ndariesAtRestDoIt = 0; 157 G4int fN2ndariesAlongStepDoIt = 0; 158 G4int fN2ndariesPostStepDoIt = 0; 159 // These are the numbers of secondaries generated by the process 160 // just executed 161 162 G4Navigator* fNavigator = nullptr; 163 164 G4int verboseLevel = 0; 165 166 using G4SelectedAtRestDoItVector = std::vector<G4int>; 167 using G4SelectedAlongStepDoItVector = std::vector<G4int>; 168 using G4SelectedPostStepDoItVector = std::vector<G4int>; 169 170 G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr; 171 G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr; 172 G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr; 173 174 G4double fPreviousStepSize = 0.0; 175 176 G4TouchableHandle fTouchableHandle; 177 178 G4SteppingControl StepControlFlag = NormalCondition; 179 180 G4double physIntLength = 0.0; 181 G4ForceCondition fCondition = InActivated; 182 G4GPILSelection fGPILSelection = NotCandidateForSelection; 183 // Above three variables are for the method DefinePhysicalStepLength(). 184 // To pass this information to the method Verbose(), they are kept at 185 // here. Need a more elegant mechanism 186 }; 187 188 #endif 189