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 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0028 //
0029 #ifndef G4ParticleHPParticleYield_h
0030 #define G4ParticleHPParticleYield_h 1
0031 
0032 #include "G4ParticleHPList.hh"
0033 #include "G4ParticleHPPolynomExpansion.hh"
0034 #include "G4ParticleHPVector.hh"
0035 #include "globals.hh"
0036 
0037 #include <CLHEP/Units/SystemOfUnits.h>
0038 
0039 class G4ParticleHPParticleYield
0040 {
0041   public:
0042     G4ParticleHPParticleYield()
0043     {
0044       simpleMean = true;
0045       spontPrompt = true;
0046       hasPromptData = false;
0047       hasDelayedData = false;
0048 
0049       targetMass = 0.0;
0050       theSpontPrompt = 0.0;
0051       spontDelayed = true;
0052       theSpontDelayed = 0.0;
0053     }
0054     ~G4ParticleHPParticleYield() = default;
0055 
0056     G4double GetTargetMass() { return targetMass; }
0057 
0058     void InitMean(std::istream& aDataFile)
0059     {
0060       G4int iflag;
0061       aDataFile >> targetMass >> iflag;
0062       if (iflag == 1) simpleMean = false;
0063       if (simpleMean) {
0064         theSimpleMean.Init(aDataFile, CLHEP::eV);
0065       }
0066       else {
0067         theMean.Init(aDataFile);
0068       }
0069     }
0070 
0071     void InitPrompt(std::istream& aDataFile)
0072     {
0073       hasPromptData = true;
0074       G4int iflag;
0075       aDataFile >> targetMass >> iflag;
0076       if (iflag == 2) spontPrompt = false;
0077       if (spontPrompt) {
0078         aDataFile >> theSpontPrompt;
0079       }
0080       else {
0081         thePrompt.Init(aDataFile, CLHEP::eV);
0082       }
0083     }
0084 
0085     void InitDelayed(std::istream& aDataFile)
0086     {
0087       hasDelayedData = true;
0088       G4int iflag;
0089       aDataFile >> targetMass >> iflag;
0090       thePrecursorDecayConstants.Init(aDataFile, 1. / CLHEP::s);  // s is the CLHEP unit second
0091       if (iflag == 2) spontDelayed = false;
0092       if (spontDelayed) {
0093         aDataFile >> theSpontDelayed;
0094       }
0095       else {
0096         theDelayed.Init(aDataFile, CLHEP::eV);
0097       }
0098     }
0099 
0100     G4double GetMean(G4double anEnergy)
0101     {
0102       if (simpleMean) {
0103         return theSimpleMean.GetY(anEnergy);
0104       }
0105       return theMean.GetValue(anEnergy);
0106     }
0107 
0108     G4double GetPrompt(G4double anEnergy)
0109     {
0110       if (!hasPromptData) return 0;
0111       if (spontPrompt) {
0112         return theSpontPrompt;
0113       }
0114       return thePrompt.GetY(anEnergy);
0115     }
0116 
0117     G4double GetDelayed(G4double anEnergy)
0118     {
0119       if (!hasDelayedData) return 0;
0120       if (spontDelayed) {
0121         return theSpontDelayed;
0122       }
0123       return theDelayed.GetY(anEnergy);
0124     }
0125 
0126     inline G4double GetDecayConstant(G4int i) { return thePrecursorDecayConstants.GetValue(i); }
0127 
0128   private:
0129     G4double targetMass;
0130     // total mean
0131     G4bool simpleMean;
0132     G4ParticleHPPolynomExpansion theMean;
0133     G4ParticleHPVector theSimpleMean;
0134 
0135     // Prompt neutrons
0136     G4bool hasPromptData;
0137     G4bool spontPrompt;
0138     G4ParticleHPVector thePrompt;
0139     G4double theSpontPrompt;
0140 
0141     // delayed neutrons
0142     G4bool hasDelayedData;
0143     G4bool spontDelayed;
0144     G4ParticleHPList thePrecursorDecayConstants;
0145     G4ParticleHPVector theDelayed;
0146     G4double theSpontDelayed;
0147 };
0148 #endif