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 // $Id: G4ITModelProcessor.hh 100802 2016-11-02 14:55:27Z gcosmo $ 26 // 27 // 27 // Author: Mathieu Karamitros 28 // Author: Mathieu Karamitros 28 29 29 // The code is developed in the framework of t 30 // The code is developed in the framework of the ESA AO7146 30 // 31 // 31 // We would be very happy hearing from you, se 32 // We would be very happy hearing from you, send us your feedback! :) 32 // 33 // 33 // In order for Geant4-DNA to be maintained an 34 // In order for Geant4-DNA to be maintained and still open-source, 34 // article citations are crucial. 35 // article citations are crucial. 35 // If you use Geant4-DNA chemistry and you pub 36 // If you use Geant4-DNA chemistry and you publish papers about your software, 36 // in addition to the general paper on Geant4- 37 // in addition to the general paper on Geant4-DNA: 37 // 38 // 38 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178 39 // 40 // 40 // we would be very happy if you could please 41 // we would be very happy if you could please also cite the following 41 // reference papers on chemistry: 42 // reference papers on chemistry: 42 // 43 // 43 // J. Comput. Phys. 274 (2014) 841-882 44 // J. Comput. Phys. 274 (2014) 841-882 44 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 45 46 46 #pragma once << 47 #ifndef G4ITMODELPROCESSOR_H >> 48 #define G4ITMODELPROCESSOR_H 47 49 >> 50 #include <vector> 48 #include "G4ITReactionChange.hh" 51 #include "G4ITReactionChange.hh" 49 #include "G4ITType.hh" 52 #include "G4ITType.hh" 50 #include "G4ITModelHandler.hh" 53 #include "G4ITModelHandler.hh" 51 #include "G4ITStepStatus.hh" 54 #include "G4ITStepStatus.hh" 52 #include <vector> << 53 55 54 class G4VITTimeStepComputer; 56 class G4VITTimeStepComputer; 55 class G4VITReactionProcess; 57 class G4VITReactionProcess; 56 class G4ITModelHandler; 58 class G4ITModelHandler; 57 class G4ITReactionSet; 59 class G4ITReactionSet; 58 class G4UserTimeStepAction; 60 class G4UserTimeStepAction; 59 class G4ITTrackingManager; 61 class G4ITTrackingManager; 60 class G4ITTrackHolder; 62 class G4ITTrackHolder; 61 63 >> 64 //#ifndef compTrackPerID__ >> 65 //#define compTrackPerID__ >> 66 // struct compTrackPerID >> 67 // { >> 68 // bool operator()(G4Track* rhs, G4Track* lhs) const >> 69 // { >> 70 // return rhs->GetTrackID() < lhs->GetTrackID(); >> 71 // } >> 72 // }; >> 73 //#endif >> 74 62 /** 75 /** 63 * The G4ITModelProcessor will call the two pr 76 * The G4ITModelProcessor will call the two processes defined in G4VITModel. 64 * This processes act at the beginning and end 77 * This processes act at the beginning and end of each step. 65 * The first one, the TimeStepper will calcula 78 * The first one, the TimeStepper will calculate a time step to propagate all 66 * the track and eventually it can return some 79 * the track and eventually it can return some tracks that can likely react 67 * at the end of the step. 80 * at the end of the step. 68 * The second one, the ReactionProcess will ma 81 * The second one, the ReactionProcess will make the tracks reacting. 69 * \deprecated This class will be removed << 70 */ 82 */ 71 class G4ITModelProcessor 83 class G4ITModelProcessor 72 { 84 { 73 public: 85 public: 74 G4ITModelProcessor(); << 86 G4ITModelProcessor(); 75 G4ITModelProcessor(const G4ITModelProcesso << 87 virtual ~G4ITModelProcessor(); 76 G4ITModelProcessor& operator=(const G4ITMo << 77 virtual ~G4ITModelProcessor(); << 78 << 79 void SetModelHandler(G4ITModelHandler*); << 80 void SetTrackingManager(G4ITTrackingManage << 81 88 82 void Initialize(); << 89 inline void SetModelHandler(G4ITModelHandler*); >> 90 void Initialize(); >> 91 //void Initialize(G4MIWorkspace* /*workspace*/); >> 92 >> 93 void RegisterModel(double time, G4VITStepModel*); >> 94 >> 95 /** >> 96 * Restore original state of the modelProcessor. >> 97 * This method should be call only by the G4Scheduler >> 98 */ >> 99 inline void CleanProcessor(); >> 100 >> 101 G4double CalculateMinTimeStep(G4double currentGlobalTime, >> 102 G4double definedMinTimeStep); >> 103 >> 104 void ComputeTrackReaction(G4ITStepStatus fITStepStatus, >> 105 G4double fGlobalTime, >> 106 G4double currentTimeStep, >> 107 G4double previousTimeStep, >> 108 G4bool reachedUserTimeLimit, >> 109 G4double fTimeTolerance, >> 110 G4UserTimeStepAction* fpUserTimeStepAction, >> 111 G4int fVerbose); >> 112 >> 113 //____________________________________________________________ >> 114 // Time stepper part >> 115 void InitializeStepper(G4double currentGlobalTime, >> 116 G4double userMinTime); >> 117 >> 118 bool GetComputeTimeStep() >> 119 { >> 120 return fComputeTimeStep; >> 121 } 83 122 84 void RegisterModel(double time, G4VITStepM << 123 protected: 85 << 86 /** Restore the original state. This metho << 87 void CleanProcessor(); << 88 124 89 G4double CalculateMinTimeStep(G4double cur << 125 inline void SetTrack(const G4Track*); 90 G4double def << 91 126 92 void ComputeTrackReaction(G4ITStepStatus f << 127 public: 93 G4double fGlobal << 128 void CalculateTimeStep(const G4Track*, const G4double); 94 G4double current << 129 void DoCalculateStep(); 95 G4double previou << 96 G4bool reachedUs << 97 G4double fTimeTo << 98 G4UserTimeStepAc << 99 G4int fVerbose); << 100 130 101 void InitializeStepper(G4double currentGlo << 131 //____________________________________________________________ 102 G4double userMinTim << 132 // Reaction process part >> 133 void FindReaction(G4ITReactionSet* reactionSet, >> 134 const double currentStepTime, >> 135 const double previousStepTime, >> 136 const bool reachedUserStepTimeLimit); >> 137 >> 138 //____________________________________________________________ >> 139 // Get results >> 140 inline const std::vector<std::vector<G4VITStepModel*> >* GetCurrentModel(); >> 141 >> 142 inline std::vector<G4ITReactionChange*>* GetReactionInfo() >> 143 { >> 144 return &fReactionInfo; >> 145 } >> 146 >> 147 const G4Track* GetTrack() const >> 148 { >> 149 return fpTrack; >> 150 } >> 151 >> 152 void SetTrackingManager(G4ITTrackingManager* trackingManager) >> 153 { >> 154 fpTrackingManager = trackingManager; >> 155 } 103 156 104 bool GetComputeTimeStep() const; << 157 protected: >> 158 void ExtractTimeStepperData(); 105 159 106 public: << 160 /** Copy constructor 107 const G4Track* GetTrack() const; << 161 * \param other Object to copy from >> 162 */ >> 163 G4ITModelProcessor(const G4ITModelProcessor& other); >> 164 /** Assignment operator >> 165 * \param other Object to assign from >> 166 * \return A reference to this >> 167 */ >> 168 G4ITModelProcessor& operator=(const G4ITModelProcessor& other); >> 169 >> 170 //_____________________________ >> 171 // Members >> 172 >> 173 G4double fTSTimeStep; >> 174 G4ITReactionSet* fReactionSet; >> 175 G4ITTrackingManager* fpTrackingManager; >> 176 G4ITTrackHolder* fpTrackContainer; >> 177 >> 178 G4bool fInitialized; >> 179 G4ITModelHandler* fpModelHandler; >> 180 >> 181 const G4Track* fpTrack; >> 182 G4double fUserMinTimeStep; >> 183 >> 184 // Interactions between different IT types >> 185 // eg : electron/proton >> 186 std::vector<std::vector<G4VITStepModel*> > fCurrentModel; >> 187 >> 188 // Interactions between ITs of the same type >> 189 // eg : molecule/molecule or electron/electron >> 190 G4VITStepModel* fpModel; >> 191 G4ITModelManager* fpModelManager; 108 192 109 protected: << 193 G4ITType fCurrentType1; 110 void SetTrack(const G4Track*); << 194 G4ITType fCurrentType2; 111 195 112 G4double fTSTimeStep; << 196 std::vector<G4ITReactionChange*> fReactionInfo; 113 G4ITReactionSet* fReactionSet; << 114 G4ITTrackingManager* fpTrackingManager; << 115 G4ITTrackHolder* fpTrackContainer; << 116 197 117 G4bool fInitialized; << 198 bool fComputeTimeStep; 118 G4ITModelHandler* fpModelHandler; << 199 bool fComputeReaction; >> 200 }; 119 201 120 const G4Track* fpTrack; << 202 /// 121 G4double fUserMinTimeStep; << 203 // Inline methods >> 204 /// 122 205 123 std::vector<G4VITStepModel*> fActiveModels << 206 inline void G4ITModelProcessor::SetTrack(const G4Track* track) 124 G4VITStepModel* fpActiveModelWithMinTimeSt << 207 { >> 208 fpTrack = track; >> 209 } 125 210 126 std::vector<std::unique_ptr<G4ITReactionCh << 211 inline const std::vector<std::vector<G4VITStepModel*> >* G4ITModelProcessor::GetCurrentModel() >> 212 { >> 213 return &fCurrentModel; >> 214 } 127 215 128 bool fComputeTimeStep; << 216 inline void G4ITModelProcessor::SetModelHandler(G4ITModelHandler* modelHandler) 129 bool fComputeReaction; << 217 { 130 }; << 218 if (fInitialized == 1) >> 219 { >> 220 G4ExceptionDescription exceptionDescription; >> 221 exceptionDescription >> 222 << "You are trying to set a new model while the model processor has alreaday be initialized"; >> 223 G4Exception("G4ITModelProcessor::SetModelHandler", "ITModelProcessor001", >> 224 FatalErrorInArgument, exceptionDescription); >> 225 } >> 226 fpModelHandler = modelHandler; >> 227 } 131 228 >> 229 inline void G4ITModelProcessor::CleanProcessor() >> 230 { >> 231 fpTrack = 0; >> 232 } >> 233 #endif // G4ITMODELPROCESSOR_H 132 234