Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Hadronic Process: Very Low Energy Neutron X-Sections
0028 // original by H.P. Wellisch, TRIUMF, 14-Feb-97
0029 //
0030 // 070606 fix for Valgrind error by T. Koi
0031 // 070612 fix memory leaking by T. Koi
0032 // 070615 fix memory leaking by T. Koi
0033 // 080625 fix memory leaking by T. Koi
0034 //
0035 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0036 //
0037 #ifndef G4ParticleHPPhotonDist_h
0038 #define G4ParticleHPPhotonDist_h 1
0039 
0040 #include "G4Cache.hh"
0041 #include "G4Gamma.hh"
0042 #include "G4InterpolationManager.hh"
0043 #include "G4ParticleHPAngularP.hh"
0044 #include "G4ParticleHPFastLegendre.hh"
0045 #include "G4ParticleHPInterpolator.hh"
0046 #include "G4ParticleHPLegendreTable.hh"
0047 #include "G4ParticleHPPartial.hh"
0048 #include "G4ParticleHPVector.hh"
0049 #include "G4ReactionProduct.hh"
0050 #include "G4ReactionProductVector.hh"
0051 #include "G4ios.hh"
0052 #include "globals.hh"
0053 
0054 #include <fstream>
0055 
0056 class G4ParticleHPPhotonDist
0057 {
0058   public:
0059     G4ParticleHPPhotonDist()
0060     {
0061       disType = nullptr;
0062       energy = nullptr;
0063       theYield = nullptr;
0064       thePartialXsec = nullptr;
0065       theReactionXsec = nullptr;
0066       isPrimary = nullptr;
0067       theShells = nullptr;
0068       theGammas = nullptr;
0069       nNeu = nullptr;
0070       theLegendre = nullptr;
0071       theAngular = nullptr;
0072       distribution = nullptr;
0073       probs = nullptr;
0074       partials = nullptr;
0075       actualMult.Put(nullptr);
0076 
0077       theLevelEnergies = nullptr;
0078       theTransitionProbabilities = nullptr;
0079       thePhotonTransitionFraction = nullptr;
0080     }
0081 
0082     ~G4ParticleHPPhotonDist()
0083     {
0084       delete[] disType;
0085       delete[] energy;
0086       delete[] theYield;
0087       delete[] thePartialXsec;
0088       //     delete [] theReactionXsec;
0089       //     DHW: not created in this class
0090       delete[] isPrimary;
0091       delete[] theShells;
0092       delete[] theGammas;
0093       delete[] nNeu;
0094       delete[] theAngular;
0095       delete[] distribution;
0096       delete[] probs;
0097 
0098       if (theLegendre != nullptr) {
0099         for (G4int i = 0; i < (nDiscrete2 - nIso); i++)
0100           if (theLegendre[i] != nullptr) delete[] theLegendre[i];
0101 
0102         delete[] theLegendre;
0103       }
0104 
0105       if (partials != nullptr) {
0106         for (G4int i = 0; i < nPartials; i++) {
0107           delete partials[i];
0108         }
0109 
0110         delete[] partials;
0111       }
0112 
0113       delete[] theLevelEnergies;
0114       delete[] theTransitionProbabilities;
0115       delete[] thePhotonTransitionFraction;
0116       if (actualMult.Get() != nullptr) delete actualMult.Get();
0117     }
0118 
0119     G4bool InitMean(std::istream& aDataFile);
0120 
0121     void InitAngular(std::istream& aDataFile);
0122 
0123     void InitEnergies(std::istream& aDataFile);
0124 
0125     void InitPartials(std::istream& aDataFile, G4ParticleHPVector* theXsec = nullptr);
0126 
0127     G4ReactionProductVector* GetPhotons(G4double anEnergy);
0128 
0129     inline G4double GetTargetMass() { return targetMass; }
0130 
0131     inline G4bool NeedsCascade() { return repFlag == 2; }
0132 
0133     inline G4double GetLevelEnergy() { return theBaseEnergy; }
0134 
0135   private:
0136     G4int repFlag{0};  // representation as multiplicities or transition probability arrays.
0137     G4double targetMass{0.0};
0138 
0139     G4int nDiscrete{0};  // number of discrete photons
0140     G4int* disType;  // discrete, or continuum photons
0141     G4double* energy;  // photon energies
0142     G4ParticleHPVector* theYield;  // multiplicity as a function of neutron energy.
0143     G4ParticleHPVector theTotalXsec;
0144     G4ParticleHPVector* thePartialXsec;
0145     G4ParticleHPVector* theReactionXsec;
0146     G4int* isPrimary;
0147 
0148     G4int isoFlag{0};  // isotropic or not?
0149     G4int tabulationType{0};
0150     G4int nDiscrete2{0};
0151     G4int nIso{0};
0152     G4double* theShells;
0153     G4double* theGammas;
0154     G4int* nNeu;
0155     G4InterpolationManager theLegendreManager;
0156     G4ParticleHPLegendreTable** theLegendre;
0157     G4ParticleHPAngularP** theAngular;
0158 
0159     G4int* distribution;  // not used for the moment.
0160     G4int nPartials{0};
0161     G4ParticleHPVector* probs;  // probabilities for the partial distributions.
0162     G4ParticleHPPartial** partials;  // the partials, parallel to the above
0163 
0164     G4Cache<std::vector<G4int>*> actualMult;
0165 
0166     // for transition prob arrays start
0167     G4int theInternalConversionFlag{0};
0168     G4int nGammaEnergies{0};
0169     G4double theBaseEnergy{0.0};
0170     G4double* theLevelEnergies;
0171     G4double* theTransitionProbabilities;
0172     G4double* thePhotonTransitionFraction;
0173     // for transition prob arrays end
0174 
0175     G4ParticleHPFastLegendre theLegend;  // fast look-up for leg-integrals
0176 };
0177 
0178 #endif