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 G4ParticleHPNBodyPhaseSpace_h
0030 #define G4ParticleHPNBodyPhaseSpace_h 1
0031 
0032 #include "G4Neutron.hh"
0033 #include "G4Pow.hh"
0034 #include "G4ReactionProduct.hh"
0035 #include "G4VParticleHPEnergyAngular.hh"
0036 #include "G4ios.hh"
0037 #include "globals.hh"
0038 
0039 #include <CLHEP/Units/PhysicalConstants.h>
0040 
0041 #include <fstream>
0042 
0043 class G4ParticleHPNBodyPhaseSpace : public G4VParticleHPEnergyAngular
0044 {
0045   public:
0046     G4ParticleHPNBodyPhaseSpace()
0047     {
0048       theTotalMass = 0.0;
0049       theTotalCount = 0;
0050     }
0051     ~G4ParticleHPNBodyPhaseSpace() override = default;
0052 
0053   public:
0054     void Init(G4double aMass, G4int aCount)
0055     {
0056       theTotalMass = aMass;
0057       theTotalCount = aCount;
0058     }
0059 
0060     void Init(std::istream& aDataFile) override
0061     {
0062       aDataFile >> theTotalMass >> theTotalCount;
0063       theTotalMass *= G4Neutron::Neutron()->GetPDGMass();
0064     }
0065 
0066     G4ReactionProduct* Sample(G4double anEnergy, G4double massCode, G4double mass) override;
0067 
0068   private:
0069     inline G4double Prob(G4double anEnergy, G4double eMax, G4int n)
0070     {
0071       G4double result;
0072       result = std::sqrt(anEnergy) * G4Pow::GetInstance()->powA(eMax - anEnergy, 3. * n / 2. - 4.);
0073       return result;
0074     }
0075 
0076     inline G4double C(G4double anEnergy, G4double mass)
0077     {
0078       G4double result(0);
0079       if (theTotalCount == 3)
0080         result = 4. / CLHEP::pi / G4Pow::GetInstance()->powN(GetEmax(anEnergy, mass), 2);
0081       if (theTotalCount == 4)
0082         result = 105. / 32. / G4Pow::GetInstance()->powA(GetEmax(anEnergy, mass), 3.5);
0083       // if(theTotalCount==5) result =
0084       // 256./14./CLHEP::pi/G4Pow::GetInstance()->powA(GetEmax(anEnergy, mass), 5.);
0085       if (theTotalCount == 5)
0086         result = 256. / 14. / CLHEP::pi / G4Pow::GetInstance()->powN(GetEmax(anEnergy, mass), 5);
0087       return result;
0088     }
0089 
0090     inline G4double GetEmax(G4double anEnergy, G4double mass)
0091     {
0092       G4double result;
0093       G4double tMass = GetTarget()->GetMass();
0094       G4double pMass = GetProjectileRP()->GetMass();
0095       G4double availableEnergy = GetQValue() + anEnergy * tMass / (pMass + tMass);
0096       result = availableEnergy * (theTotalMass - mass) / theTotalMass;
0097       return result;
0098     }
0099 
0100     G4double MeanEnergyOfThisInteraction() override { return -1; }
0101 
0102   private:
0103     G4double theTotalMass;
0104     G4int theTotalCount;
0105 };
0106 #endif