Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:46

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // TrackingManagerHelper
0027 //
0028 // Class description:
0029 //
0030 // Helper class for reducing the effort required to implement a custom tracking
0031 // manager. It implements a stepping loop that calls user actions as the generic
0032 // tracking and stepping managers do, and it implements navigation for charged
0033 // particles in energy-preserving fields and for neutral particles.
0034 //
0035 // Original author: Jonas Hahnfeld, 2021
0036 
0037 #ifndef TrackingManagerHelper_hh
0038 #define TrackingManagerHelper_hh 1
0039 
0040 #include "G4TrackVector.hh"
0041 #include "globals.hh"
0042 
0043 class G4Step;
0044 class G4Track;
0045 
0046 class TrackingManagerHelper
0047 {
0048   public:
0049     class Physics
0050     {
0051       public:
0052         virtual void StartTracking(G4Track*) {}
0053         virtual void EndTracking() {}
0054 
0055         // Combines AlongStep and PostStep; the implementation needs to remember
0056         // the right value to pass as previousStepSize to G4VProcess.
0057         virtual G4double GetPhysicalInteractionLength(const G4Track& track) = 0;
0058 
0059         // This method is called for every step after navigation. The updated
0060         // position is stored in the G4Step's post-step point. Any particle change
0061         // should be applied directly to the step, UpdateTrack() will be called
0062         // automatically after this method returns. If secondaries should be given
0063         // back to the G4EventManager, put them into the container passed as the
0064         // last argument.
0065         virtual void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
0066 
0067         // This method is called unless the track has been killed during this step.
0068         // If secondaries should be given back to the G4EventManager, put them into
0069         // the container passed as the last argument.
0070         virtual void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
0071 
0072         virtual bool HasAtRestProcesses() { return false; }
0073 
0074         // This method is called when a track is stopped, but still alive. If
0075         // secondaries should be given back to the G4EventManager, put them into
0076         // the container passed as the last argument.
0077         virtual void AtRestDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries)
0078         {
0079           (void)track;
0080           (void)step;
0081           (void)secondaries;
0082         }
0083     };
0084 
0085     class Navigation
0086     {
0087       public:
0088         virtual G4double MakeStep(G4Track& track, G4Step& step, G4double physicalStep) = 0;
0089 
0090         virtual void FinishStep(G4Track& track, G4Step& step) = 0;
0091     };
0092 
0093     template<typename PhysicsImpl, typename NavigationImpl>
0094     static void TrackParticle(G4Track* aTrack, PhysicsImpl& physics, NavigationImpl& navigation);
0095 
0096     template<typename PhysicsImpl>
0097     static void TrackChargedParticle(G4Track* aTrack, PhysicsImpl& physics);
0098 
0099     template<typename PhysicsImpl>
0100     static void TrackNeutralParticle(G4Track* aTrack, PhysicsImpl& physics);
0101 };
0102 
0103 #include "TrackingManagerHelper.icc"
0104 
0105 #endif