Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4UserStackingAction
0027 //
0028 // Class description:
0029 //
0030 // This is the base class of one of the user's optional action classes.
0031 // This class gives the hooks for G4StackManager which controls the stacks
0032 // of G4Track objects
0033 
0034 // Author: Makoto Asai (SLAC)
0035 // --------------------------------------------------------------------
0036 #ifndef G4UserStackingAction_hh
0037 #define G4UserStackingAction_hh 1
0038 
0039 #include "G4ClassificationOfNewTrack.hh"
0040 
0041 class G4StackManager;
0042 class G4Track;
0043 
0044 class G4UserStackingAction 
0045 {
0046   public:
0047 
0048     G4UserStackingAction();
0049     virtual ~G4UserStackingAction() = default;
0050 
0051     inline void SetStackManager(G4StackManager* value) { stackManager=value; }
0052 
0053     // ---------------------------------------------------------------
0054     //  vitual methods to be implemented by user
0055     // ---------------------------------------------------------------
0056 
0057     virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
0058       //
0059       // Reply G4ClassificationOfNewTrack determined by the newly
0060       // coming G4Track.
0061       //
0062       //    enum G4ClassificationOfNewTrack
0063       //    {
0064       //      fUrgent,    // put into the urgent stack
0065       //      fWaiting,   // put into the waiting stack
0066       //      fPostpone,  // postpone to the next event
0067       //      fKill       // kill without stacking
0068       //    }
0069       //
0070       // The parent_ID of the track indicates the origin of it:
0071       //                
0072       //    G4int parent_ID = aTrack->get_parentID();
0073       //   
0074       //    parent_ID = 0 : primary particle
0075       //              > 0 : secondary particle
0076       //              < 0 : postponed from the previous event
0077 
0078     virtual void NewStage();
0079       //
0080       // This method is called by G4StackManager when the urgentStack
0081       // becomes empty and contents in the waitingStack are transferred
0082       // to the urgentStack.
0083       // Note that this method is not called at the begining of each
0084       // event, but "PrepareNewEvent()" is called.
0085       //
0086       // In case re-classification of the stacked tracks is needed,
0087       // use the following method to request to G4StackManager:
0088       //
0089       //    stackManager->ReClassify();
0090       //
0091       // All of the stacked tracks in the waitingStack will be re-classified 
0092       // by "ClassifyNewTrack()" method.
0093       // To abort current event, use the following method:
0094       //
0095       //    stackManager->clear();
0096       //
0097       // Note that this way is valid and safe only for the case it is called
0098       // from this user class. The more global way of event abortion is:
0099       //
0100       //    G4UImanager * UImanager = G4UImanager::GetUIpointer();
0101       //    UImanager->ApplyCommand("/event/abort");
0102 
0103     virtual void PrepareNewEvent();
0104       //
0105       // This method is called by G4StackManager at the beginning of
0106       // each event.
0107       // Be careful that the 'urgentStack' and the 'waitingStack' of 
0108       // G4StackManager are empty at this moment, because this method
0109       // is called before accepting primary particles. Also, note that
0110       // the 'postponeStack' of G4StackManager may have some postponed
0111       // tracks.
0112 
0113   protected:
0114 
0115     G4StackManager* stackManager = nullptr; // Not owned
0116 };
0117 
0118 #endif