[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 | // |
---|
[1007] | 27 | // $Id: G4HadronicInteraction.hh,v 1.8 2007/01/11 05:30:01 dennis Exp $ |
---|
| 28 | // GEANT4 tag $Name: geant4-09-02 $ |
---|
[819] | 29 | // |
---|
[1007] | 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 |
---|
[819] | 41 | |
---|
| 42 | // Class Description |
---|
| 43 | // This is the base class for all hadronic interaction models in geant4. |
---|
[1007] | 44 | // If you want to implement a new way of producing a final state, please inherit |
---|
| 45 | // from here. |
---|
[819] | 46 | // Class Description - End |
---|
| 47 | |
---|
| 48 | #ifndef G4HadronicInteraction_h |
---|
| 49 | #define G4HadronicInteraction_h 1 |
---|
| 50 | |
---|
| 51 | #include "G4HadFinalState.hh" |
---|
[1007] | 52 | #include "G4DynamicParticle.hh" |
---|
[819] | 53 | #include "G4ReactionDynamics.hh" |
---|
| 54 | #include "G4Material.hh" |
---|
| 55 | #include "G4Nucleus.hh" |
---|
| 56 | #include "G4Track.hh" |
---|
| 57 | #include "G4HadProjectile.hh" |
---|
[1007] | 58 | #include "G4HadronicInteractionRegistry.hh" |
---|
| 59 | #include "G4HadronicException.hh" |
---|
[819] | 60 | |
---|
[1007] | 61 | class G4HadronicInteraction |
---|
| 62 | { |
---|
| 63 | public: |
---|
[819] | 64 | |
---|
[1007] | 65 | G4HadronicInteraction(const G4String& modelName = "HadronicModel") : |
---|
| 66 | verboseLevel(0), theMinEnergy(0.0*GeV), theMaxEnergy(25.0*GeV), |
---|
| 67 | isBlocked(false), theModelName(modelName) |
---|
| 68 | { |
---|
| 69 | G4HadronicInteractionRegistry::RegisterMe(this); |
---|
| 70 | } |
---|
[819] | 71 | |
---|
[1007] | 72 | virtual ~G4HadronicInteraction() |
---|
| 73 | { |
---|
| 74 | G4HadronicInteractionRegistry::RemoveMe(this); |
---|
| 75 | } |
---|
[819] | 76 | |
---|
[1007] | 77 | private: |
---|
[819] | 78 | |
---|
[1007] | 79 | inline G4HadronicInteraction( |
---|
| 80 | const G4HadronicInteraction &right ) |
---|
| 81 | { *this = right; } |
---|
[819] | 82 | |
---|
[1007] | 83 | inline const G4HadronicInteraction & operator=( |
---|
| 84 | const G4HadronicInteraction &right ) |
---|
| 85 | { |
---|
| 86 | G4String text = "unintended use of G4HadronicInteraction::operator="; |
---|
| 87 | throw G4HadronicException(__FILE__, __LINE__, text); |
---|
| 88 | return right; |
---|
| 89 | } |
---|
[819] | 90 | |
---|
[1007] | 91 | public: |
---|
[819] | 92 | |
---|
[1007] | 93 | inline G4bool operator==( |
---|
| 94 | const G4HadronicInteraction &right ) const |
---|
| 95 | { return ( this == (G4HadronicInteraction *) &right ); } |
---|
[819] | 96 | |
---|
[1007] | 97 | inline G4bool operator!=( |
---|
| 98 | const G4HadronicInteraction &right ) const |
---|
| 99 | { return ( this != (G4HadronicInteraction *) &right ); } |
---|
[819] | 100 | |
---|
[1007] | 101 | inline G4double GetMinEnergy() const |
---|
| 102 | { return theMinEnergy; } |
---|
[819] | 103 | |
---|
[1007] | 104 | virtual G4double GetMinEnergy( const G4Material *aMaterial, |
---|
| 105 | const G4Element *anElement ) const; |
---|
[819] | 106 | |
---|
[1007] | 107 | inline void SetMinEnergy( const G4double anEnergy ) |
---|
| 108 | { theMinEnergy = anEnergy; } |
---|
| 109 | |
---|
| 110 | virtual void SetMinEnergy( G4double anEnergy, G4Element *anElement ); |
---|
| 111 | |
---|
| 112 | virtual void SetMinEnergy( G4double anEnergy, G4Material *aMaterial ); |
---|
| 113 | |
---|
| 114 | inline G4double GetMaxEnergy() const |
---|
| 115 | { return theMaxEnergy; } |
---|
| 116 | |
---|
| 117 | virtual G4double GetMaxEnergy( const G4Material *aMaterial, |
---|
| 118 | const G4Element *anElement ) const; |
---|
| 119 | |
---|
| 120 | inline void SetMaxEnergy( const G4double anEnergy ) |
---|
| 121 | { theMaxEnergy = anEnergy; } |
---|
| 122 | |
---|
| 123 | virtual void SetMaxEnergy( G4double anEnergy, G4Element *anElement ); |
---|
| 124 | |
---|
| 125 | virtual void SetMaxEnergy( G4double anEnergy, G4Material *aMaterial ); |
---|
[819] | 126 | |
---|
[1007] | 127 | inline const G4HadronicInteraction *GetMyPointer() const |
---|
| 128 | { return this; } |
---|
[819] | 129 | |
---|
[1007] | 130 | inline G4int GetVerboseLevel() const |
---|
| 131 | { return verboseLevel; } |
---|
[819] | 132 | |
---|
[1007] | 133 | inline void SetVerboseLevel( G4int value ) |
---|
| 134 | { verboseLevel = value; } |
---|
[819] | 135 | |
---|
[1007] | 136 | inline const G4String& GetModelName() const |
---|
| 137 | { return theModelName; } |
---|
| 138 | |
---|
| 139 | public: // With description |
---|
| 140 | // This is the interface to implement for final state production code. |
---|
[819] | 141 | |
---|
[1007] | 142 | virtual G4HadFinalState *ApplyYourself( |
---|
| 143 | const G4HadProjectile &aTrack, G4Nucleus & targetNucleus ) = 0; |
---|
| 144 | |
---|
[819] | 145 | public: // Without description |
---|
| 146 | |
---|
[1007] | 147 | virtual void DeActivateFor( G4Material *aMaterial ); |
---|
[819] | 148 | |
---|
[1007] | 149 | virtual void ActivateFor( G4Material *aMaterial ) |
---|
| 150 | { |
---|
| 151 | Block(); |
---|
| 152 | SetMaxEnergy(GetMaxEnergy(), aMaterial); |
---|
| 153 | SetMinEnergy(GetMinEnergy(), aMaterial); |
---|
| 154 | } |
---|
[819] | 155 | |
---|
[1007] | 156 | virtual void DeActivateFor( G4Element *anElement ); |
---|
| 157 | virtual void ActivateFor( G4Element *anElement ) |
---|
| 158 | { |
---|
| 159 | Block(); |
---|
| 160 | SetMaxEnergy(GetMaxEnergy(), anElement); |
---|
| 161 | SetMinEnergy(GetMinEnergy(), anElement); |
---|
| 162 | } |
---|
[819] | 163 | |
---|
[1007] | 164 | virtual G4bool IsBlocked( const G4Material *aMaterial ) const; |
---|
[819] | 165 | |
---|
[1007] | 166 | virtual G4bool IsBlocked( const G4Element *anElement) const; |
---|
[819] | 167 | |
---|
[1007] | 168 | virtual G4bool IsApplicable(const G4HadProjectile &/*aTrack*/, |
---|
| 169 | G4Nucleus & /*targetNucleus*/){ return true;} |
---|
| 170 | protected: |
---|
[819] | 171 | |
---|
[1007] | 172 | G4HadFinalState theParticleChange; |
---|
| 173 | // the G4HadFinalState object which is modified and returned |
---|
| 174 | // by address by the ApplyYourself method, |
---|
| 175 | // (instead of aParticleChange as found in G4VProcess) |
---|
[819] | 176 | |
---|
[1007] | 177 | G4int verboseLevel; |
---|
| 178 | // control flag for output messages |
---|
| 179 | // 0: silent |
---|
| 180 | // 1: warning messages |
---|
| 181 | // 2: more |
---|
| 182 | // (instead of verboseLevel as found in G4VProcess) |
---|
[819] | 183 | |
---|
[1007] | 184 | G4ReactionDynamics theReactionDynamics; |
---|
[819] | 185 | |
---|
[1007] | 186 | // these two have global validity |
---|
| 187 | // units are assumed to be MeV |
---|
[819] | 188 | |
---|
[1007] | 189 | G4double theMinEnergy; |
---|
| 190 | G4double theMaxEnergy; |
---|
[819] | 191 | |
---|
[1007] | 192 | G4bool IsBlocked() const { return isBlocked;} |
---|
| 193 | void Block() { isBlocked = true; } |
---|
| 194 | G4bool isBlocked; |
---|
[819] | 195 | |
---|
[1007] | 196 | G4String theModelName; |
---|
[819] | 197 | |
---|
[1007] | 198 | private: |
---|
[819] | 199 | |
---|
[1007] | 200 | std::vector<std::pair<G4double, G4Material *> > theMinEnergyList; |
---|
| 201 | std::vector<std::pair<G4double, G4Material *> > theMaxEnergyList; |
---|
| 202 | std::vector<std::pair<G4double, G4Element *> > theMinEnergyListElements; |
---|
| 203 | std::vector<std::pair<G4double, G4Element *> > theMaxEnergyListElements; |
---|
| 204 | std::vector<G4Material *> theBlockedList; |
---|
| 205 | std::vector<G4Element *> theBlockedListElements; |
---|
| 206 | }; |
---|
[819] | 207 | |
---|
| 208 | #endif |
---|