G4FastStep.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 //---------------------------------------------------------------
00031 //
00032 //  G4FastStep.hh
00033 //
00034 //  Description:
00035 //    The G4FastStep class insures a friendly interface
00036 //    to manage the primary/secondaries final state for 
00037 //    Fast Simulation Models. This includes final states of parent
00038 //    particle (normalized direction of the momentum, energy, etc) and 
00039 //    secondary particles generated by the parameterisation.
00040 //
00041 //    The G4FastStep class acts also as the G4ParticleChange
00042 //    for the Fast Simulation Process. So it inherites from 
00043 //    the G4VParticleChange class and redefines the four virtual 
00044 //    methods :
00045 //
00046 //     virtual G4Step* UpdateStepForAtRest(G4Step* Step);
00047 //     virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
00048 //     virtual G4Step* UpdateStepForPostStep(G4Step* Step);
00049 //     virtual void Initialize(const G4Track&);
00050 //
00051 //  History:
00052 //    Oct 97: Verderi && MoraDeFreitas - First Implementation.
00053 //    Dec 97: Verderi - ForceSteppingHitInvocation(),
00054 //                      Set/GetTotalEnergyDeposited() methods.
00055 //    Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange
00056 //                      for the Fast Simulation Process.
00057 //    Nov 04: Verderi - Add ProposeXXX methods. SetXXX ones are kept
00058 //                      for backward compatibility. 
00059 //
00060 //---------------------------------------------------------------
00061 
00062 
00063 #ifndef G4FastStep_h
00064 #define G4FastStep_h
00065 
00066 #include "globals.hh"
00067 #include "G4ios.hh"
00068 #include "G4ThreeVector.hh"
00069 #include "G4ParticleMomentum.hh"
00070 class G4DynamicParticle;
00071 #include "G4VParticleChange.hh"
00072 #include "G4FastTrack.hh"
00073 
00074 //-------------------------------------------
00075 //
00076 //        G4FastStep class
00077 //
00078 //-------------------------------------------
00079 
00080 // Class Description:
00081 //  The final state of the particles after parameterisation has to be returned through a G4FastStep 
00082 //  reference. This final state is described as "requests" the tracking will apply after your 
00083 //  parameterisation has been invoked.
00084 //
00085 //  To facilitate the developers work, changes of position/normalized direction of the 
00086 //  momentum/polarization can be specified in the local coordinate system of the envelope or in the 
00087 //  global one.
00088 //  The default is local system coordinates.
00089 //
00090 
00091 class G4FastStep: public G4VParticleChange
00092 {
00093 public: // with Description
00094   void KillPrimaryTrack();
00095   // Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal
00096   // used by the stepping.
00097 
00098   // -- Methods used to change the position, normalized direction of 
00099   // the momentum, time etc... of the primary.
00100   // .. space and time:
00101   void ProposePrimaryTrackFinalPosition (const G4ThreeVector &, 
00102                                          G4bool localCoordinates = true);
00103   // Set the primary track final position.
00104   void     SetPrimaryTrackFinalPosition (const G4ThreeVector &, 
00105                                          G4bool localCoordinates = true);
00106   // Set the primary track final position -- maintained for backward compatibility.
00107   
00108   
00109   void ProposePrimaryTrackFinalTime (G4double);
00110   // Set the primary track final time.
00111   void    SetPrimaryTrackFinalTime (G4double);
00112   // Set the primary track final time -- maintained for backward compatibility.
00113 
00114 
00115   void ProposePrimaryTrackFinalProperTime (G4double);
00116   // Set the primary final track Proper Time.
00117   void     SetPrimaryTrackFinalProperTime (G4double);
00118   // Set the primary final track Proper Time -- maintained for backward compatibility.
00119 
00120 
00121   // .. dynamics:
00122   void ProposePrimaryTrackFinalMomentumDirection (const G4ThreeVector &, 
00123                                                   G4bool localCoordinates = true);
00124   // Be careful: the Track Final Momentum means the normalized direction 
00125   // of the momentum!
00126   void     SetPrimaryTrackFinalMomentum          (const G4ThreeVector &, 
00127                                                   G4bool localCoordinates = true);
00128   // Set the primary track final momentum -- maintained for backward compatibility. Same as ProposePrimaryTrackMomentumDirection(...)
00129 
00130 
00131   void ProposePrimaryTrackFinalKineticEnergy (G4double);
00132   // Set the primary track final kinetic energy.
00133   void     SetPrimaryTrackFinalKineticEnergy (G4double);
00134   // Set the primary track final kinetic energy-- maintained for backward compatibility.
00135 
00136 
00137   void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double, 
00138                                                          const G4ThreeVector &, 
00139                                                          G4bool localCoordinates 
00140                                                          = true);
00141   // Set the primary track final kinetic energy and direction.
00142   void     SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, 
00143                                                          const G4ThreeVector &, 
00144                                                          G4bool localCoordinates 
00145                                                          = true);
00146   // Set the primary track final kinetic energy and direction -- maintained for backward compatibility.
00147 
00148 
00149 
00150   void ProposePrimaryTrackFinalPolarization(const G4ThreeVector &, 
00151                                             G4bool localCoordinates = true);
00152   // Set the primary track final polarization.
00153   void     SetPrimaryTrackFinalPolarization(const G4ThreeVector &, 
00154                                             G4bool localCoordinates = true);
00155   // Set the primary track final polarization.
00156 
00157 
00158   void ProposePrimaryTrackPathLength (G4double);
00159   // Set the true path length of the primary track during the step.
00160   void     SetPrimaryTrackPathLength (G4double);
00161   // Set the true path length of the primary track during the step -- maintained for backward compatibility.
00162 
00163   void ProposePrimaryTrackFinalEventBiasingWeight (G4double);
00164   // Set the weight applied for event biasing mechanism.
00165   void     SetPrimaryTrackFinalEventBiasingWeight (G4double);
00166   // Set the weight applied for event biasing mechanism -- kept for backward compatibility.
00167 
00168   // ------------------------------
00169   // -- Management of secondaries:
00170   // ------------------------------
00171 
00172   // ----------------------------------------------------
00173   // -- The creation of secondaries is Done in two steps:
00174   // --      1) Give the total number of secondaries
00175   // --         that the FastStep returns
00176   // --         to the tracking using:
00177   // --         SetNumberOfSecondaryTracks()
00178   // --
00179   // --      2) Invoke the CreateSecondaryTrack() method
00180   // --         to create one secondary at each time.
00181   // ----------------------------------------------------
00182 
00183   // -- Total Number of secondaries to be created,
00184   // -- (to be called first)
00185   void SetNumberOfSecondaryTracks(G4int);
00186   // Set the total number of secondaries that will be created.
00187 
00188   // -- Number of secondaries effectively stored:
00189   // -- (incremented at each CreateSecondaryTrack()
00190   // -- call)
00191   G4int GetNumberOfSecondaryTracks();
00192   // Returns the number of secondaries effectively stored.
00193 
00194   // -- Create a secondary: the arguments are:
00195   // --     * G4DynamicsParticle: see header file, many constructors exist
00196   // --                           (allow to set particle type + energy + 
00197   // -- the normalized direction of momentum...)
00198   // --     * G4ThreeVector     : Polarization (not in G4ParticleChange constructor)
00199   // --     * G4ThreeVector     : Position
00200   // --     * G4double          : Time
00201   // --     * G4bool            : says if Position/Momentum are given in the
00202   // --                           local coordinate system (true by default)
00203   // -- Returned value: pointer to the track created.
00204   G4Track* CreateSecondaryTrack(const G4DynamicParticle&,
00205                                 G4ThreeVector,
00206                                 G4ThreeVector,
00207                                 G4double,
00208                                 G4bool localCoordinates=true);
00209   // Create a secondary. The arguments are:
00210   // 
00211   //   G4DynamicsParticle: see the G4DynamicsParticle reference, many constructors exist
00212   //                       (allow to set particle type + energy + the normalized direction of 
00213   //                       momentum...);
00214   //   G4ThreeVector     : Polarization;
00215   //   G4ThreeVector     : Position;
00216   //   G4double          : Time;
00217   //   G4bool            : says if Position/Momentum are given in the local envelope coordinate 
00218   //                       system (true by default).
00219   //
00220   // Returned value: pointer to the track created.
00221   //
00222   
00223   //-- Create a secondary: the difference with he above declaration
00224   //-- is that the Polarization is not given and is assumed already set
00225   //-- in the G4DynamicParticle.
00226   //-- Returned value: pointer to the track created
00227   G4Track* CreateSecondaryTrack(const G4DynamicParticle&,
00228                                 G4ThreeVector,
00229                                 G4double,
00230                                 G4bool localCoordinates=true);
00231   //  Create a secondary. The difference with he above declaration is that the Polarization is not 
00232   //  given and is assumed already set in the G4DynamicParticle.
00233   //
00234   //  Returned value: pointer to the track created
00235 
00236   
00237 
00238   G4Track* GetSecondaryTrack(G4int);
00239   // Returns a pointer on the i-th secondary track created.
00240 
00241   //------------------------------------------------
00242   //
00243   //   Total energy deposit in the "fast Step"
00244   //   (a default should be provided in future,
00245   //    which can be:
00246   //      delta energy of primary -
00247   //      energy of the secondaries)
00248   //   This allow the user to Store a consistent
00249   //   information in the G4Trajectory.
00250   //
00251   //------------------------------------------------
00252    void ProposeTotalEnergyDeposited(G4double anEnergyPart);
00253   // Set the total energy deposited.
00254   void      SetTotalEnergyDeposited(G4double anEnergyPart);
00255   // Set the total energy deposited -- kept for backward compatibility.
00256   // It should be the delta energy of primary less the energy of the secondaries.
00257 
00258   G4double GetTotalEnergyDeposited() const;
00259   // Returns the total energy deposited.
00260 
00261   void ForceSteppingHitInvocation();
00262   // Control of the stepping manager Hit invocation.
00263   //
00264   // In a usual parameterisation, the control of the hits production is under the user
00265   // responsability in his G4VFastSimulationModel (he generally produces several hits at once.)
00266   //
00267   // However, in the particular case the G4FastSimulation user's model acts as the physics
00268   // replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful
00269   // G4Step), the user can delegate to the G4SteppingManager the responsability to invoke
00270   // the Hit()method of the current sensitive if any.
00271   //
00272   // By default, the G4SteppingManager is asked to NOT invoke this Hit() method when parameterisation
00273   // is invoked.
00274   //   
00275 
00276 
00277 public: // Without description
00278   //=======================================================
00279   // Implementation section and kernel interfaces.
00280   //=======================================================
00281   //------------------------
00282   // Constructor/Destructor
00283   //------------------------
00284   G4FastStep();
00285   virtual ~G4FastStep();
00286   
00287   // equal/unequal operator
00288   G4bool operator==(const G4FastStep &right) const;
00289   G4bool operator!=(const G4FastStep &right) const;
00290 
00291 protected:
00292   // hide copy constructor and assignment operator as protected
00293   G4FastStep (const G4FastStep &right);
00294   G4FastStep & operator= (const G4FastStep &right);
00295 
00296 public:
00297   // ===============================================
00298   // Stepping interface.
00299   // ===============================================
00300   // --- the following methods are for updating G4Step -----   
00301   // Return the pointer to the G4Step after updating the Step information
00302   // by using final state information of the track given by a Model.
00303   //
00304   // The Fast Simulation Mechanism doesn't change the track's final 
00305   // state on the AlongDoIt loop, so the default one all we need.
00306   //virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
00307 
00308   G4Step* UpdateStepForAtRest(G4Step* Step);
00309   G4Step* UpdateStepForPostStep(G4Step* Step);
00310 
00311   // A Model gives the final state of the particle 
00312   // based on information of G4FastTrack. So the
00313   // Initialize method is an interface to the 
00314   // G4FastSimulationManager to Initialize the 
00315   // G4FastStep.
00316 
00317   void Initialize(const G4FastTrack&);
00318 
00319 private:
00320   //===================================================
00321   // Private Internal methods (implementation).
00322   //===================================================
00323 
00324   // G4FastStep should never be Initialized in this way
00325   // but we must define it to avoid compiler warnings.
00326   void Initialize(const G4Track&);
00327 
00328   //  -- Utility functions --
00329   //--- methods to keep information of the final state--
00330   //  IMPORTANT NOTE: Although the name of the class and methods are
00331   //   "Change", what it stores (and returns in get) are the "FINAL" 
00332   //   values of the Position, the normalized direction of Momentum, 
00333   //   etc.
00334   
00335   // Set theMomentumChange vector: it is the final unitary momentum 
00336   // direction.
00337   void SetMomentumChange(G4double Px, G4double Py, G4double Pz);
00338   void SetMomentumChange(const G4ThreeVector& Pfinal);
00339   
00340   //=====================================================
00341   // Data members.
00342   //=====================================================
00343   //  theMomentumChange is the vector containing the final momentum 
00344   //  direction after the invoked process. The application of the change
00345   //  of the momentum direction of the particle is not Done here.
00346   //  The responsibility to apply the change is up the entity
00347   //  which invoked the process.
00348   G4ParticleMomentum theMomentumChange;
00349 
00350   //  The changed (final) polarization of a given particle.
00351   G4ThreeVector thePolarizationChange;
00352 
00353   //  The final kinetic energy of the current particle.
00354   G4double theEnergyChange;
00355 
00356   //  The changed (final) position of a given particle.
00357   G4ThreeVector thePositionChange;
00358 
00359   //  The changed (final) global time of a given particle.
00360   G4double theTimeChange;
00361 
00362   //  The changed (final) proper time of a given particle.
00363   G4double theProperTimeChange;
00364 
00365   // The reference G4FastTrack
00366   const G4FastTrack* fFastTrack;
00367 
00368   // weight for event biasing mechanism:
00369   G4double theWeightChange;
00370 
00371 
00372 public:
00373   // for Debug 
00374   void DumpInfo() const;
00375   G4bool CheckIt(const G4Track&);
00376 };
00377 
00378 //*******************************************************************
00379 //
00380 //  Inline functions
00381 //
00382 //*******************************************************************
00383 
00384 #include "G4FastStep.icc"
00385 
00386 #endif

Generated on Mon May 27 17:48:15 2013 for Geant4 by  doxygen 1.4.7