Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:32:35

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 // G4TrackingManager
0027 //
0028 // Class description:
0029 //
0030 // This is an interface class between the event, the track and the tracking
0031 // categories. It handles necessary message passing between the upper
0032 // hierarchical object, which is the event manager (G4EventManager), and
0033 // lower hierarchical objects in the tracking category. It receives one track
0034 // in an  event from the event manager and takes care to finish tracking it.
0035 // Used exclusively by the Geant4 kernel.
0036 
0037 // Contact:
0038 //   Questions and comments to this code should be sent to
0039 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
0040 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
0041 //---------------------------------------------------------------
0042 #ifndef G4TrackingManager_hh
0043 #define G4TrackingManager_hh 1
0044 
0045 #include "G4StepStatus.hh"  // Include from 'tracking'
0046 #include "G4SteppingManager.hh"  // Include from 'tracking'
0047 #include "G4Track.hh"  // Include from 'tracking'
0048 #include "G4TrackStatus.hh"  // Include from 'tracking'
0049 #include "G4TrackVector.hh"  // Include from 'tracking'
0050 #include "G4TrackingMessenger.hh"
0051 #include "G4UserSteppingAction.hh"  // Include from 'tracking'
0052 #include "G4UserTrackingAction.hh"  // Include from 'tracking'
0053 #include "G4VTrajectory.hh"  // Include from 'tracking'
0054 #include "globals.hh"  // Include from 'global'
0055 
0056 class G4VUserTrackInformation;
0057 
0058 ////////////////////////
0059 class G4TrackingManager
0060 ////////////////////////
0061 {
0062  public:
0063   // Constructor/Destructor
0064 
0065   // G4TrackingManger should be dynamically allocated, therefore you
0066   // need to invoke new() when you call this constructor.
0067   // G4SteppingManger and G4UserTrackingAction will be created
0068   // in this constructor. "This" pointer will be passed to
0069   // G4UserTrackingAction.
0070   G4TrackingManager();
0071   ~G4TrackingManager();
0072 
0073   // Get/Set functions
0074 
0075   G4Track* GetTrack() const;
0076 
0077   G4int GetStoreTrajectory() const;
0078   void SetStoreTrajectory(G4int value);
0079 
0080   G4SteppingManager* GetSteppingManager() const;
0081 
0082   G4UserTrackingAction* GetUserTrackingAction() const;
0083 
0084   G4VTrajectory* GimmeTrajectory() const;
0085   void SetTrajectory(G4VTrajectory* aTrajectory);
0086 
0087   G4TrackVector* GimmeSecondaries() const;
0088 
0089   void SetUserAction(G4UserTrackingAction* apAction);
0090   void SetUserAction(G4UserSteppingAction* apAction);
0091 
0092   void SetVerboseLevel(G4int vLevel);
0093   G4int GetVerboseLevel() const;
0094 
0095   // Other member functions
0096 
0097   void ProcessOneTrack(G4Track* apValueG4Track);
0098   // Invoking this function, a G4Track given by the argument
0099   // will be tracked.
0100 
0101   void EventAborted();
0102   // Invoking this function, the current tracking will be
0103   // aborted immediately. The tracking will return the
0104   // G4TrackStatus in 'fUserKillTrackAndSecondaries'.
0105   // By this the EventManager deletes the current track and all
0106   // its associated secondaries.
0107 
0108   void SetUserTrackInformation(G4VUserTrackInformation* aValue);
0109   // This method can be invoked from the user's G4UserTrackingAction
0110   // implementation to set his/her own G4VUserTrackInformation concrete
0111   // class object to a G4Track object.
0112 
0113  private:
0114   void TrackBanner();  // verbose
0115 
0116   // Member data
0117 
0118   G4Track* fpTrack = nullptr;
0119   G4SteppingManager* fpSteppingManager = nullptr;
0120   G4UserTrackingAction* fpUserTrackingAction = nullptr;
0121   G4VTrajectory* fpTrajectory = nullptr;
0122   G4int StoreTrajectory = 0;
0123   G4int verboseLevel = 0;
0124   G4TrackingMessenger* messenger = nullptr;
0125   G4bool EventIsAborted = false;
0126 };
0127 
0128 //*******************************************************************
0129 //
0130 //  Inline function
0131 //
0132 //*******************************************************************
0133 
0134 inline G4Track* G4TrackingManager::GetTrack() const { return fpTrack; }
0135 
0136 inline G4int G4TrackingManager::GetStoreTrajectory() const { return StoreTrajectory; }
0137 
0138 inline void G4TrackingManager::SetStoreTrajectory(G4int value) { StoreTrajectory = value; }
0139 
0140 inline G4SteppingManager* G4TrackingManager::GetSteppingManager() const
0141 {
0142   return fpSteppingManager;
0143 }
0144 
0145 inline G4UserTrackingAction* G4TrackingManager::GetUserTrackingAction() const
0146 {
0147   return fpUserTrackingAction;
0148 }
0149 
0150 inline G4VTrajectory* G4TrackingManager::GimmeTrajectory() const { return fpTrajectory; }
0151 
0152 inline G4TrackVector* G4TrackingManager::GimmeSecondaries() const
0153 {
0154   return fpSteppingManager->GetfSecondary();
0155 }
0156 
0157 inline void G4TrackingManager::SetUserAction(G4UserTrackingAction* apAction)
0158 {
0159   fpUserTrackingAction = apAction;
0160   if (apAction != nullptr) {
0161     apAction->SetTrackingManagerPointer(this);
0162   }
0163 }
0164 
0165 inline void G4TrackingManager::SetUserAction(G4UserSteppingAction* apAction)
0166 {
0167   fpSteppingManager->SetUserAction(apAction);
0168   if (apAction != nullptr) {
0169     apAction->SetSteppingManagerPointer(fpSteppingManager);
0170   }
0171 }
0172 
0173 inline void G4TrackingManager::SetVerboseLevel(G4int vLevel)
0174 {
0175   verboseLevel = vLevel;
0176   fpSteppingManager->SetVerboseLevel(vLevel);
0177 }
0178 
0179 inline G4int G4TrackingManager::GetVerboseLevel() const { return verboseLevel; }
0180 
0181 inline void G4TrackingManager::SetUserTrackInformation(G4VUserTrackInformation* aValue)
0182 {
0183   if (fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
0184 }
0185 
0186 #endif