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 #ifndef G4UserStackingAction_h 00031 #define G4UserStackingAction_h 1 00032 00033 class G4StackManager; 00034 class G4Track; 00035 #include "G4ClassificationOfNewTrack.hh" 00036 00037 // class description: 00038 // 00039 // This is the base class of one of the user's optional action classes. 00040 // This class gives the hooks for G4StackManager which controls the stacks 00041 // of G4Track objects. 00042 // 00043 00044 class G4UserStackingAction 00045 { 00046 public: 00047 G4UserStackingAction(); 00048 virtual ~G4UserStackingAction(); 00049 protected: 00050 G4StackManager * stackManager; 00051 public: 00052 inline void SetStackManager(G4StackManager * value) 00053 { stackManager = value; } 00054 00055 public: // with description 00056 //--------------------------------------------------------------- 00057 // vitual methods to be implemented by user 00058 //--------------------------------------------------------------- 00059 // 00060 virtual G4ClassificationOfNewTrack 00061 ClassifyNewTrack(const G4Track* aTrack); 00062 // 00063 // Reply G4ClassificationOfNewTrack determined by the 00064 // newly coming G4Track. 00065 // 00066 // enum G4ClassificationOfNewTrack 00067 // { 00068 // fUrgent, // put into the urgent stack 00069 // fWaiting, // put into the waiting stack 00070 // fPostpone, // postpone to the next event 00071 // fKill // kill without stacking 00072 // }; 00073 // 00074 // The parent_ID of the track indicates the origin of it. 00075 // 00076 // G4int parent_ID = aTrack->get_parentID(); 00077 // 00078 // parent_ID = 0 : primary particle 00079 // > 0 : secondary particle 00080 // < 0 : postponed from the previous event 00081 // 00082 //--------------------------------------------------------------- 00083 // 00084 virtual void NewStage(); 00085 // 00086 // This method is called by G4StackManager when the urgentStack 00087 // becomes empty and contents in the waitingStack are transtered 00088 // to the urgentStack. 00089 // Note that this method is not called at the begining of each 00090 // event, but "PrepareNewEvent" is called. 00091 // 00092 // In case re-classification of the stacked tracks is needed, 00093 // use the following method to request to G4StackManager. 00094 // 00095 // stackManager->ReClassify(); 00096 // 00097 // All of the stacked tracks in the waitingStack will be re-classified 00098 // by "ClassifyNewTrack" method. 00099 // To abort current event, use the following method. 00100 // 00101 // stackManager->clear(); 00102 // 00103 // Note that this way is valid and safe only for the case it is called 00104 // from this user class. The more global way of event abortion is 00105 // 00106 // G4UImanager * UImanager = G4UImanager::GetUIpointer(); 00107 // UImanager->ApplyCommand("/event/abort"); 00108 // 00109 //--------------------------------------------------------------- 00110 // 00111 virtual void PrepareNewEvent(); 00112 // 00113 // This method is called by G4StackManager at the begining of 00114 // each event. 00115 // Be careful that the urgentStack and the waitingStack of 00116 // G4StackManager are empty at this moment, because this method 00117 // is called before accepting primary particles. Also, note that 00118 // the postponeStack of G4StackManager may have some postponed 00119 // tracks. 00120 // 00121 //--------------------------------------------------------------- 00122 00123 }; 00124 00125 #endif 00126