[1197] | 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 | // $Id: G4AdjointSteppingAction.hh,v 1.3 2009/11/20 14:24:34 ldesorgh Exp $ |
---|
[1337] | 27 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[1197] | 28 | // |
---|
| 29 | ///////////////////////////////////////////////////////////////////////////////// |
---|
| 30 | // Class Name: G4AdjointSteppingAction |
---|
| 31 | // Author: L. Desorgher |
---|
| 32 | // Contract: ESA contract 21435/08/NL/AT |
---|
| 33 | // Organisation: SpaceIT GmbH |
---|
| 34 | // Customer: ESA/ESTEC |
---|
| 35 | ///////////////////////////////////////////////////////////////////////////////// |
---|
| 36 | // |
---|
| 37 | // CHANGE HISTORY |
---|
| 38 | // -------------- |
---|
| 39 | // ChangeHistory: |
---|
| 40 | // -15/01/2007 Creation by L. Desorgher |
---|
| 41 | // -01/11/2009 Some cleaning and adding of documentation for the first Release in the Geant4 toolkit, L. Desorgher |
---|
| 42 | // -04/11/2009 Adding the possibility to use user stepping action, L. Desorgher |
---|
| 43 | // -20/11/2009 Correct the stop of adjoint particles tracking when it reenters the adjoint source. |
---|
| 44 | // |
---|
| 45 | // |
---|
| 46 | //------------------------------------------------------------- |
---|
| 47 | // Documentation: |
---|
| 48 | // Stepping action used in the adjoint simulation. |
---|
| 49 | // It is responsible to stop the adjoint tracking phase when: |
---|
| 50 | // -a)The adjoint track reaches the external surface. |
---|
| 51 | // -b)The being tracked adjoint dynamic particle get an energy higher than the maximum energy of the external source. |
---|
| 52 | // -c)The adjoint track enters the volume delimited by the adjoint source. |
---|
| 53 | // In the case a) the info (energy,weight,...) of the adjoint dynamic particle associated to the track |
---|
| 54 | // when crossing the external source is registered and in the next event a forward primary is generated. In the other cases b) and c) |
---|
| 55 | // The next generated fwd particle is killed before being tracked and the next tracking of an adjoint particle is started directly. |
---|
| 56 | // |
---|
| 57 | |
---|
| 58 | #ifndef G4AdjointSteppingAction_h |
---|
| 59 | #define G4AdjointSteppingAction_h 1 |
---|
| 60 | |
---|
| 61 | #include "G4UserSteppingAction.hh" |
---|
| 62 | #include "globals.hh" |
---|
| 63 | #include "G4ThreeVector.hh" |
---|
| 64 | |
---|
| 65 | class G4AdjointCrossSurfChecker; |
---|
| 66 | class G4ParticleDefinition; |
---|
| 67 | |
---|
| 68 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 69 | |
---|
| 70 | class G4AdjointSteppingAction : public G4UserSteppingAction |
---|
| 71 | { |
---|
| 72 | public: |
---|
| 73 | G4AdjointSteppingAction(); |
---|
| 74 | ~G4AdjointSteppingAction(); |
---|
| 75 | |
---|
| 76 | void UserSteppingAction(const G4Step*); |
---|
| 77 | |
---|
| 78 | inline void SetExtSourceEMax(G4double Emax){ext_sourceEMax=Emax;} |
---|
| 79 | inline void SetStartEvent(G4bool aBool){start_event =aBool;} |
---|
| 80 | inline G4bool GetDidAdjParticleReachTheExtSource(){return did_adj_part_reach_ext_source;} |
---|
| 81 | inline G4ThreeVector GetLastMomentum(){return last_momentum;} |
---|
| 82 | inline G4ThreeVector GetLastPosition(){return last_pos;} |
---|
| 83 | inline G4double GetLastEkin(){return last_ekin;} |
---|
| 84 | inline G4double GetLastWeight(){return last_weight;} |
---|
| 85 | inline void SetPrimWeight(G4double weight){prim_weight=weight;} |
---|
| 86 | inline G4ParticleDefinition* GetLastPartDef(){return last_part_def;} |
---|
| 87 | inline void SetUserAdjointSteppingAction( G4UserSteppingAction* anAction) {theUserAdjointSteppingAction = anAction;} |
---|
| 88 | |
---|
| 89 | private: |
---|
| 90 | |
---|
| 91 | G4double ext_sourceEMax; |
---|
| 92 | G4AdjointCrossSurfChecker* theG4AdjointCrossSurfChecker; |
---|
| 93 | G4bool start_event; |
---|
| 94 | |
---|
| 95 | G4bool did_adj_part_reach_ext_source; |
---|
| 96 | G4ThreeVector last_momentum, last_pos; |
---|
| 97 | G4double last_ekin; |
---|
| 98 | G4double last_weight ; |
---|
| 99 | G4double prim_weight ; |
---|
| 100 | G4ParticleDefinition* last_part_def; |
---|
| 101 | G4UserSteppingAction* theUserAdjointSteppingAction; |
---|
| 102 | |
---|
| 103 | }; |
---|
| 104 | #endif |
---|
| 105 | |
---|