Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4ParallelWorldProcess << 27 // 26 // 28 // Class description: << 29 // 27 // 30 // This process takes a parallel world and lim << 28 // 31 // on the boundaries of volumes in the paralle << 29 //--------------------------------------------------------------- 32 // It invokes sensitive detectors assigned in << 33 // It switches a material (and a region if def << 34 // assigned parallel world over the material ( << 35 // in the mass world. << 36 // 30 // 37 // Author: M.Asai (SLAC), 2010. << 31 // G4ParallelWorldProcess.hh 38 //-------------------------------------------- << 32 // >> 33 // Description: >> 34 // This procss takes a parallel world and limits a step >> 35 // on the boundaries of volumes in the parallel world. >> 36 // It invokes sensitive detectors assigned in the parallel >> 37 // world. >> 38 // It switches a material (and a region if defined) in the >> 39 // assigned parallel world over the material (and the region) >> 40 // in the mass world. >> 41 // >> 42 //--------------------------------------------------------------- >> 43 >> 44 39 #ifndef G4ParallelWorldProcess_h 45 #ifndef G4ParallelWorldProcess_h 40 #define G4ParallelWorldProcess_h 1 46 #define G4ParallelWorldProcess_h 1 41 47 42 #include "G4FieldTrack.hh" << 43 #include "G4MultiNavigator.hh" << 44 #include "G4TouchableHandle.hh" << 45 #include "G4VProcess.hh" << 46 #include "globals.hh" 48 #include "globals.hh" 47 << 48 class G4Step; 49 class G4Step; 49 class G4StepPoint; 50 class G4StepPoint; 50 class G4Navigator; 51 class G4Navigator; 51 class G4TransportationManager; 52 class G4TransportationManager; 52 class G4PathFinder; 53 class G4PathFinder; >> 54 class G4VTouchable; 53 class G4VPhysicalVolume; 55 class G4VPhysicalVolume; 54 class G4ParticleChange; 56 class G4ParticleChange; >> 57 #include "G4VProcess.hh" >> 58 #include "G4FieldTrack.hh" >> 59 #include "G4TouchableHandle.hh" >> 60 #include "G4MultiNavigator.hh" >> 61 >> 62 //------------------------------------------ >> 63 // >> 64 // G4ParallelWorldProcess class >> 65 // >> 66 //------------------------------------------ >> 67 >> 68 >> 69 // Class Description: 55 70 56 class G4ParallelWorldProcess : public G4VProce 71 class G4ParallelWorldProcess : public G4VProcess 57 { 72 { 58 public: << 73 public: // with description 59 74 60 G4ParallelWorldProcess(const G4String& pro << 75 //------------------------ 61 G4ProcessType theTy << 76 // Constructor/Destructor 62 ~G4ParallelWorldProcess() override; << 77 //------------------------ 63 << 78 64 //---------------------------------------- << 79 G4ParallelWorldProcess(const G4String& processName = "ParaWorld", 65 // Set Paralle World << 80 G4ProcessType theType = fParallel); 66 //---------------------------------------- << 81 virtual ~G4ParallelWorldProcess(); 67 << 82 68 void SetParallelWorld(G4String parallelWor << 83 //-------------------------------------------------------------- 69 void SetParallelWorld(G4VPhysicalVolume* p << 84 // Set Paralle World 70 << 85 //-------------------------------------------------------------- 71 //---------------------------------------- << 86 72 // Process interface << 87 void SetParallelWorld(G4String parallelWorldName); 73 //---------------------------------------- << 88 void SetParallelWorld(G4VPhysicalVolume* parallelWorld); 74 << 89 75 void StartTracking(G4Track*) override; << 90 //-------------------------------------------------------------- 76 << 91 // Process interface 77 //---------------------------------------- << 92 //-------------------------------------------------------------- 78 // GetPhysicalInteractionLength() and DoIt << 93 79 //---------------------------------------- << 94 void StartTracking(G4Track*); 80 << 95 81 G4double AtRestGetPhysicalInteractionLengt << 96 //------------------------------------------------------------------------ 82 G4VParticleChange* AtRestDoIt(const G4Trac << 97 // GetPhysicalInteractionLength() and DoIt() methods for AtRest 83 << 98 //------------------------------------------------------------------------ 84 //---------------------------------------- << 99 85 // GetPhysicalInteractionLength() and DoIt << 100 G4double AtRestGetPhysicalInteractionLength(const G4Track&,G4ForceCondition*); 86 //---------------------------------------- << 101 G4VParticleChange* AtRestDoIt(const G4Track&,const G4Step&); 87 << 102 88 G4double AlongStepGetPhysicalInteractionLe << 103 //------------------------------------------------------------------------ 89 << 104 // GetPhysicalInteractionLength() and DoIt() methods for AlongStep 90 G4VParticleChange* AlongStepDoIt(const G4T << 105 //------------------------------------------------------------------------ 91 << 106 92 //---------------------------------------- << 107 G4double AlongStepGetPhysicalInteractionLength( 93 // GetPhysicalInteractionLength() and DoIt << 108 const G4Track&,G4double,G4double,G4double&,G4GPILSelection*); 94 //---------------------------------------- << 109 G4VParticleChange* AlongStepDoIt(const G4Track&,const G4Step&); 95 << 110 96 G4double PostStepGetPhysicalInteractionLen << 111 //----------------------------------------------------------------------- 97 << 112 // GetPhysicalInteractionLength() and DoIt() methods for PostStep 98 G4VParticleChange* PostStepDoIt(const G4Tr << 113 //----------------------------------------------------------------------- 99 << 114 100 //---------------------------------------- << 115 G4double PostStepGetPhysicalInteractionLength( 101 // Flag for material switching << 116 const G4Track&,G4double,G4ForceCondition*); 102 //---------------------------------------- << 117 G4VParticleChange* PostStepDoIt(const G4Track&,const G4Step&); 103 << 118 104 inline void SetLayeredMaterialFlag(G4bool << 119 //----------------------------------------------------------------------- 105 inline G4bool GetLayeredMaterialFlag() con << 120 // Flag for material switching 106 << 121 //----------------------------------------------------------------------- 107 //---------------------------------------- << 122 108 // Returns whether a particular particle t << 123 inline void SetLayeredMaterialFlag(G4bool flg=true) 109 //---------------------------------------- << 124 { layeredMaterialFlag = flg; } 110 G4bool IsAtRestRequired(G4ParticleDefiniti << 125 inline G4bool GetLayeredMaterialFlag() const 111 << 126 { return layeredMaterialFlag; } 112 //---------------------------------------- << 127 113 // Static G4Step object for "Hyper-step" << 128 private: 114 //---------------------------------------- << 129 void CopyStep(const G4Step & step); 115 static const G4Step* GetHyperStep(); << 130 void SwitchMaterial(G4StepPoint*); 116 static G4int GetHypNavigatorID(); << 131 117 << 132 public: // with description 118 protected: << 133 //-------------------------------------------------------------------- 119 << 134 // Returns whether a particular particle type requires AtRest process 120 void CopyStep(const G4Step& step); << 135 //-------------------------------------------------------------------- 121 void SwitchMaterial(G4StepPoint*); << 136 G4bool IsAtRestRequired(G4ParticleDefinition*); 122 << 137 123 protected: << 138 private: 124 << 139 G4Step * fGhostStep; 125 G4Step* fGhostStep; << 140 G4StepPoint * fGhostPreStepPoint; 126 G4StepPoint* fGhostPreStepPoint; << 141 G4StepPoint * fGhostPostStepPoint; 127 G4StepPoint* fGhostPostStepPoint; << 142 128 << 143 G4VParticleChange aDummyParticleChange; 129 G4VParticleChange aDummyParticleChange; << 144 G4ParticleChange xParticleChange; 130 G4ParticleChange xParticleChange; << 145 131 << 146 G4TransportationManager* fTransportationManager; 132 G4TransportationManager* fTransportationMa << 147 G4PathFinder* fPathFinder; 133 G4PathFinder* fPathFinder; << 148 134 << 149 // ------------------------------- 135 // ------------------------------- << 150 // Navigation in the Ghost World: 136 // Navigation in the Ghost World: << 151 // ------------------------------- 137 // ------------------------------- << 152 G4String fGhostWorldName; 138 G4String fGhostWorldName; << 153 G4VPhysicalVolume* fGhostWorld; 139 G4VPhysicalVolume* fGhostWorld{nullptr}; << 154 G4Navigator* fGhostNavigator; 140 G4Navigator* fGhostNavigator{nullptr}; << 155 G4int fNavigatorID; 141 G4int fNavigatorID{-1}; << 156 G4TouchableHandle fOldGhostTouchable; 142 G4TouchableHandle fOldGhostTouchable; << 157 G4TouchableHandle fNewGhostTouchable; 143 G4TouchableHandle fNewGhostTouchable; << 158 G4FieldTrack fFieldTrack; 144 G4FieldTrack fFieldTrack; << 159 G4double fGhostSafety; 145 G4double fGhostSafety{0.}; << 160 G4bool fOnBoundary; 146 G4bool fOnBoundary{false}; << 161 147 << 162 //----------------------------------------------------------------------- 148 //---------------------------------------- << 163 // Flag for material switching 149 // Flag for material switching << 164 //----------------------------------------------------------------------- 150 //---------------------------------------- << 165 G4bool layeredMaterialFlag; 151 G4bool layeredMaterialFlag{false}; << 166 152 << 167 //----------------------------------------------------------------------- 153 private: << 168 // Static G4Step object for "Hyper-step" 154 << 169 //----------------------------------------------------------------------- 155 static G4ThreadLocal G4Step* fpHyperStep; << 170 public: 156 static G4ThreadLocal G4int nParallelWorlds << 171 static const G4Step* GetHyperStep(); 157 static G4ThreadLocal G4int fNavIDHyp; << 172 static G4int GetHypNavigatorID(); 158 G4int iParallelWorld; << 173 private: >> 174 static G4ThreadLocal G4Step* fpHyperStep; >> 175 static G4ThreadLocal G4int nParallelWorlds; >> 176 static G4ThreadLocal G4int fNavIDHyp; >> 177 G4int iParallelWorld; 159 }; 178 }; 160 179 161 #endif 180 #endif 162 181