Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ITModelProcessor.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4ITModelProcessor.hh 100802 2016-11-02 14:55:27Z gcosmo $
27 //
28 // Author: Mathieu Karamitros
29 
30 // The code is developed in the framework of the ESA AO7146
31 //
32 // We would be very happy hearing from you, send us your feedback! :)
33 //
34 // In order for Geant4-DNA to be maintained and still open-source,
35 // article citations are crucial.
36 // If you use Geant4-DNA chemistry and you publish papers about your software,
37 // in addition to the general paper on Geant4-DNA:
38 //
39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
40 //
41 // we would be very happy if you could please also cite the following
42 // reference papers on chemistry:
43 //
44 // J. Comput. Phys. 274 (2014) 841-882
45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
46 
47 #ifndef G4ITMODELPROCESSOR_H
48 #define G4ITMODELPROCESSOR_H
49 
50 #include <vector>
51 #include "G4ITReactionChange.hh"
52 #include "G4ITType.hh"
53 #include "G4ITModelHandler.hh"
54 #include "G4ITStepStatus.hh"
55 
58 class G4ITModelHandler;
59 class G4ITReactionSet;
62 class G4ITTrackHolder;
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 
84 {
85 public:
87  virtual ~G4ITModelProcessor();
88 
89  inline void SetModelHandler(G4ITModelHandler*);
90  void Initialize();
91  //void Initialize(G4MIWorkspace* /*workspace*/);
92 
93  void RegisterModel(double time, G4VITStepModel*);
94 
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 
119  {
120  return fComputeTimeStep;
121  }
122 
123 protected:
124 
125  inline void SetTrack(const G4Track*);
126 
127 public:
128  void CalculateTimeStep(const G4Track*, const G4double);
129  void DoCalculateStep();
130 
131  //____________________________________________________________
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 
153  {
154  fpTrackingManager = trackingManager;
155  }
156 
157 protected:
158  void ExtractTimeStepperData();
159 
169 
170  //_____________________________
171  // Members
172 
177 
180 
181  const G4Track* fpTrack;
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
192 
195 
196  std::vector<G4ITReactionChange*> fReactionInfo;
197 
200 };
201 
203 // Inline methods
205 
206 inline void G4ITModelProcessor::SetTrack(const G4Track* track)
207 {
208  fpTrack = track;
209 }
210 
211 inline const std::vector<std::vector<G4VITStepModel*> >* G4ITModelProcessor::GetCurrentModel()
212 {
213  return &fCurrentModel;
214 }
215 
217 {
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 }
228 
230 {
231  fpTrack = 0;
232 }
233 #endif // G4ITMODELPROCESSOR_H
G4ITTrackingManager * fpTrackingManager
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void SetTrackingManager(G4ITTrackingManager *trackingManager)
void SetTrack(const G4Track *)
G4VITStepModel * fpModel
std::vector< G4ITReactionChange * > fReactionInfo
std::vector< std::vector< G4VITStepModel * > > fCurrentModel
void CalculateTimeStep(const G4Track *, const G4double)
G4ITStepStatus
int G4int
Definition: G4Types.hh:78
G4double CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep)
void FindReaction(G4ITReactionSet *reactionSet, const double currentStepTime, const double previousStepTime, const bool reachedUserStepTimeLimit)
G4ITReactionSet * fReactionSet
bool G4bool
Definition: G4Types.hh:79
const std::vector< std::vector< G4VITStepModel * > > * GetCurrentModel()
const G4Track * GetTrack() const
std::vector< G4ITReactionChange * > * GetReactionInfo()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ITModelProcessor & operator=(const G4ITModelProcessor &other)
void RegisterModel(double time, G4VITStepModel *)
G4ITModelManager * fpModelManager
void ComputeTrackReaction(G4ITStepStatus fITStepStatus, G4double fGlobalTime, G4double currentTimeStep, G4double previousTimeStep, G4bool reachedUserTimeLimit, G4double fTimeTolerance, G4UserTimeStepAction *fpUserTimeStepAction, G4int fVerbose)
void InitializeStepper(G4double currentGlobalTime, G4double userMinTime)
const G4Track * fpTrack
void SetModelHandler(G4ITModelHandler *)
double G4double
Definition: G4Types.hh:76
G4ITModelHandler * fpModelHandler
G4ITTrackHolder * fpTrackContainer