Geant4 Cross Reference |
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 // Hadronic Process: Very Low Energy Neutron X-Sections 28 // original by H.P. Wellisch, TRIUMF, 14-Feb-97 29 // 30 // 070606 fix for Valgrind error by T. Koi 31 // 070612 fix memory leaking by T. Koi 32 // 070615 fix memory leaking by T. Koi 33 // 080625 fix memory leaking by T. Koi 34 // 35 // P. Arce, June-2014 Conversion neutron_hp to particle_hp 36 // 37 #ifndef G4ParticleHPPhotonDist_h 38 #define G4ParticleHPPhotonDist_h 1 39 40 #include "G4Cache.hh" 41 #include "G4Gamma.hh" 42 #include "G4InterpolationManager.hh" 43 #include "G4ParticleHPAngularP.hh" 44 #include "G4ParticleHPFastLegendre.hh" 45 #include "G4ParticleHPInterpolator.hh" 46 #include "G4ParticleHPLegendreTable.hh" 47 #include "G4ParticleHPPartial.hh" 48 #include "G4ParticleHPVector.hh" 49 #include "G4ReactionProduct.hh" 50 #include "G4ReactionProductVector.hh" 51 #include "G4ios.hh" 52 #include "globals.hh" 53 54 #include <fstream> 55 56 class G4ParticleHPPhotonDist 57 { 58 public: 59 G4ParticleHPPhotonDist() 60 { 61 disType = nullptr; 62 energy = nullptr; 63 theYield = nullptr; 64 thePartialXsec = nullptr; 65 theReactionXsec = nullptr; 66 isPrimary = nullptr; 67 theShells = nullptr; 68 theGammas = nullptr; 69 nNeu = nullptr; 70 theLegendre = nullptr; 71 theAngular = nullptr; 72 distribution = nullptr; 73 probs = nullptr; 74 partials = nullptr; 75 actualMult.Put(nullptr); 76 77 theLevelEnergies = nullptr; 78 theTransitionProbabilities = nullptr; 79 thePhotonTransitionFraction = nullptr; 80 } 81 82 ~G4ParticleHPPhotonDist() 83 { 84 delete[] disType; 85 delete[] energy; 86 delete[] theYield; 87 delete[] thePartialXsec; 88 // delete [] theReactionXsec; 89 // DHW: not created in this class 90 delete[] isPrimary; 91 delete[] theShells; 92 delete[] theGammas; 93 delete[] nNeu; 94 delete[] theAngular; 95 delete[] distribution; 96 delete[] probs; 97 98 if (theLegendre != nullptr) { 99 for (G4int i = 0; i < (nDiscrete2 - nIso); i++) 100 if (theLegendre[i] != nullptr) delete[] theLegendre[i]; 101 102 delete[] theLegendre; 103 } 104 105 if (partials != nullptr) { 106 for (G4int i = 0; i < nPartials; i++) { 107 delete partials[i]; 108 } 109 110 delete[] partials; 111 } 112 113 delete[] theLevelEnergies; 114 delete[] theTransitionProbabilities; 115 delete[] thePhotonTransitionFraction; 116 if (actualMult.Get() != nullptr) delete actualMult.Get(); 117 } 118 119 G4bool InitMean(std::istream& aDataFile); 120 121 void InitAngular(std::istream& aDataFile); 122 123 void InitEnergies(std::istream& aDataFile); 124 125 void InitPartials(std::istream& aDataFile, G4ParticleHPVector* theXsec = nullptr); 126 127 G4ReactionProductVector* GetPhotons(G4double anEnergy); 128 129 inline G4double GetTargetMass() { return targetMass; } 130 131 inline G4bool NeedsCascade() { return repFlag == 2; } 132 133 inline G4double GetLevelEnergy() { return theBaseEnergy; } 134 135 private: 136 G4int repFlag{0}; // representation as multiplicities or transition probability arrays. 137 G4double targetMass{0.0}; 138 139 G4int nDiscrete{0}; // number of discrete photons 140 G4int* disType; // discrete, or continuum photons 141 G4double* energy; // photon energies 142 G4ParticleHPVector* theYield; // multiplicity as a function of neutron energy. 143 G4ParticleHPVector theTotalXsec; 144 G4ParticleHPVector* thePartialXsec; 145 G4ParticleHPVector* theReactionXsec; 146 G4int* isPrimary; 147 148 G4int isoFlag{0}; // isotropic or not? 149 G4int tabulationType{0}; 150 G4int nDiscrete2{0}; 151 G4int nIso{0}; 152 G4double* theShells; 153 G4double* theGammas; 154 G4int* nNeu; 155 G4InterpolationManager theLegendreManager; 156 G4ParticleHPLegendreTable** theLegendre; 157 G4ParticleHPAngularP** theAngular; 158 159 G4int* distribution; // not used for the moment. 160 G4int nPartials{0}; 161 G4ParticleHPVector* probs; // probabilities for the partial distributions. 162 G4ParticleHPPartial** partials; // the partials, parallel to the above 163 164 G4Cache<std::vector<G4int>*> actualMult; 165 166 // for transition prob arrays start 167 G4int theInternalConversionFlag{0}; 168 G4int nGammaEnergies{0}; 169 G4double theBaseEnergy{0.0}; 170 G4double* theLevelEnergies; 171 G4double* theTransitionProbabilities; 172 G4double* thePhotonTransitionFraction; 173 // for transition prob arrays end 174 175 G4ParticleHPFastLegendre theLegend; // fast look-up for leg-integrals 176 }; 177 178 #endif 179