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