Geant4_10
G4VITProcess.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: G4VITProcess.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 G4VITProcess_H
40 #define G4VITProcess_H
41 
42 #include <G4VProcess.hh>
43 #include "AddClone_def.hh"
44 #include "G4ReferenceCast.hh"
45 
46 class G4IT ;
48 
50  inline virtual ~G4ProcessState_Lock(){;}
51 };
52 
53 #define InitProcessState(destination,source) \
54  destination(reference_cast(destination,source))
55 
63 class G4VITProcess : public G4VProcess
64 {
65 public:
66  //__________________________________
67  // Constructors & destructors
69 
70  virtual ~G4VITProcess();
71  G4VITProcess(const G4VITProcess& other);
72  G4VITProcess& operator=(const G4VITProcess& other);
73 
74  // equal opperators
75  G4int operator==(const G4VITProcess &right) const;
76  G4int operator!=(const G4VITProcess &right) const;
77 
79 
80  size_t GetProcessID() const
81  {
82  return fProcessID;
83  }
84 
86  {
87  return fpState;
88  }
89 
91  {
92  fpState = (G4ProcessState*) aProcInfo;
93  }
94 
95  //__________________________________
96  // Initialize and Save process info
97 
98  virtual void StartTracking(G4Track*);
99 
101 
103 
107  virtual void ResetNumberOfInteractionLengthLeft();
108 
109  inline G4bool ProposesTimeStep() const;
110 
111  inline static const size_t& GetMaxProcessIndex();
112 
113 protected: // with description
114 
115  void RetrieveProcessInfo();
116  void CreateInfo();
117 
118  //__________________________________
119  // Process info
120  // friend class G4TrackingInformation ;
121 
123  {
124  public:
125  G4ProcessState();
126  virtual ~G4ProcessState();
127 
129  // The flight length left for the current tracking particle
130  // in unit of "Interaction length".
131 
133  // Time left before the interaction : for at rest processes
134 
136  // The InteractionLength in the current material
137  };
138 
140 
141  inline virtual void ClearInteractionTimeLeft();
142 
143  inline virtual void ClearNumberOfInteractionLengthLeft();
144  // clear NumberOfInteractionLengthLeft
145  // !!! This method should be at the end of PostStepDoIt()
146  // !!! and AtRestDoIt
147  //_________________________________________________
148 
149 
151  { fInstantiateProcessState = flag; }
152 
153  G4bool InstantiateProcessState() { return fInstantiateProcessState; }
154 
156 
157 private :
158 
159  size_t fProcessID;
160  // During all the simulation will identify a process, so if two identical
161  // processes are created using a copy constructor they will have the same
162  // fProcessID. NOTE: due to MT, this cannot be "const".
163 
164  static /*G4ThreadLocal*/ size_t *fNbProcess;
165 
166  G4bool fInstantiateProcessState;
167  //_________________________________________________
168  // Redefine needed members and method of G4VProcess
169  G4double* theNumberOfInteractionLengthLeft;
170  G4double* currentInteractionLength;
171  G4double* theInteractionTimeLeft;
172 };
173 
175 {
177 }
178 
180 {
182 }
183 
185 {
187 }
188 
190 {
191  if(fpState)
193 
194  return -1 ;
195 }
196 
198 {
199  return fProposesTimeStep;
200 }
201 
202 inline const size_t& G4VITProcess::GetMaxProcessIndex()
203 {
204  if (!fNbProcess) fNbProcess = new size_t ( 0);
205  return *fNbProcess ;
206 }
207 #endif // G4VITProcess_H
Definition: G4IT.hh:82
virtual ~G4VITProcess()
Definition: G4VITProcess.cc:59
virtual void ClearNumberOfInteractionLengthLeft()
static const size_t & GetMaxProcessIndex()
void RetrieveProcessInfo()
#define G4IT_TO_BE_CLONED(parent_class)
Definition: AddClone_def.hh:42
virtual void ResetNumberOfInteractionLengthLeft()
G4VITProcess(const G4String &name, G4ProcessType type=fNotDefined)
Definition: G4VITProcess.cc:34
const XML_Char * name
Definition: expat.h:151
G4ProcessState * fpState
G4ProcessState_Lock * GetProcessState()
Definition: G4VITProcess.hh:85
int G4int
Definition: G4Types.hh:78
void SetInstantiateProcessState(G4bool flag)
virtual void ClearInteractionTimeLeft()
G4int operator==(const G4VITProcess &right) const
#define G4UniformRand()
Definition: Randomize.hh:87
G4VITProcess & operator=(const G4VITProcess &other)
Definition: G4VITProcess.cc:76
virtual ~G4ProcessState_Lock()
Definition: G4VITProcess.hh:50
bool G4bool
Definition: G4Types.hh:79
virtual void StartTracking(G4Track *)
Definition: G4VITProcess.cc:83
G4double GetInteractionTimeLeft()
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4bool fProposesTimeStep
G4bool InstantiateProcessState()
G4int operator!=(const G4VITProcess &right) const
double G4double
Definition: G4Types.hh:76
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4bool ProposesTimeStep() const
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
void CreateInfo()
G4ProcessType