[816] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4UserStackingAction.hh,v 1.6 2006/06/29 18:09:19 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | |
---|
| 31 | #ifndef G4UserStackingAction_h |
---|
| 32 | #define G4UserStackingAction_h 1 |
---|
| 33 | |
---|
| 34 | class G4StackManager; |
---|
| 35 | class G4Track; |
---|
| 36 | #include "G4ClassificationOfNewTrack.hh" |
---|
| 37 | |
---|
| 38 | // class description: |
---|
| 39 | // |
---|
| 40 | // This is the base class of one of the user's optional action classes. |
---|
| 41 | // This class gives the hooks for G4StackManager which controls the stacks |
---|
| 42 | // of G4Track objects. |
---|
| 43 | // |
---|
| 44 | |
---|
| 45 | class G4UserStackingAction |
---|
| 46 | { |
---|
| 47 | public: |
---|
| 48 | G4UserStackingAction(); |
---|
| 49 | virtual ~G4UserStackingAction(); |
---|
| 50 | protected: |
---|
| 51 | G4StackManager * stackManager; |
---|
| 52 | public: |
---|
| 53 | inline void SetStackManager(G4StackManager * value) |
---|
| 54 | { stackManager = value; } |
---|
| 55 | |
---|
| 56 | public: // with description |
---|
| 57 | //--------------------------------------------------------------- |
---|
| 58 | // vitual methods to be implemented by user |
---|
| 59 | //--------------------------------------------------------------- |
---|
| 60 | // |
---|
| 61 | virtual G4ClassificationOfNewTrack |
---|
| 62 | ClassifyNewTrack(const G4Track* aTrack); |
---|
| 63 | // |
---|
| 64 | // Reply G4ClassificationOfNewTrack determined by the |
---|
| 65 | // newly coming G4Track. |
---|
| 66 | // |
---|
| 67 | // enum G4ClassificationOfNewTrack |
---|
| 68 | // { |
---|
| 69 | // fUrgent, // put into the urgent stack |
---|
| 70 | // fWaiting, // put into the waiting stack |
---|
| 71 | // fPostpone, // postpone to the next event |
---|
| 72 | // fKill // kill without stacking |
---|
| 73 | // }; |
---|
| 74 | // |
---|
| 75 | // The parent_ID of the track indicates the origin of it. |
---|
| 76 | // |
---|
| 77 | // G4int parent_ID = aTrack->get_parentID(); |
---|
| 78 | // |
---|
| 79 | // parent_ID = 0 : primary particle |
---|
| 80 | // > 0 : secondary particle |
---|
| 81 | // < 0 : postponed from the previous event |
---|
| 82 | // |
---|
| 83 | //--------------------------------------------------------------- |
---|
| 84 | // |
---|
| 85 | virtual void NewStage(); |
---|
| 86 | // |
---|
| 87 | // This method is called by G4StackManager when the urgentStack |
---|
| 88 | // becomes empty and contents in the waitingStack are transtered |
---|
| 89 | // to the urgentStack. |
---|
| 90 | // Note that this method is not called at the begining of each |
---|
| 91 | // event, but "PrepareNewEvent" is called. |
---|
| 92 | // |
---|
| 93 | // In case re-classification of the stacked tracks is needed, |
---|
| 94 | // use the following method to request to G4StackManager. |
---|
| 95 | // |
---|
| 96 | // stackManager->ReClassify(); |
---|
| 97 | // |
---|
| 98 | // All of the stacked tracks in the waitingStack will be re-classified |
---|
| 99 | // by "ClassifyNewTrack" method. |
---|
| 100 | // To abort current event, use the following method. |
---|
| 101 | // |
---|
| 102 | // stackManager->clear(); |
---|
| 103 | // |
---|
| 104 | // Note that this way is valid and safe only for the case it is called |
---|
| 105 | // from this user class. The more global way of event abortion is |
---|
| 106 | // |
---|
| 107 | // G4UImanager * UImanager = G4UImanager::GetUIpointer(); |
---|
| 108 | // UImanager->ApplyCommand("/event/abort"); |
---|
| 109 | // |
---|
| 110 | //--------------------------------------------------------------- |
---|
| 111 | // |
---|
| 112 | virtual void PrepareNewEvent(); |
---|
| 113 | // |
---|
| 114 | // This method is called by G4StackManager at the begining of |
---|
| 115 | // each event. |
---|
| 116 | // Be careful that the urgentStack and the waitingStack of |
---|
| 117 | // G4StackManager are empty at this moment, because this method |
---|
| 118 | // is called before accepting primary particles. Also, note that |
---|
| 119 | // the postponeStack of G4StackManager may have some postponed |
---|
| 120 | // tracks. |
---|
| 121 | // |
---|
| 122 | //--------------------------------------------------------------- |
---|
| 123 | |
---|
| 124 | }; |
---|
| 125 | |
---|
| 126 | #endif |
---|
| 127 | |
---|