File indexing completed on 2025-09-16 08:56:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef G4ParticleHPChannelList_h
0035 #define G4ParticleHPChannelList_h 1
0036
0037 #include "G4ParticleHPChannel.hh"
0038 #include "globals.hh"
0039
0040 class G4Element;
0041 class G4HadFinalState;
0042 class G4HadProjectile;
0043 class G4ParticleHPFinalState;
0044 class G4ParticleDefinition;
0045
0046 class G4ParticleHPChannelList
0047 {
0048 public:
0049 G4ParticleHPChannelList(G4int n = 0, G4ParticleDefinition* p = nullptr);
0050
0051 void Init(G4int n);
0052
0053 ~G4ParticleHPChannelList();
0054
0055 G4HadFinalState* ApplyYourself(const G4Element* theElement,
0056 const G4HadProjectile& aTrack);
0057
0058
0059 G4HadFinalState * ApplyYourself(G4int, G4int, G4int, const G4HadProjectile & aTrack);
0060
0061 void Init(G4Element* anElement, const G4String& dirName,
0062 G4ParticleDefinition* projectile);
0063
0064 void Register(G4ParticleHPFinalState* theFS, const G4String& aName);
0065
0066 G4double GetXsec(G4double anEnergy)
0067 {
0068 G4double result = 0.0;
0069 for (G4int i = 0; i < nChannels; ++i) {
0070 result += std::max(0., theChannels[i]->GetXsec(anEnergy));
0071 }
0072 return result;
0073 }
0074
0075
0076 inline G4double GetWeightedXsec( G4double anEnergy, G4int isotopeJ ) {
0077 G4double result = 0.0;
0078 G4int i;
0079 for ( i = 0; i < nChannels; i++ ) {
0080 if ( theChannels[i]->HasAnyData( isotopeJ ) ) {
0081 result += std::max( 0.0, theChannels[i]->GetWeightedXsec( anEnergy, isotopeJ ) );
0082 }
0083 }
0084 return result;
0085 }
0086
0087 G4int GetNumberOfChannels() { return nChannels; }
0088
0089 G4bool HasDataInAnyFinalState()
0090 {
0091 G4bool result = false;
0092 for (G4int i = 0; i < nChannels; ++i) {
0093 if (theChannels[i]->HasDataInAnyFinalState())
0094 {
0095 result = true;
0096 break;
0097 }
0098 }
0099 return result;
0100 }
0101
0102 void DumpInfo();
0103
0104 G4ParticleHPChannelList(G4ParticleHPChannelList &) = delete;
0105 G4ParticleHPChannelList & operator=
0106 (const G4ParticleHPChannelList &right) = delete;
0107
0108 private:
0109 G4ParticleHPChannel** theChannels;
0110 G4ParticleDefinition* theProjectile;
0111 G4Element* theElement{nullptr};
0112 G4int nChannels;
0113 G4int idx{0};
0114 G4String theDir{""};
0115
0116 G4HadFinalState unChanged;
0117 };
0118
0119 #endif