Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:22

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // Hadronic Interaction  abstract base class
0029 // This class is the base class for the model classes.
0030 // It sorts out the energy-range for the models and provides
0031 // class utilities.
0032 // original by H.P. Wellisch
0033 // Modified by J.L.Chuma, TRIUMF, 21-Mar-1997
0034 // Last modified: 3-Apr-1997
0035 // Added units to energy initialization: J.L. Chuma  04-Apr-97
0036 // Modified by J.L.Chuma, 05-May-97  to Initialize theBlockedCounter
0037 // Modified by J.L.Chuma, 08-Jul-97 to implement the Nucleus changes
0038 // Adding a registry for memory management of hadronic models, HPW 22-Mar-99
0039 // 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body
0040 //                          and reorder methods in the header 
0041 // 29-Jun-2009 V.Ivanchenko add SampleInvariantT method
0042 // 29-Aug-2009 V.Ivanchenko moved G4ReactionDynamics to G4InelasticInteraction,
0043 //                          add const pointers, and added recoilEnergyThreshold
0044 //                          member and accesors
0045 
0046 // Class Description
0047 // This is the base class for all hadronic interaction models in geant4.
0048 // If you want to implement a new way of producing a final state, please,
0049 //  inherit from here.
0050 // Class Description - End
0051  
0052 #ifndef G4HadronicInteraction_h
0053 #define G4HadronicInteraction_h 1
0054  
0055 #include "G4HadFinalState.hh"
0056 #include "G4Material.hh"
0057 #include "G4Nucleus.hh"
0058 #include "G4Track.hh"
0059 #include "G4HadProjectile.hh"
0060 
0061 class G4HadronicInteractionRegistry;
0062 
0063 class G4HadronicInteraction
0064 {
0065 public: // With description
0066     
0067   explicit G4HadronicInteraction(const G4String& modelName = "HadronicModel");
0068     
0069   virtual ~G4HadronicInteraction();
0070     
0071   virtual G4HadFinalState *ApplyYourself(const G4HadProjectile &aTrack, 
0072                      G4Nucleus & targetNucleus );
0073   // The interface to implement for final state production code.
0074 
0075   virtual G4double SampleInvariantT(const G4ParticleDefinition* p, 
0076                     G4double plab,
0077                     G4int Z, G4int A);
0078   // The interface to implement sampling of scattering or change exchange
0079      
0080   virtual G4bool IsApplicable(const G4HadProjectile & aTrack, 
0081                   G4Nucleus & targetNucleus);
0082  
0083   inline G4double GetMinEnergy() const
0084   { return theMinEnergy; }
0085     
0086   G4double GetMinEnergy( const G4Material *aMaterial,
0087              const G4Element *anElement ) const;
0088    
0089   inline void SetMinEnergy( G4double anEnergy )
0090   { theMinEnergy = anEnergy; }
0091     
0092   void SetMinEnergy( G4double anEnergy, const G4Element *anElement );
0093     
0094   void SetMinEnergy( G4double anEnergy, const G4Material *aMaterial );
0095     
0096   inline G4double GetMaxEnergy() const
0097   { return theMaxEnergy; }
0098     
0099   G4double GetMaxEnergy( const G4Material *aMaterial,
0100              const G4Element *anElement ) const;
0101     
0102   inline void SetMaxEnergy( const G4double anEnergy )
0103   { theMaxEnergy = anEnergy; }
0104     
0105   void SetMaxEnergy( G4double anEnergy, const G4Element *anElement );
0106     
0107   void SetMaxEnergy( G4double anEnergy, const G4Material *aMaterial );
0108 
0109   inline G4int GetVerboseLevel() const
0110   { return verboseLevel; }
0111 
0112   inline void SetVerboseLevel( G4int value )
0113   { verboseLevel = value; }
0114 
0115   inline const G4String& GetModelName() const
0116   { return theModelName; }
0117 
0118   void DeActivateFor(const G4Material* aMaterial);
0119  
0120   inline void ActivateFor( const G4Material *aMaterial ) 
0121   { 
0122     Block(); 
0123     SetMaxEnergy(GetMaxEnergy(), aMaterial);
0124     SetMinEnergy(GetMinEnergy(), aMaterial);
0125   }
0126 
0127   void DeActivateFor( const G4Element *anElement ); 
0128   inline void ActivateFor( const G4Element *anElement )
0129   { 
0130     Block(); 
0131     SetMaxEnergy(GetMaxEnergy(), anElement);
0132     SetMinEnergy(GetMinEnergy(), anElement);
0133   }
0134 
0135   G4bool IsBlocked( const G4Material *aMaterial ) const;
0136   G4bool IsBlocked( const G4Element *anElement) const;
0137 
0138   inline void SetRecoilEnergyThreshold(G4double val) 
0139   { recoilEnergyThreshold = val; }
0140 
0141   G4double GetRecoilEnergyThreshold() const 
0142   { return recoilEnergyThreshold;}
0143 
0144   virtual const std::pair<G4double, G4double> GetFatalEnergyCheckLevels() const;
0145 
0146   virtual std::pair<G4double, G4double> GetEnergyMomentumCheckLevels() const;
0147 
0148   inline void 
0149   SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
0150   { epCheckLevels.first = relativeLevel;
0151     epCheckLevels.second = absoluteLevel; }
0152 
0153   virtual void ModelDescription(std::ostream& outFile) const ; //=0;
0154 
0155   // Initialisation before run
0156   virtual void BuildPhysicsTable(const G4ParticleDefinition&);
0157   virtual void InitialiseModel();
0158 
0159   G4HadronicInteraction(const G4HadronicInteraction &right ) = delete;
0160   const G4HadronicInteraction& operator=(const G4HadronicInteraction &right) = delete;
0161   G4bool operator==(const G4HadronicInteraction &right ) const = delete;
0162   G4bool operator!=(const G4HadronicInteraction &right ) const = delete;
0163 
0164 protected:
0165 
0166   inline void SetModelName(const G4String& nam) 
0167   { theModelName = nam; }
0168 
0169   inline G4bool IsBlocked() const { return isBlocked;}
0170   inline void Block() { isBlocked = true; }
0171     
0172   G4HadFinalState theParticleChange;
0173   // the G4HadFinalState object which is modified and returned
0174   // by address by the ApplyYourself method,
0175   // (instead of aParticleChange as found in G4VProcess)
0176     
0177   G4int verboseLevel;
0178   // control flag for output messages
0179   // 0: silent
0180   // 1: warning messages
0181   // 2: more
0182   // (instead of verboseLevel as found in G4VProcess)
0183 
0184   // these two have global validity energy range    
0185   G4double theMinEnergy;
0186   G4double theMaxEnergy;
0187 
0188   G4bool isBlocked;
0189 
0190 private:       
0191     
0192   G4HadronicInteractionRegistry* registry;
0193 
0194   G4double recoilEnergyThreshold;
0195 
0196   G4String theModelName;
0197 
0198   std::pair<G4double, G4double> epCheckLevels;
0199 
0200   std::vector<std::pair<G4double, const G4Material *> > theMinEnergyList;
0201   std::vector<std::pair<G4double, const G4Material *> > theMaxEnergyList;
0202   std::vector<std::pair<G4double, const G4Element *> > theMinEnergyListElements;
0203   std::vector<std::pair<G4double, const G4Element *> > theMaxEnergyListElements;
0204   std::vector<const G4Material *> theBlockedList;
0205   std::vector<const G4Element *> theBlockedListElements;
0206 };
0207  
0208 #endif