Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:59:11

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 // 080721 Create adjust_final_state method by T. Koi
0028 // 080801 Introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
0029 //
0030 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0031 // V. Ivanchenko, July-2023 Basic revision of particle HP classes
0032 //
0033 
0034 #ifndef G4ParticleHPFinalState_h
0035 #define G4ParticleHPFinalState_h
0036 
0037 #include "G4Cache.hh"
0038 #include "G4HadFinalState.hh"
0039 #include "G4HadProjectile.hh"
0040 #include "G4Material.hh"
0041 #include "G4Neutron.hh"
0042 #include "G4IonTable.hh"
0043 #include "G4ParticleHPManager.hh"
0044 #include "G4ParticleHPNames.hh"
0045 #include "G4ParticleHPVector.hh"
0046 
0047 class G4ParticleDefinition;
0048 
0049 class G4ParticleHPFinalState
0050 {
0051   public:
0052 
0053     G4ParticleHPFinalState();
0054     virtual ~G4ParticleHPFinalState();
0055 
0056     inline void Init(G4double A, G4double Z, const G4String& dirName,
0057                      const G4String& aFSType, G4ParticleDefinition* p)
0058     {
0059       theProjectile = p;
0060       Init(A, Z, 0, dirName, aFSType, p);
0061     }
0062     virtual void Init(G4double A, G4double Z, G4int M, const G4String& dirName,
0063                       const G4String& aFSType, G4ParticleDefinition*) = 0;
0064 
0065     virtual G4HadFinalState* ApplyYourself(const G4HadProjectile&)
0066     {
0067       throw G4HadronicException(
0068         __FILE__, __LINE__,
0069         "G4ParticleHPFinalState::ApplyYourself(..) needs implementation");
0070       return nullptr;
0071     }
0072 
0073     // this would better be done templating G4ParticleHPChannel...,
0074     //
0075     virtual G4ParticleHPFinalState* New() = 0;
0076 
0077     inline G4bool HasXsec() const { return hasXsec; }
0078     inline G4bool HasFSData() const { return hasFSData; }
0079     inline G4bool HasAnyData() const { return hasAnyData; }
0080 
0081     virtual G4double GetXsec(G4double) const { return 0.; }
0082     virtual G4ParticleHPVector* GetXsec() const { return nullptr; }
0083 
0084     void SetA_Z(G4double anA, G4double aZ, G4int aM = 0)
0085     {
0086       theBaseA = G4lrint(anA);
0087       theBaseZ = G4lrint(aZ);
0088       theBaseM = aM;
0089     }
0090     G4double GetZ() const { return theBaseZ; }
0091     G4double GetN() const { return theBaseA; }
0092     G4double GetA() const { return theBaseA; }
0093     G4int GetM() const { return theBaseM; }
0094 
0095     inline void SetAZMs(const G4ParticleHPDataUsed& used)
0096     {
0097       theNDLDataA = G4lrint(used.GetA());
0098       theNDLDataZ = G4lrint(used.GetZ());
0099       theNDLDataM = used.GetM();
0100     }
0101 
0102     inline void SetAZMs(G4double anA, G4double aZ, G4int aM, const G4ParticleHPDataUsed& used)
0103     {
0104       theBaseA = G4lrint(anA);
0105       theBaseZ = G4lrint(aZ);
0106       theBaseM = aM;
0107       theNDLDataA = G4lrint(used.GetA());
0108       theNDLDataZ = G4lrint(used.GetZ());
0109       theNDLDataM = used.GetM();
0110     }
0111 
0112     inline void SetProjectile(G4ParticleDefinition* projectile)
0113     {
0114       theProjectile = projectile;
0115     }
0116 
0117     G4ParticleHPFinalState& operator=(const G4ParticleHPFinalState& right) = delete;
0118     G4ParticleHPFinalState(const G4ParticleHPFinalState&) = delete;
0119 
0120   protected:
0121 
0122     void adjust_final_state(G4LorentzVector);
0123 
0124     G4ParticleDefinition* theProjectile{nullptr};
0125     G4ParticleHPManager* fManager;
0126     G4IonTable* ionTable;
0127 
0128     G4int theBaseA{0};
0129     G4int theBaseZ{0};
0130     G4int theBaseM{0};
0131     G4int theNDLDataZ{0};
0132     G4int theNDLDataA{0};
0133     G4int theNDLDataM{0};
0134 
0135     G4int secID{-1};
0136     // Creator model ID for the secondaries created by this class or derived ones
0137 
0138     G4bool hasXsec{true};
0139     G4bool hasFSData{true};
0140     G4bool hasAnyData{true};
0141     G4ParticleHPNames theNames;
0142 
0143     G4Cache<G4HadFinalState*> theResult;
0144 
0145 };
0146 
0147 #endif