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