Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:13

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   using ProfilerConfig = G4Track::ProfilerConfig;
0064 
0065  public:
0066   // Constructor/Destructor
0067 
0068   // G4TrackingManger should be dynamically allocated, therefore you
0069   // need to invoke new() when you call this constructor.
0070   // G4SteppingManger and G4UserTrackingAction will be created
0071   // in this constructor. "This" pointer will be passed to
0072   // G4UserTrackingAction.
0073   G4TrackingManager();
0074   ~G4TrackingManager();
0075 
0076   // Get/Set functions
0077 
0078   G4Track* GetTrack() const;
0079 
0080   G4int GetStoreTrajectory() const;
0081   void SetStoreTrajectory(G4int value);
0082 
0083   G4SteppingManager* GetSteppingManager() const;
0084 
0085   G4UserTrackingAction* GetUserTrackingAction() const;
0086 
0087   G4VTrajectory* GimmeTrajectory() const;
0088   void SetTrajectory(G4VTrajectory* aTrajectory);
0089 
0090   G4TrackVector* GimmeSecondaries() const;
0091 
0092   void SetUserAction(G4UserTrackingAction* apAction);
0093   void SetUserAction(G4UserSteppingAction* apAction);
0094 
0095   void SetVerboseLevel(G4int vLevel);
0096   G4int GetVerboseLevel() const;
0097 
0098   // Other member functions
0099 
0100   void ProcessOneTrack(G4Track* apValueG4Track);
0101   // Invoking this function, a G4Track given by the argument
0102   // will be tracked.
0103 
0104   void EventAborted();
0105   // Invoking this function, the current tracking will be
0106   // aborted immediately. The tracking will return the
0107   // G4TrackStatus in 'fUserKillTrackAndSecondaries'.
0108   // By this the EventManager deletes the current track and all
0109   // its associated secondaries.
0110 
0111   void SetUserTrackInformation(G4VUserTrackInformation* aValue);
0112   // This method can be invoked from the user's G4UserTrackingAction
0113   // implementation to set his/her own G4VUserTrackInformation concrete
0114   // class object to a G4Track object.
0115 
0116  private:
0117   void TrackBanner();  // verbose
0118 
0119   // Member data
0120 
0121   G4Track* fpTrack = nullptr;
0122   G4SteppingManager* fpSteppingManager = nullptr;
0123   G4UserTrackingAction* fpUserTrackingAction = nullptr;
0124   G4VTrajectory* fpTrajectory = nullptr;
0125   G4int StoreTrajectory = 0;
0126   G4int verboseLevel = 0;
0127   G4TrackingMessenger* messenger = nullptr;
0128   G4bool EventIsAborted = false;
0129 };
0130 
0131 //*******************************************************************
0132 //
0133 //  Inline function
0134 //
0135 //*******************************************************************
0136 
0137 inline G4Track* G4TrackingManager::GetTrack() const { return fpTrack; }
0138 
0139 inline G4int G4TrackingManager::GetStoreTrajectory() const { return StoreTrajectory; }
0140 
0141 inline void G4TrackingManager::SetStoreTrajectory(G4int value) { StoreTrajectory = value; }
0142 
0143 inline G4SteppingManager* G4TrackingManager::GetSteppingManager() const
0144 {
0145   return fpSteppingManager;
0146 }
0147 
0148 inline G4UserTrackingAction* G4TrackingManager::GetUserTrackingAction() const
0149 {
0150   return fpUserTrackingAction;
0151 }
0152 
0153 inline G4VTrajectory* G4TrackingManager::GimmeTrajectory() const { return fpTrajectory; }
0154 
0155 inline G4TrackVector* G4TrackingManager::GimmeSecondaries() const
0156 {
0157   return fpSteppingManager->GetfSecondary();
0158 }
0159 
0160 inline void G4TrackingManager::SetUserAction(G4UserTrackingAction* apAction)
0161 {
0162   fpUserTrackingAction = apAction;
0163   if (apAction != nullptr) {
0164     apAction->SetTrackingManagerPointer(this);
0165   }
0166 }
0167 
0168 inline void G4TrackingManager::SetUserAction(G4UserSteppingAction* apAction)
0169 {
0170   fpSteppingManager->SetUserAction(apAction);
0171   if (apAction != nullptr) {
0172     apAction->SetSteppingManagerPointer(fpSteppingManager);
0173   }
0174 }
0175 
0176 inline void G4TrackingManager::SetVerboseLevel(G4int vLevel)
0177 {
0178   verboseLevel = vLevel;
0179   fpSteppingManager->SetVerboseLevel(vLevel);
0180 }
0181 
0182 inline G4int G4TrackingManager::GetVerboseLevel() const { return verboseLevel; }
0183 
0184 inline void G4TrackingManager::SetUserTrackInformation(G4VUserTrackInformation* aValue)
0185 {
0186   if (fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
0187 }
0188 
0189 #endif