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/src/G4HadronicInteraction.cc

    r819 r962  
    2424// ********************************************************************
    2525//
     26// $Id: G4HadronicInteraction.cc,v 1.4 2009/01/24 11:56:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2628//
    27  // Hadronic Interaction  base class
    28  // original by H.P. Wellisch
    29  // modified by J.L. Chuma, TRIUMF, 21-Mar-1997
    30  // Last modified: 04-Apr-1997
    31  // reimplemented 1.11.2003 JPW.
    32  
     29// Hadronic Interaction  base class
     30// original by H.P. Wellisch
     31// modified by J.L. Chuma, TRIUMF, 21-Mar-1997
     32// Last modified: 04-Apr-1997
     33// reimplemented 1.11.2003 JPW.
     34// 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body
     35
    3336#include "G4HadronicInteraction.hh"
    34  
    35  G4double
    36   G4HadronicInteraction::GetMinEnergy(
     37#include "G4HadronicInteractionRegistry.hh"
     38#include "G4HadronicException.hh"
     39
     40G4HadronicInteraction::G4HadronicInteraction(const G4String& modelName) :
     41  verboseLevel(0), theMinEnergy(0.0*GeV), theMaxEnergy(25.0*GeV),
     42  isBlocked(false), theModelName(modelName)
     43{
     44  G4HadronicInteractionRegistry::Instance()->RegisterMe(this);
     45}
     46   
     47G4HadronicInteraction::~G4HadronicInteraction()
     48{
     49  G4HadronicInteractionRegistry::Instance()->RemoveMe(this);
     50}
     51 
     52G4double G4HadronicInteraction::GetMinEnergy(
    3753   const G4Material *aMaterial, const G4Element *anElement ) const
    38   {
    39     size_t i;
    40     if( IsBlocked(aMaterial) )return 0.*GeV;
    41     if( IsBlocked(anElement) )return 0.*GeV;
    42     for( i=0; i<theMinEnergyListElements.size(); ++i )
    43     {
    44       if( anElement == theMinEnergyListElements[i].second )return theMinEnergyListElements[i].first;
     54{
     55  size_t i;
     56  if( IsBlocked(aMaterial) )return 0.*GeV;
     57  if( IsBlocked(anElement) )return 0.*GeV;
     58  for( i=0; i<theMinEnergyListElements.size(); ++i )
     59    {
     60      if( anElement == theMinEnergyListElements[i].second )
     61        return theMinEnergyListElements[i].first;
    4562    }
    4663    for( i=0; i<theMinEnergyList.size(); ++i )
    4764    {
    48       if( aMaterial == theMinEnergyList[i].second )return theMinEnergyList[i].first;
     65      if( aMaterial == theMinEnergyList[i].second )
     66        return theMinEnergyList[i].first;
    4967    }
    5068    if(IsBlocked()) return 0.*GeV;
     
    5472           << " not found in min energy List" << G4endl;
    5573    return theMinEnergy;
    56   }
    57  
    58  void
    59   G4HadronicInteraction::SetMinEnergy(
    60    G4double anEnergy,
    61    G4Element *anElement )
    62   {
    63     if( IsBlocked(anElement) )
    64       G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
     74}
     75 
     76void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
     77                                         G4Element *anElement )
     78{
     79  if( IsBlocked(anElement) )
     80    G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
    6581           << "    The model is not active for the Element  "
    6682           << anElement->GetName() << "." << G4endl;
    6783   
    68     for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
     84  for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
    6985    {
    7086      if( anElement == theMinEnergyListElements[i].second )
     
    7490      }
    7591    }
    76     theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
    77   }
    78  
    79  void
    80   G4HadronicInteraction::SetMinEnergy(
    81    G4double anEnergy,
    82    G4Material *aMaterial )
    83   {
    84     if( IsBlocked(aMaterial) )
    85       G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
     92  theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
     93}
     94 
     95void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
     96                                         G4Material *aMaterial )
     97{
     98  if( IsBlocked(aMaterial) )
     99    G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
    86100           << "    The model is not active for the Material "
    87101           << aMaterial->GetName() << "." << G4endl;
    88102   
    89     for( size_t i=0; i<theMinEnergyList.size(); ++i )
     103  for( size_t i=0; i<theMinEnergyList.size(); ++i )
    90104    {
    91105      if( aMaterial == theMinEnergyList[i].second )
    92       {
    93         theMinEnergyList[i].first = anEnergy;
    94         return;
    95       }
    96     }
    97     theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
    98   }
    99  
    100  G4double
    101   G4HadronicInteraction::GetMaxEnergy(
    102    const G4Material *aMaterial, const G4Element *anElement ) const
    103   {
    104     size_t i;
    105     if( IsBlocked(aMaterial) )return 0.0*GeV;
    106     if( IsBlocked(anElement) )return 0.0*GeV;
    107     for( i=0; i<theMaxEnergyListElements.size(); ++i )
    108     {
    109       if( anElement == theMaxEnergyListElements[i].second )return theMaxEnergyListElements[i].first;
     106        {
     107          theMinEnergyList[i].first = anEnergy;
     108          return;
     109        }
     110    }
     111  theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
     112}
     113 
     114G4double G4HadronicInteraction::GetMaxEnergy(const G4Material *aMaterial,
     115                                             const G4Element *anElement ) const
     116{
     117  size_t i;
     118  if( IsBlocked(aMaterial) )return 0.0*GeV;
     119  if( IsBlocked(anElement) )return 0.0*GeV;
     120  for( i=0; i<theMaxEnergyListElements.size(); ++i )
     121    {
     122      if( anElement == theMaxEnergyListElements[i].second )
     123        return theMaxEnergyListElements[i].first;
    110124    }
    111125    for( i=0; i<theMaxEnergyList.size(); ++i )
    112126    {
    113       if( aMaterial == theMaxEnergyList[i].second )return theMaxEnergyList[i].first;
     127      if( aMaterial == theMaxEnergyList[i].second )
     128        return theMaxEnergyList[i].first;
    114129    }
    115130    if(IsBlocked()) return 0.*GeV;
    116131    if( verboseLevel > 0 )
    117132      G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
    118            << "    material " << aMaterial->GetName()
    119            << " not found in min energy List" << G4endl;
     133             << "    material " << aMaterial->GetName()
     134             << " not found in min energy List" << G4endl;
    120135   
    121136    return theMaxEnergy;
    122   }
    123  
    124  void
    125   G4HadronicInteraction::SetMaxEnergy(
    126    G4double anEnergy,
    127    G4Element *anElement )
    128   {
    129     if( IsBlocked(anElement) )
    130       G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
     137}
     138 
     139void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
     140                                         G4Element *anElement )
     141{
     142  if( IsBlocked(anElement) )
     143    G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
    131144           << "Warning: The model is not active for the Element  "
    132145           << anElement->GetName() << "." << G4endl;
    133146   
    134     for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
     147  for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
    135148    {
    136149      if( anElement == theMaxEnergyListElements[i].second )
     
    140153      }
    141154    }
    142     theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
    143   }
    144 
    145  void
    146   G4HadronicInteraction::SetMaxEnergy(
    147    G4double anEnergy,
    148    G4Material *aMaterial )
    149   {
    150     if( IsBlocked(aMaterial) )
    151       G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
     155  theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement));
     156}
     157
     158void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
     159                                         G4Material *aMaterial )
     160{
     161  if( IsBlocked(aMaterial) )
     162    G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
    152163           << "Warning: The model is not active for the Material "
    153164           << aMaterial->GetName() << "." << G4endl;
    154165   
    155     for( size_t i=0; i<theMaxEnergyList.size(); ++i )
     166  for( size_t i=0; i<theMaxEnergyList.size(); ++i )
    156167    {
    157168      if( aMaterial == theMaxEnergyList[i].second )
    158       {
     169        {
    159170        theMaxEnergyList[i].first = anEnergy;
    160171        return;
    161       }
    162     }
    163     theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
    164   }
    165 
    166  void
    167   G4HadronicInteraction::DeActivateFor( G4Material *aMaterial )
    168   {
    169     theBlockedList.push_back(aMaterial);
    170   }
    171 
    172  void
    173   G4HadronicInteraction::DeActivateFor( G4Element *anElement )
    174   {
    175     theBlockedListElements.push_back(anElement);
    176   }
    177 
    178  G4bool
    179   G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
    180   {
    181     for( size_t i=0; i<theBlockedList.size(); ++i )
     172        }
     173    }
     174  theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));
     175}
     176
     177void G4HadronicInteraction::DeActivateFor( G4Material *aMaterial )
     178{
     179  theBlockedList.push_back(aMaterial);
     180}
     181
     182void G4HadronicInteraction::DeActivateFor( G4Element *anElement )
     183{
     184  theBlockedListElements.push_back(anElement);
     185}
     186
     187G4bool G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
     188{
     189  for( size_t i=0; i<theBlockedList.size(); ++i )
    182190    {
    183191      if( aMaterial == theBlockedList[i] )
    184       {
    185         return true;
    186       }
    187     }
    188     return false;
    189   }
    190  
    191  G4bool
    192   G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
    193   {
    194     for( size_t i=0; i<theBlockedListElements.size(); ++i )
     192        {
     193          return true;
     194        }
     195    }
     196  return false;
     197}
     198 
     199G4bool G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
     200{
     201  for( size_t i=0; i<theBlockedListElements.size(); ++i )
    195202    {
    196203      if( anElement == theBlockedListElements[i] )
    197       {
    198         return true;
    199       }
    200     }
    201     return false;
    202   }
    203  
    204  /* end of file */
    205  
     204        {
     205          return true;
     206        }
     207    }
     208  return false;
     209}
     210
     211G4HadronicInteraction::G4HadronicInteraction(const G4HadronicInteraction &right )
     212{
     213  *this = right;
     214}
     215   
     216const G4HadronicInteraction&
     217G4HadronicInteraction::operator=(const G4HadronicInteraction &right )
     218{
     219  G4String text = "unintended use of G4HadronicInteraction::operator=";
     220  throw G4HadronicException(__FILE__, __LINE__, text);
     221  return right;
     222}
     223 
     224/* end of file */
     225 
Note: See TracChangeset for help on using the changeset viewer.