source: trunk/source/processes/hadronic/models/management/include/G4HadronicInteraction.hh @ 846

Last change on this file since 846 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 7.3 KB
Line 
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//
27// $Id: G4HadronicInteraction.hh,v 1.8 2007/01/11 05:30:01 dennis Exp $
28// GEANT4 tag $Name:  $
29//
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
42// Class Description
43// 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// Class Description - End
47 
48#ifndef G4HadronicInteraction_h
49#define G4HadronicInteraction_h 1
50 
51#include "G4HadFinalState.hh"
52#include "G4DynamicParticle.hh"
53#include "G4ReactionDynamics.hh"
54#include "G4Material.hh"
55#include "G4Nucleus.hh"
56#include "G4Track.hh"
57#include "G4HadProjectile.hh"
58#include "G4HadronicInteractionRegistry.hh"
59#include "G4HadronicException.hh"
60
61 class G4HadronicInteraction
62 {
63 public:
64   
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    }
71   
72    virtual ~G4HadronicInteraction()
73    {
74      G4HadronicInteractionRegistry::RemoveMe(this);
75    }
76   
77 private:
78   
79    inline G4HadronicInteraction(
80     const G4HadronicInteraction &right )
81    { *this = right; }
82   
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    }
90   
91 public:
92   
93    inline G4bool operator==(
94     const G4HadronicInteraction &right ) const
95    { return ( this == (G4HadronicInteraction *) &right ); }
96   
97    inline G4bool operator!=(
98     const G4HadronicInteraction &right ) const
99    { return ( this != (G4HadronicInteraction *) &right ); }
100   
101    inline G4double GetMinEnergy() const
102    { return theMinEnergy; }
103   
104    virtual G4double GetMinEnergy( const G4Material *aMaterial,
105                                  const G4Element *anElement ) const;
106   
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 );
126 
127    inline const G4HadronicInteraction *GetMyPointer() const
128    { return this; }
129
130    inline G4int GetVerboseLevel() const
131    { return verboseLevel; }
132
133    inline void SetVerboseLevel( G4int value )
134    { verboseLevel = value; }
135
136    inline const G4String& GetModelName() const
137    { return theModelName; }
138
139public: // 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;
144   
145public: // Without description
146
147    virtual void DeActivateFor( G4Material *aMaterial );
148   
149    virtual void ActivateFor( G4Material *aMaterial ) 
150    { 
151      Block(); 
152      SetMaxEnergy(GetMaxEnergy(), aMaterial);
153      SetMinEnergy(GetMinEnergy(), aMaterial);
154    }
155
156    virtual void DeActivateFor( G4Element *anElement ); 
157    virtual void ActivateFor( G4Element *anElement )
158    { 
159      Block(); 
160      SetMaxEnergy(GetMaxEnergy(), anElement);
161      SetMinEnergy(GetMinEnergy(), anElement);
162    }
163
164    virtual G4bool IsBlocked( const G4Material *aMaterial ) const;
165
166    virtual G4bool IsBlocked( const G4Element *anElement) const;
167   
168    virtual G4bool IsApplicable(const G4HadProjectile &/*aTrack*/, 
169                               G4Nucleus & /*targetNucleus*/){  return true;}
170 protected:
171   
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)
176   
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)
183   
184    G4ReactionDynamics theReactionDynamics;
185   
186    // these two have global validity
187    // units are assumed to be MeV
188   
189    G4double theMinEnergy;
190    G4double theMaxEnergy;
191   
192    G4bool IsBlocked() const { return isBlocked;}
193    void Block() { isBlocked = true; }
194    G4bool isBlocked;
195
196    G4String theModelName;
197   
198 private:
199       
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 };
207 
208#endif
Note: See TracBrowser for help on using the repository browser.