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