Back to home page

EIC code displayed by LXR

 
 

    


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

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 // V. Ivanchenko, July-2023 Basic revision of particle HP classes
0029 //
0030 #ifndef G4ParticleHPEnAngCorrelation_h
0031 #define G4ParticleHPEnAngCorrelation_h 1
0032 
0033 #include "G4Cache.hh"
0034 #include "G4ParticleHPManager.hh"
0035 #include "G4ParticleHPProduct.hh"
0036 #include "G4ParticleHPVector.hh"
0037 #include "G4ReactionProduct.hh"
0038 #include "G4ios.hh"
0039 #include "Randomize.hh"
0040 #include "globals.hh"
0041 
0042 #include <fstream>
0043 
0044 class G4ParticleDefinition;
0045 
0046 class G4ParticleHPEnAngCorrelation
0047 {
0048     struct toBeCached
0049     {
0050       G4ReactionProduct* theProjectileRP{nullptr};
0051       G4ReactionProduct* theTarget{nullptr};
0052       G4double theTotalMeanEnergy{-1.0};
0053       toBeCached() = default;
0054     };
0055 
0056   public:
0057     explicit G4ParticleHPEnAngCorrelation(const G4ParticleDefinition* proj = nullptr);
0058     ~G4ParticleHPEnAngCorrelation();
0059 
0060     void Init(std::istream& aDataFile);
0061 
0062     G4ReactionProduct* SampleOne(G4double anEnergy);
0063 
0064     G4ReactionProductVector* Sample(G4double anEnergy);
0065 
0066     void SetTarget(G4ReactionProduct& aTarget)
0067     {
0068       fCache.Get().theTarget = &aTarget;
0069       for (G4int i = 0; i < nProducts; ++i)
0070         theProducts[i].SetTarget(&aTarget);
0071     }
0072 
0073     void SetProjectileRP(G4ReactionProduct& aIncidentPart)
0074     {
0075       fCache.Get().theProjectileRP = &aIncidentPart;
0076       for (G4int i = 0; i < nProducts; ++i)
0077         theProducts[i].SetProjectileRP(&aIncidentPart);
0078     }
0079 
0080     G4bool InCharge() { return inCharge; }
0081 
0082     G4double GetTargetMass() { return targetMass; }
0083 
0084     G4double GetNumberOfProducts() { return nProducts; }
0085 
0086     G4double GetTotalMeanEnergy()
0087     {
0088       return fCache.Get().theTotalMeanEnergy;  // cached in 'sample' call
0089     }
0090 
0091     G4ParticleHPEnAngCorrelation(G4ParticleHPEnAngCorrelation&) = delete;
0092     G4ParticleHPEnAngCorrelation& operator=
0093     (const G4ParticleHPEnAngCorrelation &right) = delete;
0094 
0095   private:
0096     const G4ParticleDefinition* theProjectile;
0097     G4ParticleHPProduct* theProducts{nullptr};
0098 
0099     G4double targetMass{0.0};
0100 
0101     G4int frameFlag{1};  // =1: Target rest frame; =2: CMS system; incident in lab
0102     G4int nProducts{0};
0103     G4bool inCharge{false};
0104 
0105     // cached values
0106     //
0107     G4Cache<toBeCached> fCache;
0108 };
0109 
0110 #endif