Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0028 // 070613 fix memory leaking by T. Koi
0029 //
0030 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0031 //
0032 #ifndef G4ParticleHPAngular_h
0033 #define G4ParticleHPAngular_h 1
0034 
0035 #include "G4Cache.hh"
0036 #include "G4ParticleHPLegendreStore.hh"
0037 #include "G4ParticleHPPartial.hh"
0038 #include "G4ReactionProduct.hh"
0039 #include "G4ios.hh"
0040 #include "Randomize.hh"
0041 #include "globals.hh"
0042 
0043 #include <fstream>
0044 
0045 class G4ParticleHPAngular
0046 {
0047     struct toBeCached
0048     {
0049         const G4ReactionProduct* theProjectileRP{nullptr};
0050         const G4ReactionProduct* theTarget{nullptr};
0051         toBeCached() = default;
0052     };
0053 
0054   public:
0055     G4ParticleHPAngular()
0056     {
0057       theIsoFlag = true;
0058       theCoefficients = nullptr;
0059       theProbArray = nullptr;
0060       toBeCached val;
0061       fCache.Put(val);
0062 
0063       theAngularDistributionType = 0;
0064       frameFlag = 0;
0065       targetMass = 0.0;
0066     }
0067 
0068     ~G4ParticleHPAngular()
0069     {
0070       delete theCoefficients;
0071       delete theProbArray;
0072     }
0073 
0074     void Init(std::istream& aDataFile);
0075 
0076     void SampleAndUpdate(G4ReactionProduct& anIncidentParticle);
0077 
0078     void SetTarget(const G4ReactionProduct& aTarget) { fCache.Get().theTarget = &aTarget; }
0079 
0080     void SetProjectileRP(const G4ReactionProduct& anIncidentParticleRP)
0081     {
0082       fCache.Get().theProjectileRP = &anIncidentParticleRP;
0083     }
0084 
0085     inline G4double GetTargetMass() { return targetMass; }
0086 
0087   private:
0088     // the type of distribution; currently
0089     // isotropic (0),
0090     // and legendre representation (1)
0091     // probability distribution (2)
0092     // are supported
0093 
0094     G4int theAngularDistributionType;
0095     G4int frameFlag;  // 1=Lab, 2=CMS
0096 
0097     G4bool theIsoFlag;  // isotropic or not?
0098 
0099     G4ParticleHPLegendreStore* theCoefficients;  // the legendre coefficients
0100 
0101     G4ParticleHPPartial* theProbArray;
0102     // the probability array p,costh for energy
0103 
0104     G4double targetMass;
0105 
0106     G4Cache<toBeCached> fCache;
0107 };
0108 
0109 #endif