[819] | 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 | // |
---|
[1055] | 27 | // $Id: G4HadronicInteraction.hh,v 1.9 2009/01/24 11:56:27 vnivanch Exp $ |
---|
| 28 | // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $ |
---|
[819] | 29 | // |
---|
[1055] | 30 | // Hadronic Interaction abstract base class |
---|
| 31 | // This class is the base class for the model classes. |
---|
| 32 | // It sorts out the energy-range for the models and provides |
---|
| 33 | // class utilities. |
---|
| 34 | // original by H.P. Wellisch |
---|
| 35 | // Modified by J.L.Chuma, TRIUMF, 21-Mar-1997 |
---|
| 36 | // Last modified: 3-Apr-1997 |
---|
| 37 | // Added units to energy initialization: J.L. Chuma 04-Apr-97 |
---|
| 38 | // Modified by J.L.Chuma, 05-May-97 to Initialize theBlockedCounter |
---|
| 39 | // Modified by J.L.Chuma, 08-Jul-97 to implement the Nucleus changes |
---|
| 40 | // Adding a registry for memory management of hadronic models, HPW 22-Mar-99 |
---|
| 41 | // 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body |
---|
| 42 | // and reorder methods in the header |
---|
[819] | 43 | |
---|
| 44 | // Class Description |
---|
| 45 | // This is the base class for all hadronic interaction models in geant4. |
---|
[1055] | 46 | // If you want to implement a new way of producing a final state, please, |
---|
| 47 | // inherit from here. |
---|
[819] | 48 | // Class Description - End |
---|
| 49 | |
---|
| 50 | #ifndef G4HadronicInteraction_h |
---|
| 51 | #define G4HadronicInteraction_h 1 |
---|
| 52 | |
---|
| 53 | #include "G4HadFinalState.hh" |
---|
| 54 | #include "G4ReactionDynamics.hh" |
---|
| 55 | #include "G4Material.hh" |
---|
| 56 | #include "G4Nucleus.hh" |
---|
| 57 | #include "G4Track.hh" |
---|
| 58 | #include "G4HadProjectile.hh" |
---|
| 59 | |
---|
[1055] | 60 | class G4HadronicInteraction |
---|
| 61 | { |
---|
| 62 | public: // With description |
---|
| 63 | |
---|
[819] | 64 | |
---|
[1055] | 65 | G4HadronicInteraction(const G4String& modelName = "HadronicModel"); |
---|
[819] | 66 | |
---|
[1055] | 67 | virtual ~G4HadronicInteraction(); |
---|
[819] | 68 | |
---|
[1055] | 69 | virtual G4HadFinalState *ApplyYourself(const G4HadProjectile &aTrack, |
---|
| 70 | G4Nucleus & targetNucleus ) = 0; |
---|
| 71 | // This is the interface to implement for final state production code. |
---|
| 72 | |
---|
| 73 | virtual G4bool IsApplicable(const G4HadProjectile &/*aTrack*/, |
---|
| 74 | G4Nucleus & /*targetNucleus*/) |
---|
| 75 | { return true;} |
---|
| 76 | |
---|
| 77 | inline G4double GetMinEnergy() const |
---|
| 78 | { return theMinEnergy; } |
---|
[819] | 79 | |
---|
[1055] | 80 | virtual G4double GetMinEnergy( const G4Material *aMaterial, |
---|
| 81 | const G4Element *anElement ) const; |
---|
| 82 | |
---|
| 83 | inline void SetMinEnergy( const G4double anEnergy ) |
---|
| 84 | { theMinEnergy = anEnergy; } |
---|
[819] | 85 | |
---|
[1055] | 86 | virtual void SetMinEnergy( G4double anEnergy, G4Element *anElement ); |
---|
[819] | 87 | |
---|
[1055] | 88 | virtual void SetMinEnergy( G4double anEnergy, G4Material *aMaterial ); |
---|
[819] | 89 | |
---|
[1055] | 90 | inline G4double GetMaxEnergy() const |
---|
| 91 | { return theMaxEnergy; } |
---|
[819] | 92 | |
---|
[1055] | 93 | virtual G4double GetMaxEnergy( const G4Material *aMaterial, |
---|
| 94 | const G4Element *anElement ) const; |
---|
[819] | 95 | |
---|
[1055] | 96 | inline void SetMaxEnergy( const G4double anEnergy ) |
---|
| 97 | { theMaxEnergy = anEnergy; } |
---|
[819] | 98 | |
---|
[1055] | 99 | virtual void SetMaxEnergy( G4double anEnergy, G4Element *anElement ); |
---|
[819] | 100 | |
---|
[1055] | 101 | virtual void SetMaxEnergy( G4double anEnergy, G4Material *aMaterial ); |
---|
[819] | 102 | |
---|
[1055] | 103 | inline const G4HadronicInteraction *GetMyPointer() const |
---|
| 104 | { return this; } |
---|
[819] | 105 | |
---|
[1055] | 106 | inline G4int GetVerboseLevel() const |
---|
| 107 | { return verboseLevel; } |
---|
[819] | 108 | |
---|
[1055] | 109 | inline void SetVerboseLevel( G4int value ) |
---|
| 110 | { verboseLevel = value; } |
---|
[819] | 111 | |
---|
[1055] | 112 | inline const G4String& GetModelName() const |
---|
| 113 | { return theModelName; } |
---|
[819] | 114 | |
---|
| 115 | public: // Without description |
---|
| 116 | |
---|
[1055] | 117 | virtual void DeActivateFor( G4Material *aMaterial ); |
---|
[819] | 118 | |
---|
[1055] | 119 | virtual void ActivateFor( G4Material *aMaterial ) |
---|
| 120 | { |
---|
| 121 | Block(); |
---|
| 122 | SetMaxEnergy(GetMaxEnergy(), aMaterial); |
---|
| 123 | SetMinEnergy(GetMinEnergy(), aMaterial); |
---|
| 124 | } |
---|
[819] | 125 | |
---|
[1055] | 126 | virtual void DeActivateFor( G4Element *anElement ); |
---|
| 127 | virtual void ActivateFor( G4Element *anElement ) |
---|
| 128 | { |
---|
| 129 | Block(); |
---|
| 130 | SetMaxEnergy(GetMaxEnergy(), anElement); |
---|
| 131 | SetMinEnergy(GetMinEnergy(), anElement); |
---|
| 132 | } |
---|
[819] | 133 | |
---|
[1055] | 134 | virtual G4bool IsBlocked( const G4Material *aMaterial ) const; |
---|
[819] | 135 | |
---|
[1055] | 136 | virtual G4bool IsBlocked( const G4Element *anElement) const; |
---|
| 137 | |
---|
| 138 | inline G4bool operator==(const G4HadronicInteraction &right ) const |
---|
| 139 | { return ( this == (G4HadronicInteraction *) &right ); } |
---|
[819] | 140 | |
---|
[1055] | 141 | inline G4bool operator!=(const G4HadronicInteraction &right ) const |
---|
| 142 | { return ( this != (G4HadronicInteraction *) &right ); } |
---|
[819] | 143 | |
---|
[1055] | 144 | private: |
---|
[819] | 145 | |
---|
[1055] | 146 | G4HadronicInteraction(const G4HadronicInteraction &right ); |
---|
[819] | 147 | |
---|
[1055] | 148 | const G4HadronicInteraction& operator=(const G4HadronicInteraction &right); |
---|
| 149 | |
---|
| 150 | protected: |
---|
| 151 | |
---|
| 152 | inline G4bool IsBlocked() const { return isBlocked;} |
---|
| 153 | inline void Block() { isBlocked = true; } |
---|
[819] | 154 | |
---|
[1055] | 155 | G4HadFinalState theParticleChange; |
---|
| 156 | // the G4HadFinalState object which is modified and returned |
---|
| 157 | // by address by the ApplyYourself method, |
---|
| 158 | // (instead of aParticleChange as found in G4VProcess) |
---|
[819] | 159 | |
---|
[1055] | 160 | G4int verboseLevel; |
---|
| 161 | // control flag for output messages |
---|
| 162 | // 0: silent |
---|
| 163 | // 1: warning messages |
---|
| 164 | // 2: more |
---|
| 165 | // (instead of verboseLevel as found in G4VProcess) |
---|
[819] | 166 | |
---|
[1055] | 167 | G4ReactionDynamics theReactionDynamics; |
---|
| 168 | |
---|
| 169 | // these two have global validity |
---|
| 170 | // units are assumed to be MeV |
---|
| 171 | |
---|
| 172 | G4double theMinEnergy; |
---|
| 173 | G4double theMaxEnergy; |
---|
| 174 | |
---|
| 175 | G4bool isBlocked; |
---|
[819] | 176 | |
---|
[1055] | 177 | G4String theModelName; |
---|
[819] | 178 | |
---|
[1055] | 179 | private: |
---|
[819] | 180 | |
---|
[1055] | 181 | std::vector<std::pair<G4double, G4Material *> > theMinEnergyList; |
---|
| 182 | std::vector<std::pair<G4double, G4Material *> > theMaxEnergyList; |
---|
| 183 | std::vector<std::pair<G4double, G4Element *> > theMinEnergyListElements; |
---|
| 184 | std::vector<std::pair<G4double, G4Element *> > theMaxEnergyListElements; |
---|
| 185 | std::vector<G4Material *> theBlockedList; |
---|
| 186 | std::vector<G4Element *> theBlockedListElements; |
---|
| 187 | }; |
---|
[819] | 188 | |
---|
| 189 | #endif |
---|