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 64057 2012-10-30 15:04:49Z gcosmo $ 26 // 27 // 27 // Author: Mathieu Karamitros << 28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr) 28 << 29 // The code is developed in the framework of t << 30 // << 31 // We would be very happy hearing from you, se << 32 // 29 // 33 // In order for Geant4-DNA to be maintained an << 30 // WARNING : This class is released as a prototype. 34 // article citations are crucial. << 31 // It might strongly evolve or even disapear in the next releases. 35 // If you use Geant4-DNA chemistry and you pub << 36 // in addition to the general paper on Geant4- << 37 // 32 // 38 // Int. J. Model. Simul. Sci. Comput. 1 (2010) << 33 // History: >> 34 // ----------- >> 35 // 10 Oct 2011 M.Karamitros created 39 // 36 // 40 // we would be very happy if you could please << 37 // ------------------------------------------------------------------- 41 // reference papers on chemistry: << 42 // << 43 // J. Comput. Phys. 274 (2014) 841-882 << 44 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 << 45 38 46 #pragma once << 39 #ifndef G4ITMODELPROCESSOR_H >> 40 #define G4ITMODELPROCESSOR_H 47 41 >> 42 #include <vector> 48 #include "G4ITReactionChange.hh" 43 #include "G4ITReactionChange.hh" 49 #include "G4ITType.hh" 44 #include "G4ITType.hh" 50 #include "G4ITModelHandler.hh" 45 #include "G4ITModelHandler.hh" 51 #include "G4ITStepStatus.hh" << 52 #include <vector> << 53 46 54 class G4VITTimeStepComputer; << 47 class G4VITTimeStepper; 55 class G4VITReactionProcess; 48 class G4VITReactionProcess; 56 class G4ITModelHandler; 49 class G4ITModelHandler; 57 class G4ITReactionSet; << 50 58 class G4UserTimeStepAction; << 51 typedef G4ReferenceCountedHandle< std::vector<G4Track*> > G4TrackVectorHandle; 59 class G4ITTrackingManager; << 52 60 class G4ITTrackHolder; << 53 /** 61 << 54 * The G4ITModelProcessor will call the two processes defined in G4VITModel. 62 /** << 55 * This processes act at the beginning and end of each step. 63 * The G4ITModelProcessor will call the two pr << 56 * The first one, the TimeStepper will calculate a time step to propagate all 64 * This processes act at the beginning and end << 57 * the track and eventually it can return some tracks that can likely react 65 * The first one, the TimeStepper will calcula << 58 * at the end of the step. 66 * the track and eventually it can return some << 59 * The second one, the ReactionProcess will make the tracks reacting. 67 * at the end of the step. << 60 */ 68 * The second one, the ReactionProcess will ma << 61 69 * \deprecated This class will be removed << 70 */ << 71 class G4ITModelProcessor 62 class G4ITModelProcessor 72 { 63 { 73 public: 64 public: >> 65 /** Default constructor */ 74 G4ITModelProcessor(); 66 G4ITModelProcessor(); 75 G4ITModelProcessor(const G4ITModelProcesso << 67 /** Default destructor */ 76 G4ITModelProcessor& operator=(const G4ITMo << 77 virtual ~G4ITModelProcessor(); 68 virtual ~G4ITModelProcessor(); 78 69 79 void SetModelHandler(G4ITModelHandler*); << 80 void SetTrackingManager(G4ITTrackingManage << 81 << 82 void Initialize(); << 83 << 84 void RegisterModel(double time, G4VITStepM << 85 << 86 /** Restore the original state. This metho << 87 void CleanProcessor(); << 88 << 89 G4double CalculateMinTimeStep(G4double cur << 90 G4double def << 91 70 92 void ComputeTrackReaction(G4ITStepStatus f << 71 inline void SetModelHandler(G4ITModelHandler*); 93 G4double fGlobal << 94 G4double current << 95 G4double previou << 96 G4bool reachedUs << 97 G4double fTimeTo << 98 G4UserTimeStepAc << 99 G4int fVerbose); << 100 72 101 void InitializeStepper(G4double currentGlo << 73 void Initialize(); 102 G4double userMinTim << 74 103 << 75 /** 104 bool GetComputeTimeStep() const; << 76 * Restaure original state of the modelProcessor. >> 77 * This method should be call only by the ITStepManager >> 78 */ >> 79 inline void CleanProcessor(); >> 80 >> 81 //____________________________________________________________ >> 82 // Time stepper part >> 83 void InitializeStepper(const G4double& currentGlobalTime, >> 84 const G4double& userMinTime); >> 85 protected : >> 86 >> 87 inline void SetTrack(const G4Track*); >> 88 >> 89 public : >> 90 void CalculateTimeStep(const G4Track*, const G4double); >> 91 void DoCalculateStep(); >> 92 >> 93 //____________________________________________________________ >> 94 // Reaction process part >> 95 void FindReaction(std::map<G4Track*, G4TrackVectorHandle>*, >> 96 const double currentStepTime, >> 97 const double previousStepTime, >> 98 const bool reachedUserStepTimeLimit) ; >> 99 >> 100 //____________________________________________________________ >> 101 // Get results >> 102 inline const std::vector<std::vector<G4VITModel*> >* GetCurrentModel(); >> 103 >> 104 inline std::vector<G4ITReactionChange*>* GetReactionInfo() >> 105 { >> 106 return &fReactionInfo; >> 107 } >> 108 >> 109 const G4Track* GetTrack() const >> 110 { >> 111 return fpTrack; >> 112 } 105 113 106 public: << 107 const G4Track* GetTrack() const; << 108 114 109 protected: 115 protected: 110 void SetTrack(const G4Track*); << 116 /** Copy constructor 111 << 117 * \param other Object to copy from 112 G4double fTSTimeStep; << 118 */ 113 G4ITReactionSet* fReactionSet; << 119 G4ITModelProcessor(const G4ITModelProcessor& other); 114 G4ITTrackingManager* fpTrackingManager; << 120 /** Assignment operator 115 G4ITTrackHolder* fpTrackContainer; << 121 * \param other Object to assign from >> 122 * \return A reference to this >> 123 */ >> 124 G4ITModelProcessor& operator=(const G4ITModelProcessor& other); 116 125 >> 126 //_____________________________ >> 127 // Members 117 G4bool fInitialized; 128 G4bool fInitialized; 118 G4ITModelHandler* fpModelHandler; << 129 G4ITModelHandler* fpModelHandler ; 119 130 120 const G4Track* fpTrack; 131 const G4Track* fpTrack; 121 G4double fUserMinTimeStep; 132 G4double fUserMinTimeStep; 122 133 123 std::vector<G4VITStepModel*> fActiveModels << 134 // Attributes for interaction between many IT types 124 G4VITStepModel* fpActiveModelWithMinTimeSt << 135 // eg : electron/proton >> 136 std::vector<std::vector<G4VITModel*> > fCurrentModel; >> 137 >> 138 // Attributes for interaction between one type of IT >> 139 // eg : molecule/molecule or electron/electron >> 140 G4VITModel* 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 std::map<const G4Track*, G4bool> fHasReacted; >> 150 }; 125 151 126 std::vector<std::unique_ptr<G4ITReactionCh << 152 /// >> 153 // Inline methods >> 154 /// 127 155 128 bool fComputeTimeStep; << 156 inline void G4ITModelProcessor::SetTrack(const G4Track* track) 129 bool fComputeReaction; << 157 { 130 }; << 158 fpTrack = track; >> 159 } >> 160 >> 161 inline const std::vector<std::vector<G4VITModel*> >* G4ITModelProcessor::GetCurrentModel() >> 162 { >> 163 return &fCurrentModel ; >> 164 } 131 165 >> 166 inline void G4ITModelProcessor::SetModelHandler(G4ITModelHandler* modelHandler) >> 167 { >> 168 if(fInitialized == 1) >> 169 { >> 170 G4ExceptionDescription exceptionDescription ; >> 171 exceptionDescription << "You are trying to set a new model while the model processor has alreaday be initialized"; >> 172 G4Exception("G4ITModelProcessor::SetModelHandler","ITModelProcessor001", >> 173 FatalErrorInArgument,exceptionDescription); >> 174 } >> 175 fpModelHandler = modelHandler; >> 176 } >> 177 >> 178 inline void G4ITModelProcessor::CleanProcessor() >> 179 { >> 180 fpTrack = 0; >> 181 } >> 182 #endif // G4ITMODELPROCESSOR_H 132 183