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 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 /// \file HadronicGenerator.hh
 27 /// \brief Definition of the HadronicGenerator class
 28 //
 29 //------------------------------------------------------------------------
 30 // Class: HadronicGenerator
 31 // Author: Alberto Ribon (CERN EP/SFT), May 2020
 32 // Modified: G. Hugo, 8 December 2022
 33 //
 34 /// This class shows how to use Geant4 as a generator for simulating
 35 /// inelastic hadron-nuclear interactions.
 36 /// Some of the most used hadronic models are currently supported in
 37 /// this class:
 38 /// - the hadronic string models Fritiof (FTF) and Quark-Gluon-String (QGS)
 39 ///   coupled with Precompound/de-excitation
 40 /// - the intranuclear cascade models: Bertini (BERT), Binary Cascade (BIC),
 41 ///                                    and Liege (INCL)
 42 /// Combinations of two models - in a transition energy interval, with a
 43 /// linear probability as a function of the energy - are also available to
 44 /// "mimic" the transition between hadronic models as in the most common
 45 /// Geant4 reference physics lists.
 46 ///
 47 /// The current version of this class does NOT support:
 48 /// -  hadron elastic interactions
 49 /// -  neutron capture and fission
 50 /// -  precise low-energy inelastic interactions of neutrons and
 51 ///    charged particles (i.e. ParticleHP)
 52 /// -  gamma/lepton-nuclear inelastic interactions
 53 ///
 54 /// This class does NOT use the Geant4 run-manager, and therefore should
 55 /// be usable in a multi-threaded application, with one instance of this
 56 /// class in each thread.
 57 ///
 58 /// This class has been inspired by test30 (whose author is Vladimir
 59 /// Ivanchenko), with various simplifications and restricted to hadronic
 60 /// inelastic interactions.
 61 //------------------------------------------------------------------------
 62 
 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 65 
 66 #ifndef HadronicGenerator_h
 67 #define HadronicGenerator_h 1
 68 
 69 #include "G4HadronicProcess.hh"
 70 #include "G4ThreeVector.hh"
 71 #include "G4ios.hh"
 72 #include "globals.hh"
 73 
 74 #include <iomanip>
 75 #include <map>
 76 
 77 class G4ParticleDefinition;
 78 class G4VParticleChange;
 79 class G4ParticleTable;
 80 class G4Material;
 81 class G4HadronicInteraction;
 82 
 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 84 
 85 class HadronicGenerator
 86 {
 87     // This class provides the functionality of a "hadronic generator"
 88     // for Geant4 final-state inelastic hadronic collisions.
 89     // Only a few of the available Geant4 final-state hadronic inelastic
 90     // "physics cases" are currently available in this class - but it can
 91     // be extended to other cases if needed.
 92     // It is important to notice that this class does NOT use the Geant4
 93     // run-manager, so it should work fine in a multi-threaded environment,
 94     // with a separate instance of this class in each thread.
 95   public:
 96     explicit HadronicGenerator(const G4String physicsCase = "FTFP_BERT_ATL");
 97     // Currently supported final-state hadronic inelastic "physics cases":
 98     // -   Hadronic models :       CernFLUKAHadronInelastic,
 99     //                             BERT, BIC, IonBIC, INCL, FTFP, QGSP
100     // -  "Physics-list proxies" : FTFP_BERT_ATL (default), FTFP_BERT,
101     //                             QGSP_BERT, QGSP_BIC, FTFP_INCLXX
102     //    (i.e. they are not real, complete physics lists - for instance
103     //     they do not have: transportation, electromagnetic physics,
104     //     hadron elastic scattering, neutron fission and capture, etc. -
105     //     however, they cover all hadron types and all energies by
106     //     combining different hadronic models, i.e. there are transitions
107     //     between two hadronic models in well-defined energy intervals,
108     //     e.g. "FTFP_BERT" has the transition between BERT and FTFP
109     //     hadronic models; moreover, the transition intervals used in
110     //     our "physics cases"might not be the same as in the corresponding
111     //     physics lists).
112 
113     ~HadronicGenerator();
114 
115     inline G4bool IsPhysicsCaseSupported() const;
116     // Returns "true" if the physicsCase is supported; "false" otherwise.
117 
118     G4bool IsApplicable(const G4String& nameProjectile, const G4double projectileEnergy) const;
119     G4bool IsApplicable(G4ParticleDefinition* projectileDefinition,
120                         const G4double projectileEnergy) const;
121     // Returns "true" if the specified projectile (either by name or particle definition)
122     // of given energy is applicable, "false" otherwise.
123 
124     G4VParticleChange* GenerateInteraction(const G4String& nameProjectile,
125                                            const G4double projectileEnergy,
126                                            const G4ThreeVector& projectileDirection,
127                                            G4Material* targetMaterial);
128     G4VParticleChange* GenerateInteraction(G4ParticleDefinition* projectileDefinition,
129                                            const G4double projectileEnergy,
130                                            const G4ThreeVector& projectileDirection,
131                                            G4Material* targetMaterial);
132     // This is the main method provided by the class:
133     // in input it receives the projectile (either by name or particle definition),
134     // its energy, its direction and the target material, and it returns one sampled
135     // final-state of the inelastic hadron-nuclear collision as modelled by the
136     // final-state hadronic inelastic "physics case" specified in the constructor.
137     // If the required hadronic collision is not possible, then the method returns
138     // immediately an empty "G4VParticleChange", i.e. without secondaries produced.
139 
140     inline G4HadronicProcess* GetHadronicProcess() const;
141     inline G4HadronicInteraction* GetHadronicInteraction() const;
142     // Returns the hadronic process and the hadronic interaction, respectively,
143     // that handled the last call of "GenerateInteraction".
144 
145     G4double GetImpactParameter() const;
146     G4int GetNumberOfTargetSpectatorNucleons() const;
147     G4int GetNumberOfProjectileSpectatorNucleons() const;
148     G4int GetNumberOfNNcollisions() const;
149     // In the case of hadronic interactions handled by the FTF model, returns,
150     // respectively, the impact parameter, the number of target/projectile
151     // spectator nucleons, and the number of nucleon-nucleon collisions,
152     // else, returns a negative value (-999).
153 
154   private:
155     G4String fPhysicsCase;
156     G4bool fPhysicsCaseIsSupported = false;
157     G4HadronicProcess* fLastHadronicProcess = nullptr;
158     G4ParticleTable* fPartTable = nullptr;
159     std::map<G4ParticleDefinition*, G4HadronicProcess*> fProcessMap;
160 };
161 
162 inline G4bool HadronicGenerator::IsPhysicsCaseSupported() const
163 {
164   return fPhysicsCaseIsSupported;
165 }
166 
167 inline G4HadronicProcess* HadronicGenerator::GetHadronicProcess() const
168 {
169   return fLastHadronicProcess;
170 }
171 
172 inline G4HadronicInteraction* HadronicGenerator::GetHadronicInteraction() const
173 {
174   return fLastHadronicProcess == nullptr ? nullptr : fLastHadronicProcess->GetHadronicInteraction();
175 }
176 
177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
178 
179 #endif
180