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 90769 2015-06-09 10:33:41Z gcosmo $ 26 // 27 // 27 // Author: Mathieu Karamitros << 28 // Author: Mathieu Karamitros, kara@cenbg.in2p3.fr 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" << 52 #include <vector> << 53 54 54 class G4VITTimeStepComputer; 55 class G4VITTimeStepComputer; 55 class G4VITReactionProcess; 56 class G4VITReactionProcess; 56 class G4ITModelHandler; 57 class G4ITModelHandler; 57 class G4ITReactionSet; 58 class G4ITReactionSet; 58 class G4UserTimeStepAction; << 59 59 class G4ITTrackingManager; << 60 //#ifndef compTrackPerID__ 60 class G4ITTrackHolder; << 61 //#define compTrackPerID__ >> 62 // struct compTrackPerID >> 63 // { >> 64 // bool operator()(G4Track* rhs, G4Track* lhs) const >> 65 // { >> 66 // return rhs->GetTrackID() < lhs->GetTrackID(); >> 67 // } >> 68 // }; >> 69 //#endif 61 70 62 /** 71 /** 63 * The G4ITModelProcessor will call the two pr 72 * The G4ITModelProcessor will call the two processes defined in G4VITModel. 64 * This processes act at the beginning and end 73 * This processes act at the beginning and end of each step. 65 * The first one, the TimeStepper will calcula 74 * The first one, the TimeStepper will calculate a time step to propagate all 66 * the track and eventually it can return some 75 * the track and eventually it can return some tracks that can likely react 67 * at the end of the step. 76 * at the end of the step. 68 * The second one, the ReactionProcess will ma 77 * The second one, the ReactionProcess will make the tracks reacting. 69 * \deprecated This class will be removed << 70 */ 78 */ 71 class G4ITModelProcessor 79 class G4ITModelProcessor 72 { 80 { 73 public: 81 public: 74 G4ITModelProcessor(); << 82 G4ITModelProcessor(); 75 G4ITModelProcessor(const G4ITModelProcesso << 83 virtual ~G4ITModelProcessor(); 76 G4ITModelProcessor& operator=(const G4ITMo << 77 virtual ~G4ITModelProcessor(); << 78 << 79 void SetModelHandler(G4ITModelHandler*); << 80 void SetTrackingManager(G4ITTrackingManage << 81 << 82 void Initialize(); << 83 84 84 void RegisterModel(double time, G4VITStepM << 85 inline void SetModelHandler(G4ITModelHandler*); >> 86 void Initialize(); 85 87 86 /** Restore the original state. This metho << 88 /** 87 void CleanProcessor(); << 89 * Restaure original state of the modelProcessor. 88 << 90 * This method should be call only by the G4Scheduler 89 G4double CalculateMinTimeStep(G4double cur << 91 */ 90 G4double def << 92 inline void CleanProcessor(); 91 << 93 92 void ComputeTrackReaction(G4ITStepStatus f << 94 //____________________________________________________________ 93 G4double fGlobal << 95 // Time stepper part 94 G4double current << 96 void InitializeStepper(const G4double& currentGlobalTime, 95 G4double previou << 97 const G4double& userMinTime); 96 G4bool reachedUs << 98 protected: 97 G4double fTimeTo << 98 G4UserTimeStepAc << 99 G4int fVerbose); << 100 << 101 void InitializeStepper(G4double currentGlo << 102 G4double userMinTim << 103 99 104 bool GetComputeTimeStep() const; << 100 inline void SetTrack(const G4Track*); 105 101 106 public: 102 public: 107 const G4Track* GetTrack() const; << 103 void CalculateTimeStep(const G4Track*, const G4double); >> 104 void DoCalculateStep(); 108 105 109 protected: << 106 //____________________________________________________________ 110 void SetTrack(const G4Track*); << 107 // Reaction process part 111 << 108 void FindReaction(G4ITReactionSet* reactionSet, 112 G4double fTSTimeStep; << 109 const double currentStepTime, 113 G4ITReactionSet* fReactionSet; << 110 const double previousStepTime, 114 G4ITTrackingManager* fpTrackingManager; << 111 const bool reachedUserStepTimeLimit); 115 G4ITTrackHolder* fpTrackContainer; << 112 >> 113 //____________________________________________________________ >> 114 // Get results >> 115 inline const std::vector<std::vector<G4VITStepModel*> >* GetCurrentModel(); >> 116 >> 117 inline std::vector<G4ITReactionChange*>* GetReactionInfo() >> 118 { >> 119 return &fReactionInfo; >> 120 } >> 121 >> 122 const G4Track* GetTrack() const >> 123 { >> 124 return fpTrack; >> 125 } 116 126 117 G4bool fInitialized; << 127 protected: 118 G4ITModelHandler* fpModelHandler; << 128 /** Copy constructor >> 129 * \param other Object to copy from >> 130 */ >> 131 G4ITModelProcessor(const G4ITModelProcessor& other); >> 132 /** Assignment operator >> 133 * \param other Object to assign from >> 134 * \return A reference to this >> 135 */ >> 136 G4ITModelProcessor& operator=(const G4ITModelProcessor& other); >> 137 >> 138 //_____________________________ >> 139 // Members >> 140 G4bool fInitialized; >> 141 G4ITModelHandler* fpModelHandler; >> 142 >> 143 const G4Track* fpTrack; >> 144 G4double fUserMinTimeStep; >> 145 >> 146 // Attributes for interaction between many IT types >> 147 // eg : electron/proton >> 148 std::vector<std::vector<G4VITStepModel*> > fCurrentModel; >> 149 >> 150 // Attributes for interaction between one type of IT >> 151 // eg : molecule/molecule or electron/electron >> 152 G4VITStepModel* fpModel; >> 153 G4ITModelManager* fpModelManager; >> 154 // G4double fNextTimeChangeModel ; >> 155 >> 156 G4ITType fCurrentType1; >> 157 G4ITType fCurrentType2; >> 158 >> 159 // Atribute for reactions >> 160 std::vector<G4ITReactionChange*> fReactionInfo; >> 161 static G4ThreadLocal std::map<const G4Track*, G4bool> *fHasReacted; >> 162 }; 119 163 120 const G4Track* fpTrack; << 164 /// 121 G4double fUserMinTimeStep; << 165 // Inline methods >> 166 /// 122 167 123 std::vector<G4VITStepModel*> fActiveModels << 168 inline void G4ITModelProcessor::SetTrack(const G4Track* track) 124 G4VITStepModel* fpActiveModelWithMinTimeSt << 169 { >> 170 fpTrack = track; >> 171 } 125 172 126 std::vector<std::unique_ptr<G4ITReactionCh << 173 inline const std::vector<std::vector<G4VITStepModel*> >* G4ITModelProcessor::GetCurrentModel() >> 174 { >> 175 return &fCurrentModel; >> 176 } 127 177 128 bool fComputeTimeStep; << 178 inline void G4ITModelProcessor::SetModelHandler(G4ITModelHandler* modelHandler) 129 bool fComputeReaction; << 179 { 130 }; << 180 if (fInitialized == 1) >> 181 { >> 182 G4ExceptionDescription exceptionDescription; >> 183 exceptionDescription >> 184 << "You are trying to set a new model while the model processor has alreaday be initialized"; >> 185 G4Exception("G4ITModelProcessor::SetModelHandler", "ITModelProcessor001", >> 186 FatalErrorInArgument, exceptionDescription); >> 187 } >> 188 fpModelHandler = modelHandler; >> 189 } 131 190 >> 191 inline void G4ITModelProcessor::CleanProcessor() >> 192 { >> 193 fpTrack = 0; >> 194 } >> 195 #endif // G4ITMODELPROCESSOR_H 132 196