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 | // |
---|
27 | // $Id: G4FastStep.hh,v 1.8 2006/06/29 21:09:14 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
29 | // |
---|
30 | // |
---|
31 | //--------------------------------------------------------------- |
---|
32 | // |
---|
33 | // G4FastStep.hh |
---|
34 | // |
---|
35 | // Description: |
---|
36 | // The G4FastStep class insures a friendly interface |
---|
37 | // to manage the primary/secondaries final state for |
---|
38 | // Fast Simulation Models. This includes final states of parent |
---|
39 | // particle (normalized direction of the momentum, energy, etc) and |
---|
40 | // secondary particles generated by the parameterisation. |
---|
41 | // |
---|
42 | // The G4FastStep class acts also as the G4ParticleChange |
---|
43 | // for the Fast Simulation Process. So it inherites from |
---|
44 | // the G4VParticleChange class and redefines the four virtual |
---|
45 | // methods : |
---|
46 | // |
---|
47 | // virtual G4Step* UpdateStepForAtRest(G4Step* Step); |
---|
48 | // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); |
---|
49 | // virtual G4Step* UpdateStepForPostStep(G4Step* Step); |
---|
50 | // virtual void Initialize(const G4Track&); |
---|
51 | // |
---|
52 | // History: |
---|
53 | // Oct 97: Verderi && MoraDeFreitas - First Implementation. |
---|
54 | // Dec 97: Verderi - ForceSteppingHitInvocation(), |
---|
55 | // Set/GetTotalEnergyDeposited() methods. |
---|
56 | // Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange |
---|
57 | // for the Fast Simulation Process. |
---|
58 | // Nov 04: Verderi - Add ProposeXXX methods. SetXXX ones are kept |
---|
59 | // for backward compatibility. |
---|
60 | // |
---|
61 | //--------------------------------------------------------------- |
---|
62 | |
---|
63 | |
---|
64 | #ifndef G4FastStep_h |
---|
65 | #define G4FastStep_h |
---|
66 | |
---|
67 | #include "globals.hh" |
---|
68 | #include "G4ios.hh" |
---|
69 | #include "G4ThreeVector.hh" |
---|
70 | #include "G4ParticleMomentum.hh" |
---|
71 | class G4DynamicParticle; |
---|
72 | #include "G4VParticleChange.hh" |
---|
73 | #include "G4FastTrack.hh" |
---|
74 | |
---|
75 | //------------------------------------------- |
---|
76 | // |
---|
77 | // G4FastStep class |
---|
78 | // |
---|
79 | //------------------------------------------- |
---|
80 | |
---|
81 | // Class Description: |
---|
82 | // The final state of the particles after parameterisation has to be returned through a G4FastStep |
---|
83 | // reference. This final state is described as "requests" the tracking will apply after your |
---|
84 | // parameterisation has been invoked. |
---|
85 | // |
---|
86 | // To facilitate the developers work, changes of position/normalized direction of the |
---|
87 | // momentum/polarization can be specified in the local coordinate system of the envelope or in the |
---|
88 | // global one. |
---|
89 | // The default is local system coordinates. |
---|
90 | // |
---|
91 | |
---|
92 | class G4FastStep: public G4VParticleChange |
---|
93 | { |
---|
94 | public: // with Description |
---|
95 | void KillPrimaryTrack(); |
---|
96 | // Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal |
---|
97 | // used by the stepping. |
---|
98 | |
---|
99 | // -- Methods used to change the position, normalized direction of |
---|
100 | // the momentum, time etc... of the primary. |
---|
101 | // .. space and time: |
---|
102 | void ProposePrimaryTrackFinalPosition (const G4ThreeVector &, |
---|
103 | G4bool localCoordinates = true); |
---|
104 | // Set the primary track final position. |
---|
105 | void SetPrimaryTrackFinalPosition (const G4ThreeVector &, |
---|
106 | G4bool localCoordinates = true); |
---|
107 | // Set the primary track final position -- maintained for backward compatibility. |
---|
108 | |
---|
109 | |
---|
110 | void ProposePrimaryTrackFinalTime (G4double); |
---|
111 | // Set the primary track final time. |
---|
112 | void SetPrimaryTrackFinalTime (G4double); |
---|
113 | // Set the primary track final time -- maintained for backward compatibility. |
---|
114 | |
---|
115 | |
---|
116 | void ProposePrimaryTrackFinalProperTime (G4double); |
---|
117 | // Set the primary final track Proper Time. |
---|
118 | void SetPrimaryTrackFinalProperTime (G4double); |
---|
119 | // Set the primary final track Proper Time -- maintained for backward compatibility. |
---|
120 | |
---|
121 | |
---|
122 | // .. dynamics: |
---|
123 | void ProposePrimaryTrackFinalMomentumDirection (const G4ThreeVector &, |
---|
124 | G4bool localCoordinates = true); |
---|
125 | // Be careful: the Track Final Momentum means the normalized direction |
---|
126 | // of the momentum! |
---|
127 | void SetPrimaryTrackFinalMomentum (const G4ThreeVector &, |
---|
128 | G4bool localCoordinates = true); |
---|
129 | // Set the primary track final momentum -- maintained for backward compatibility. Same as ProposePrimaryTrackMomentumDirection(...) |
---|
130 | |
---|
131 | |
---|
132 | void ProposePrimaryTrackFinalKineticEnergy (G4double); |
---|
133 | // Set the primary track final kinetic energy. |
---|
134 | void SetPrimaryTrackFinalKineticEnergy (G4double); |
---|
135 | // Set the primary track final kinetic energy-- maintained for backward compatibility. |
---|
136 | |
---|
137 | |
---|
138 | void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double, |
---|
139 | const G4ThreeVector &, |
---|
140 | G4bool localCoordinates |
---|
141 | = true); |
---|
142 | // Set the primary track final kinetic energy and direction. |
---|
143 | void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, |
---|
144 | const G4ThreeVector &, |
---|
145 | G4bool localCoordinates |
---|
146 | = true); |
---|
147 | // Set the primary track final kinetic energy and direction -- maintained for backward compatibility. |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | void ProposePrimaryTrackFinalPolarization(const G4ThreeVector &, |
---|
152 | G4bool localCoordinates = true); |
---|
153 | // Set the primary track final polarization. |
---|
154 | void SetPrimaryTrackFinalPolarization(const G4ThreeVector &, |
---|
155 | G4bool localCoordinates = true); |
---|
156 | // Set the primary track final polarization. |
---|
157 | |
---|
158 | |
---|
159 | void ProposePrimaryTrackPathLength (G4double); |
---|
160 | // Set the true path length of the primary track during the step. |
---|
161 | void SetPrimaryTrackPathLength (G4double); |
---|
162 | // Set the true path length of the primary track during the step -- maintained for backward compatibility. |
---|
163 | |
---|
164 | void ProposePrimaryTrackFinalEventBiasingWeight (G4double); |
---|
165 | // Set the weight applied for event biasing mechanism. |
---|
166 | void SetPrimaryTrackFinalEventBiasingWeight (G4double); |
---|
167 | // Set the weight applied for event biasing mechanism -- kept for backward compatibility. |
---|
168 | |
---|
169 | // ------------------------------ |
---|
170 | // -- Management of secondaries: |
---|
171 | // ------------------------------ |
---|
172 | |
---|
173 | // ---------------------------------------------------- |
---|
174 | // -- The creation of secondaries is Done in two steps: |
---|
175 | // -- 1) Give the total number of secondaries |
---|
176 | // -- that the FastStep returns |
---|
177 | // -- to the tracking using: |
---|
178 | // -- SetNumberOfSecondaryTracks() |
---|
179 | // -- |
---|
180 | // -- 2) Invoke the CreateSecondaryTrack() method |
---|
181 | // -- to create one secondary at each time. |
---|
182 | // ---------------------------------------------------- |
---|
183 | |
---|
184 | // -- Total Number of secondaries to be created, |
---|
185 | // -- (to be called first) |
---|
186 | void SetNumberOfSecondaryTracks(G4int); |
---|
187 | // Set the total number of secondaries that will be created. |
---|
188 | |
---|
189 | // -- Number of secondaries effectively stored: |
---|
190 | // -- (incremented at each CreateSecondaryTrack() |
---|
191 | // -- call) |
---|
192 | G4int GetNumberOfSecondaryTracks(); |
---|
193 | // Returns the number of secondaries effectively stored. |
---|
194 | |
---|
195 | // -- Create a secondary: the arguments are: |
---|
196 | // -- * G4DynamicsParticle: see header file, many constructors exist |
---|
197 | // -- (allow to set particle type + energy + |
---|
198 | // -- the normalized direction of momentum...) |
---|
199 | // -- * G4ThreeVector : Polarization (not in G4ParticleChange constructor) |
---|
200 | // -- * G4ThreeVector : Position |
---|
201 | // -- * G4double : Time |
---|
202 | // -- * G4bool : says if Position/Momentum are given in the |
---|
203 | // -- local coordinate system (true by default) |
---|
204 | // -- Returned value: pointer to the track created. |
---|
205 | G4Track* CreateSecondaryTrack(const G4DynamicParticle&, |
---|
206 | G4ThreeVector, |
---|
207 | G4ThreeVector, |
---|
208 | G4double, |
---|
209 | G4bool localCoordinates=true); |
---|
210 | // Create a secondary. The arguments are: |
---|
211 | // |
---|
212 | // G4DynamicsParticle: see the G4DynamicsParticle reference, many constructors exist |
---|
213 | // (allow to set particle type + energy + the normalized direction of |
---|
214 | // momentum...); |
---|
215 | // G4ThreeVector : Polarization; |
---|
216 | // G4ThreeVector : Position; |
---|
217 | // G4double : Time; |
---|
218 | // G4bool : says if Position/Momentum are given in the local envelope coordinate |
---|
219 | // system (true by default). |
---|
220 | // |
---|
221 | // Returned value: pointer to the track created. |
---|
222 | // |
---|
223 | |
---|
224 | //-- Create a secondary: the difference with he above declaration |
---|
225 | //-- is that the Polarization is not given and is assumed already set |
---|
226 | //-- in the G4DynamicParticle. |
---|
227 | //-- Returned value: pointer to the track created |
---|
228 | G4Track* CreateSecondaryTrack(const G4DynamicParticle&, |
---|
229 | G4ThreeVector, |
---|
230 | G4double, |
---|
231 | G4bool localCoordinates=true); |
---|
232 | // Create a secondary. The difference with he above declaration is that the Polarization is not |
---|
233 | // given and is assumed already set in the G4DynamicParticle. |
---|
234 | // |
---|
235 | // Returned value: pointer to the track created |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | G4Track* GetSecondaryTrack(G4int); |
---|
240 | // Returns a pointer on the i-th secondary track created. |
---|
241 | |
---|
242 | //------------------------------------------------ |
---|
243 | // |
---|
244 | // Total energy deposit in the "fast Step" |
---|
245 | // (a default should be provided in future, |
---|
246 | // which can be: |
---|
247 | // delta energy of primary - |
---|
248 | // energy of the secondaries) |
---|
249 | // This allow the user to Store a consistent |
---|
250 | // information in the G4Trajectory. |
---|
251 | // |
---|
252 | //------------------------------------------------ |
---|
253 | void ProposeTotalEnergyDeposited(G4double anEnergyPart); |
---|
254 | // Set the total energy deposited. |
---|
255 | void SetTotalEnergyDeposited(G4double anEnergyPart); |
---|
256 | // Set the total energy deposited -- kept for backward compatibility. |
---|
257 | // It should be the delta energy of primary less the energy of the secondaries. |
---|
258 | |
---|
259 | G4double GetTotalEnergyDeposited() const; |
---|
260 | // Returns the total energy deposited. |
---|
261 | |
---|
262 | void ForceSteppingHitInvocation(); |
---|
263 | // Control of the stepping manager Hit invocation. |
---|
264 | // |
---|
265 | // In a usual parameterisation, the control of the hits production is under the user |
---|
266 | // responsability in his G4VFastSimulationModel (he generally produces several hits at once.) |
---|
267 | // |
---|
268 | // However, in the particular case the G4FastSimulation user's model acts as the physics |
---|
269 | // replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful |
---|
270 | // G4Step), the user can delegate to the G4SteppingManager the responsability to invoke |
---|
271 | // the Hit()method of the current sensitive if any. |
---|
272 | // |
---|
273 | // By default, the G4SteppingManager is asked to NOT invoke this Hit() method when parameterisation |
---|
274 | // is invoked. |
---|
275 | // |
---|
276 | |
---|
277 | |
---|
278 | public: // Without description |
---|
279 | //======================================================= |
---|
280 | // Implementation section and kernel interfaces. |
---|
281 | //======================================================= |
---|
282 | //------------------------ |
---|
283 | // Constructor/Destructor |
---|
284 | //------------------------ |
---|
285 | G4FastStep(); |
---|
286 | virtual ~G4FastStep(); |
---|
287 | |
---|
288 | // equal/unequal operator |
---|
289 | G4bool operator==(const G4FastStep &right) const; |
---|
290 | G4bool operator!=(const G4FastStep &right) const; |
---|
291 | |
---|
292 | protected: |
---|
293 | // hide copy constructor and assignment operator as protected |
---|
294 | G4FastStep (const G4FastStep &right); |
---|
295 | G4FastStep & operator= (const G4FastStep &right); |
---|
296 | |
---|
297 | public: |
---|
298 | // =============================================== |
---|
299 | // Stepping interface. |
---|
300 | // =============================================== |
---|
301 | // --- the following methods are for updating G4Step ----- |
---|
302 | // Return the pointer to the G4Step after updating the Step information |
---|
303 | // by using final state information of the track given by a Model. |
---|
304 | // |
---|
305 | // The Fast Simulation Mechanism doesn't change the track's final |
---|
306 | // state on the AlongDoIt loop, so the default one all we need. |
---|
307 | //virtual G4Step* UpdateStepForAlongStep(G4Step* Step); |
---|
308 | |
---|
309 | G4Step* UpdateStepForAtRest(G4Step* Step); |
---|
310 | G4Step* UpdateStepForPostStep(G4Step* Step); |
---|
311 | |
---|
312 | // A Model gives the final state of the particle |
---|
313 | // based on information of G4FastTrack. So the |
---|
314 | // Initialize method is an interface to the |
---|
315 | // G4FastSimulationManager to Initialize the |
---|
316 | // G4FastStep. |
---|
317 | |
---|
318 | void Initialize(const G4FastTrack&); |
---|
319 | |
---|
320 | private: |
---|
321 | //=================================================== |
---|
322 | // Private Internal methods (implementation). |
---|
323 | //=================================================== |
---|
324 | |
---|
325 | // G4FastStep should never be Initialized in this way |
---|
326 | // but we must define it to avoid compiler warnings. |
---|
327 | void Initialize(const G4Track&); |
---|
328 | |
---|
329 | // -- Utility functions -- |
---|
330 | //--- methods to keep information of the final state-- |
---|
331 | // IMPORTANT NOTE: Although the name of the class and methods are |
---|
332 | // "Change", what it stores (and returns in get) are the "FINAL" |
---|
333 | // values of the Position, the normalized direction of Momentum, |
---|
334 | // etc. |
---|
335 | |
---|
336 | // Set theMomentumChange vector: it is the final unitary momentum |
---|
337 | // direction. |
---|
338 | void SetMomentumChange(G4double Px, G4double Py, G4double Pz); |
---|
339 | void SetMomentumChange(const G4ThreeVector& Pfinal); |
---|
340 | |
---|
341 | //===================================================== |
---|
342 | // Data members. |
---|
343 | //===================================================== |
---|
344 | // theMomentumChange is the vector containing the final momentum |
---|
345 | // direction after the invoked process. The application of the change |
---|
346 | // of the momentum direction of the particle is not Done here. |
---|
347 | // The responsibility to apply the change is up the entity |
---|
348 | // which invoked the process. |
---|
349 | G4ParticleMomentum theMomentumChange; |
---|
350 | |
---|
351 | // The changed (final) polarization of a given particle. |
---|
352 | G4ThreeVector thePolarizationChange; |
---|
353 | |
---|
354 | // The final kinetic energy of the current particle. |
---|
355 | G4double theEnergyChange; |
---|
356 | |
---|
357 | // The changed (final) position of a given particle. |
---|
358 | G4ThreeVector thePositionChange; |
---|
359 | |
---|
360 | // The changed (final) global time of a given particle. |
---|
361 | G4double theTimeChange; |
---|
362 | |
---|
363 | // The changed (final) proper time of a given particle. |
---|
364 | G4double theProperTimeChange; |
---|
365 | |
---|
366 | // The reference G4FastTrack |
---|
367 | const G4FastTrack* fFastTrack; |
---|
368 | |
---|
369 | // weight for event biasing mechanism: |
---|
370 | G4double theWeightChange; |
---|
371 | |
---|
372 | |
---|
373 | public: |
---|
374 | // for Debug |
---|
375 | void DumpInfo() const; |
---|
376 | G4bool CheckIt(const G4Track&); |
---|
377 | }; |
---|
378 | |
---|
379 | //******************************************************************* |
---|
380 | // |
---|
381 | // Inline functions |
---|
382 | // |
---|
383 | //******************************************************************* |
---|
384 | |
---|
385 | #include "G4FastStep.icc" |
---|
386 | |
---|
387 | #endif |
---|