Geant4.10
 All Data Structures 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 74551 2013-10-14 12:59:14Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // WARNING : This class is released as a prototype.
31 // It might strongly evolve or even disapear in the next releases.
32 //
33 // History:
34 // -----------
35 // 10 Oct 2011 M.Karamitros created
36 //
37 // -------------------------------------------------------------------
38 
39 #ifndef G4ITMODELPROCESSOR_H
40 #define G4ITMODELPROCESSOR_H
41 
42 #include <vector>
43 #include "G4ITReactionChange.hh"
44 #include "G4ITType.hh"
45 #include "G4ITModelHandler.hh"
46 
47 class G4VITTimeStepper;
50 
52 
53  /**
54  * The G4ITModelProcessor will call the two processes defined in G4VITModel.
55  * This processes act at the beginning and end of each step.
56  * The first one, the TimeStepper will calculate a time step to propagate all
57  * the track and eventually it can return some tracks that can likely react
58  * at the end of the step.
59  * The second one, the ReactionProcess will make the tracks reacting.
60  */
61 
63 {
64 public:
66  virtual ~G4ITModelProcessor();
67 
68  inline void SetModelHandler(G4ITModelHandler*);
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  }
109 
110 
111 protected:
112  /** Copy constructor
113  * \param other Object to copy from
114  */
116  /** Assignment operator
117  * \param other Object to assign from
118  * \return A reference to this
119  */
121 
122  //_____________________________
123  // Members
126 
127  const G4Track* fpTrack;
129 
130  // Attributes for interaction between many IT types
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
138 // G4double fNextTimeChangeModel ;
139 
142 
143  // Atribute for reactions
144  std::vector<G4ITReactionChange*> fReactionInfo ;
145  static G4ThreadLocal std::map<const G4Track*, G4bool> *fHasReacted;
146 };
147 
148 ///
149 // Inline methods
150 ///
151 
152 inline void G4ITModelProcessor::SetTrack(const G4Track* track)
153 {
154  fpTrack = track;
155 }
156 
157 inline const std::vector<std::vector<G4VITModel*> >* G4ITModelProcessor::GetCurrentModel()
158 {
159  return &fCurrentModel ;
160 }
161 
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 
175 {
176  fpTrack = 0;
177 }
178 #endif // G4ITMODELPROCESSOR_H
static G4ThreadLocal std::map< const G4Track *, G4bool > * fHasReacted
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void SetTrack(const G4Track *)
std::vector< G4ITReactionChange * > fReactionInfo
const std::vector< std::vector< G4VITModel * > > * GetCurrentModel()
void CalculateTimeStep(const G4Track *, const G4double)
#define G4ThreadLocal
Definition: tls.hh:52
bool G4bool
Definition: G4Types.hh:79
G4ReferenceCountedHandle< std::vector< G4Track * > > G4TrackVectorHandle
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)
G4ITModelManager * fpModelManager
void FindReaction(std::map< G4Track *, G4TrackVectorHandle > *, const double currentStepTime, const double previousStepTime, const bool reachedUserStepTimeLimit)
void InitializeStepper(const G4double &currentGlobalTime, const G4double &userMinTime)
const G4Track * fpTrack
void SetModelHandler(G4ITModelHandler *)
double G4double
Definition: G4Types.hh:76
std::vector< std::vector< G4VITModel * > > fCurrentModel
G4ITModelHandler * fpModelHandler