Ignore:
Timestamp:
Apr 6, 2009, 12:30:29 PM (15 years ago)
Author:
garnier
Message:

update processes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/management/include/G4HadronicInteraction.hh

    r819 r962  
    2525//
    2626//
    27 // $Id: G4HadronicInteraction.hh,v 1.8 2007/01/11 05:30:01 dennis Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4HadronicInteraction.hh,v 1.9 2009/01/24 11:56:27 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    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
     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
    4143
    4244// Class Description
    4345// This is the base class for all hadronic interaction models in geant4.
    44 // If you want to implement a new way of producing a final state, please inherit
    45 // from here.
     46// If you want to implement a new way of producing a final state, please,
     47//  inherit from here.
    4648// Class Description - End
    4749 
     
    5052 
    5153#include "G4HadFinalState.hh"
    52 #include "G4DynamicParticle.hh"
    5354#include "G4ReactionDynamics.hh"
    5455#include "G4Material.hh"
     
    5657#include "G4Track.hh"
    5758#include "G4HadProjectile.hh"
    58 #include "G4HadronicInteractionRegistry.hh"
    59 #include "G4HadronicException.hh"
    6059
    61  class G4HadronicInteraction
    62  {
    63  public:
     60class G4HadronicInteraction
     61{
     62public: // With description
     63
    6464   
    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     }
     65  G4HadronicInteraction(const G4String& modelName = "HadronicModel");
    7166   
    72     virtual ~G4HadronicInteraction()
    73     {
    74       G4HadronicInteractionRegistry::RemoveMe(this);
    75     }
     67  virtual ~G4HadronicInteraction();
    7668   
    77  private:
     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; }
    7879   
    79     inline G4HadronicInteraction(
    80      const G4HadronicInteraction &right )
    81     { *this = right; }
     80  virtual G4double GetMinEnergy( const G4Material *aMaterial,
     81                                 const G4Element *anElement ) const;
     82   
     83  inline void SetMinEnergy( const G4double anEnergy )
     84  { theMinEnergy = anEnergy; }
    8285   
    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     }
     86  virtual void SetMinEnergy( G4double anEnergy, G4Element *anElement );
    9087   
    91  public:
     88  virtual void SetMinEnergy( G4double anEnergy, G4Material *aMaterial );
    9289   
    93     inline G4bool operator==(
    94      const G4HadronicInteraction &right ) const
    95     { return ( this == (G4HadronicInteraction *) &right ); }
     90  inline G4double GetMaxEnergy() const
     91  { return theMaxEnergy; }
    9692   
    97     inline G4bool operator!=(
    98      const G4HadronicInteraction &right ) const
    99     { return ( this != (G4HadronicInteraction *) &right ); }
     93  virtual G4double GetMaxEnergy( const G4Material *aMaterial,
     94                                 const G4Element *anElement ) const;
    10095   
    101     inline G4double GetMinEnergy() const
    102     { return theMinEnergy; }
     96  inline void SetMaxEnergy( const G4double anEnergy )
     97  { theMaxEnergy = anEnergy; }
    10398   
    104     virtual G4double GetMinEnergy( const G4Material *aMaterial,
    105                                   const G4Element *anElement ) const;
     99  virtual void SetMaxEnergy( G4double anEnergy, G4Element *anElement );
    106100   
    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 );
     101  virtual void SetMaxEnergy( G4double anEnergy, G4Material *aMaterial );
    126102 
    127     inline const G4HadronicInteraction *GetMyPointer() const
    128     { return this; }
     103  inline const G4HadronicInteraction *GetMyPointer() const
     104  { return this; }
    129105
    130     inline G4int GetVerboseLevel() const
    131     { return verboseLevel; }
     106  inline G4int GetVerboseLevel() const
     107  { return verboseLevel; }
    132108
    133     inline void SetVerboseLevel( G4int value )
    134     { verboseLevel = value; }
     109  inline void SetVerboseLevel( G4int value )
     110  { verboseLevel = value; }
    135111
    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.
    141    
    142     virtual G4HadFinalState *ApplyYourself(
    143             const G4HadProjectile &aTrack, G4Nucleus & targetNucleus ) = 0;
     112  inline const G4String& GetModelName() const
     113  { return theModelName; }
    144114   
    145115public: // Without description
    146116
    147     virtual void DeActivateFor( G4Material *aMaterial );
     117  virtual void DeActivateFor( G4Material *aMaterial );
    148118   
    149     virtual void ActivateFor( G4Material *aMaterial )
    150     {
    151       Block();
    152       SetMaxEnergy(GetMaxEnergy(), aMaterial);
    153       SetMinEnergy(GetMinEnergy(), aMaterial);
    154     }
     119  virtual void ActivateFor( G4Material *aMaterial )
     120  {
     121    Block();
     122    SetMaxEnergy(GetMaxEnergy(), aMaterial);
     123    SetMinEnergy(GetMinEnergy(), aMaterial);
     124  }
    155125
    156     virtual void DeActivateFor( G4Element *anElement );
    157     virtual void ActivateFor( G4Element *anElement )
    158     {
    159       Block();
    160       SetMaxEnergy(GetMaxEnergy(), anElement);
    161       SetMinEnergy(GetMinEnergy(), anElement);
    162     }
     126  virtual void DeActivateFor( G4Element *anElement );
     127  virtual void ActivateFor( G4Element *anElement )
     128  {
     129    Block();
     130    SetMaxEnergy(GetMaxEnergy(), anElement);
     131    SetMinEnergy(GetMinEnergy(), anElement);
     132  }
    163133
    164     virtual G4bool IsBlocked( const G4Material *aMaterial ) const;
     134  virtual G4bool IsBlocked( const G4Material *aMaterial ) const;
    165135
    166     virtual G4bool IsBlocked( const G4Element *anElement) const;
     136  virtual G4bool IsBlocked( const G4Element *anElement) const;
     137
     138  inline G4bool operator==(const G4HadronicInteraction &right ) const
     139  { return ( this == (G4HadronicInteraction *) &right ); }
    167140   
    168     virtual G4bool IsApplicable(const G4HadProjectile &/*aTrack*/,
    169                                G4Nucleus & /*targetNucleus*/){  return true;}
    170  protected:
     141  inline G4bool operator!=(const G4HadronicInteraction &right ) const
     142  { return ( this != (G4HadronicInteraction *) &right ); }
    171143   
    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)
     144private:
    176145   
    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)
     146  G4HadronicInteraction(const G4HadronicInteraction &right );
    183147   
    184     G4ReactionDynamics theReactionDynamics;
     148  const G4HadronicInteraction& operator=(const G4HadronicInteraction &right);
     149
     150protected:
     151
     152  inline G4bool IsBlocked() const { return isBlocked;}
     153  inline void Block() { isBlocked = true; }
    185154   
    186     // these two have global validity
    187     // units are assumed to be MeV
     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)
    188159   
    189     G4double theMinEnergy;
    190     G4double theMaxEnergy;
     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)
    191166   
    192     G4bool IsBlocked() const { return isBlocked;}
    193     void Block() { isBlocked = true; }
    194     G4bool isBlocked;
     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;
    195176
    196     G4String theModelName;
     177  G4String theModelName;
    197178   
    198  private:
     179private:
    199180       
    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  };
     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};
    207188 
    208189#endif
Note: See TracChangeset for help on using the changeset viewer.