Import Geant4 11.3.0.beta source tree
This commit is contained in:
+45
-51
@@ -36,26 +36,26 @@
|
||||
/// In practice, the interactions studied here are hadron nuclear inelastic interactions
|
||||
/// (though the code is fully generic).
|
||||
///
|
||||
/// Energy spectra are plotted for all encountered secondaries
|
||||
/// Energy spectra are plotted for all encountered secondaries
|
||||
/// (one histo per secondary).
|
||||
/// In addition, the residual nuclei Z and A distributions are plotted.
|
||||
///
|
||||
/// All histograms are G4H1.
|
||||
/// All histograms are G4H1.
|
||||
/// They are created and filled via the G4VAnalysisManager.
|
||||
///
|
||||
/// The histograms can be dumped to all usual formats, including ROOT
|
||||
/// The histograms can be dumped to all usual formats, including ROOT
|
||||
/// (via G4VAnalysisManager).
|
||||
/// An interesting added feature here, is that the plots, while being allocated
|
||||
/// and filled via G4VAnalysisManager, are also dumped
|
||||
/// An interesting added feature here, is that the plots, while being allocated
|
||||
/// and filled via G4VAnalysisManager, are also dumped
|
||||
/// in a Flair-compatible format (via tools::histo::flair).
|
||||
///
|
||||
/// NB 1: Note that instead of a hardcoded number associated to a hardcoded set of particles,
|
||||
/// particle PDG IDs are used to index the histos.
|
||||
/// particle PDG IDs are used to index the histos.
|
||||
/// This allows a dynamic storage of all particles encountered in the final states.
|
||||
///
|
||||
/// NB 2: tools::histo::flair code, which allows the dump of any G4H1
|
||||
/// into Flair-compatible format, is fully application-agnostic,
|
||||
/// and is placed in FlukaCern/utils.
|
||||
/// NB 2: tools::histo::flair code, which allows the dump of any G4H1
|
||||
/// into Flair-compatible format, is fully application-agnostic,
|
||||
/// and is placed in FlukaCern/utils.
|
||||
/// It could also be added as an extension of core G4 Analysis Manager.
|
||||
//
|
||||
// ***************************************************************************
|
||||
@@ -63,67 +63,61 @@
|
||||
#ifndef FINAL_STATE_HISTO_MANAGER_HH
|
||||
#define FINAL_STATE_HISTO_MANAGER_HH
|
||||
|
||||
#include "G4H1Wrapper.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4H1Wrapper.hh"
|
||||
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4VAnalysisManager;
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class FinalStateHistoManager {
|
||||
class FinalStateHistoManager
|
||||
{
|
||||
public:
|
||||
FinalStateHistoManager();
|
||||
|
||||
public:
|
||||
FinalStateHistoManager();
|
||||
void Book();
|
||||
void BeginOfEvent();
|
||||
void ScoreSecondary(const G4DynamicParticle* const secondary);
|
||||
void EndOfEvent();
|
||||
void EndOfRun() const;
|
||||
|
||||
void Book();
|
||||
void BeginOfEvent();
|
||||
void ScoreSecondary(const G4DynamicParticle* const secondary);
|
||||
void EndOfEvent();
|
||||
void EndOfRun() const;
|
||||
private:
|
||||
void DumpAllG4H1IntoRootFile() const;
|
||||
void
|
||||
DumpAllG4H1IntoFlairFile(const std::map<G4String, const G4H1Wrapper*>& particlesHistos) const;
|
||||
|
||||
G4String fOutputFileName = "all_secondaries";
|
||||
G4String fRootOutputFileName = fOutputFileName + ".root";
|
||||
G4String fFlairOutputFileName = fOutputFileName + ".hist";
|
||||
|
||||
private:
|
||||
void DumpAllG4H1IntoRootFile() const;
|
||||
void DumpAllG4H1IntoFlairFile(const std::map<G4String,
|
||||
const G4H1Wrapper*>& particlesHistos) const;
|
||||
|
||||
G4String fOutputFileName = "all_secondaries";
|
||||
G4String fRootOutputFileName = fOutputFileName + ".root";
|
||||
G4String fFlairOutputFileName = fOutputFileName + ".hist";
|
||||
G4int fNumBins = 90;
|
||||
G4double fMinKineticEnergy = 10. * keV;
|
||||
G4double fMaxKineticEnergy = 10. * TeV;
|
||||
G4String fFunctionName = "none";
|
||||
G4String fBinSchemeName = "log";
|
||||
G4String fRootEnergyUnit = "MeV";
|
||||
|
||||
G4int fNumBins = 90;
|
||||
G4double fMinKineticEnergy = 10. * keV;
|
||||
G4double fMaxKineticEnergy = 10. * TeV;
|
||||
G4String fFunctionName = "none";
|
||||
G4String fBinSchemeName = "log";
|
||||
G4String fRootEnergyUnit = "MeV";
|
||||
G4int fNucleiZMax = 25;
|
||||
G4int fNucleiAMax = 50;
|
||||
|
||||
G4int fNucleiZMax = 25;
|
||||
G4int fNucleiAMax = 50;
|
||||
G4int fNumEvents = 0;
|
||||
|
||||
G4int fNumEvents = 0;
|
||||
G4VAnalysisManager* fAnalysisManager = nullptr;
|
||||
|
||||
G4VAnalysisManager* fAnalysisManager = nullptr;
|
||||
|
||||
// key is particle PDG ID:
|
||||
std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fParticleData;
|
||||
// key is nuclei Z or A score index:
|
||||
std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fNucleiData;
|
||||
G4int fNucleiZScoreIndex = 0;
|
||||
G4int fNucleiAScoreIndex = 1;
|
||||
// key is particle PDG ID:
|
||||
std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fParticleData;
|
||||
// key is nuclei Z or A score index:
|
||||
std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fNucleiData;
|
||||
G4int fNucleiZScoreIndex = 0;
|
||||
G4int fNucleiAScoreIndex = 1;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+41
-42
@@ -25,7 +25,7 @@
|
||||
//
|
||||
/// \file HadronicGenerator.hh
|
||||
/// \brief Definition of the HadronicGenerator class
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// Class: HadronicGenerator
|
||||
// Author: Alberto Ribon (CERN EP/SFT), May 2020
|
||||
@@ -54,7 +54,7 @@
|
||||
/// This class does NOT use the Geant4 run-manager, and therefore should
|
||||
/// be usable in a multi-threaded application, with one instance of this
|
||||
/// class in each thread.
|
||||
///
|
||||
///
|
||||
/// This class has been inspired by test30 (whose author is Vladimir
|
||||
/// Ivanchenko), with various simplifications and restricted to hadronic
|
||||
/// inelastic interactions.
|
||||
@@ -66,12 +66,13 @@
|
||||
#ifndef HadronicGenerator_h
|
||||
#define HadronicGenerator_h 1
|
||||
|
||||
#include <iomanip>
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <map>
|
||||
#include "G4HadronicProcess.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
|
||||
class G4ParticleDefinition;
|
||||
class G4VParticleChange;
|
||||
@@ -81,20 +82,20 @@ class G4HadronicInteraction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class HadronicGenerator {
|
||||
// This class provides the functionality of a "hadronic generator"
|
||||
// for Geant4 final-state inelastic hadronic collisions.
|
||||
// Only a few of the available Geant4 final-state hadronic inelastic
|
||||
// "physics cases" are currently available in this class - but it can
|
||||
// be extended to other cases if needed.
|
||||
// It is important to notice that this class does NOT use the Geant4
|
||||
// run-manager, so it should work fine in a multi-threaded environment,
|
||||
// with a separate instance of this class in each thread.
|
||||
class HadronicGenerator
|
||||
{
|
||||
// This class provides the functionality of a "hadronic generator"
|
||||
// for Geant4 final-state inelastic hadronic collisions.
|
||||
// Only a few of the available Geant4 final-state hadronic inelastic
|
||||
// "physics cases" are currently available in this class - but it can
|
||||
// be extended to other cases if needed.
|
||||
// It is important to notice that this class does NOT use the Geant4
|
||||
// run-manager, so it should work fine in a multi-threaded environment,
|
||||
// with a separate instance of this class in each thread.
|
||||
public:
|
||||
|
||||
explicit HadronicGenerator( const G4String physicsCase = "FTFP_BERT_ATL" );
|
||||
explicit HadronicGenerator(const G4String physicsCase = "FTFP_BERT_ATL");
|
||||
// Currently supported final-state hadronic inelastic "physics cases":
|
||||
// - Hadronic models : CernFLUKAHadronInelastic,
|
||||
// - Hadronic models : CernFLUKAHadronInelastic,
|
||||
// BERT, BIC, IonBIC, INCL, FTFP, QGSP
|
||||
// - "Physics-list proxies" : FTFP_BERT_ATL (default), FTFP_BERT,
|
||||
// QGSP_BERT, QGSP_BIC, FTFP_INCLXX
|
||||
@@ -112,22 +113,22 @@ class HadronicGenerator {
|
||||
~HadronicGenerator();
|
||||
|
||||
inline G4bool IsPhysicsCaseSupported() const;
|
||||
// Returns "true" if the physicsCase is supported; "false" otherwise.
|
||||
|
||||
G4bool IsApplicable( const G4String &nameProjectile, const G4double projectileEnergy ) const;
|
||||
G4bool IsApplicable( G4ParticleDefinition* projectileDefinition,
|
||||
const G4double projectileEnergy ) const;
|
||||
// Returns "true" if the physicsCase is supported; "false" otherwise.
|
||||
|
||||
G4bool IsApplicable(const G4String& nameProjectile, const G4double projectileEnergy) const;
|
||||
G4bool IsApplicable(G4ParticleDefinition* projectileDefinition,
|
||||
const G4double projectileEnergy) const;
|
||||
// Returns "true" if the specified projectile (either by name or particle definition)
|
||||
// of given energy is applicable, "false" otherwise.
|
||||
|
||||
G4VParticleChange* GenerateInteraction( const G4String &nameProjectile,
|
||||
const G4double projectileEnergy,
|
||||
const G4ThreeVector &projectileDirection ,
|
||||
G4Material* targetMaterial );
|
||||
G4VParticleChange* GenerateInteraction( G4ParticleDefinition* projectileDefinition,
|
||||
const G4double projectileEnergy,
|
||||
const G4ThreeVector &projectileDirection ,
|
||||
G4Material* targetMaterial );
|
||||
G4VParticleChange* GenerateInteraction(const G4String& nameProjectile,
|
||||
const G4double projectileEnergy,
|
||||
const G4ThreeVector& projectileDirection,
|
||||
G4Material* targetMaterial);
|
||||
G4VParticleChange* GenerateInteraction(G4ParticleDefinition* projectileDefinition,
|
||||
const G4double projectileEnergy,
|
||||
const G4ThreeVector& projectileDirection,
|
||||
G4Material* targetMaterial);
|
||||
// This is the main method provided by the class:
|
||||
// in input it receives the projectile (either by name or particle definition),
|
||||
// its energy, its direction and the target material, and it returns one sampled
|
||||
@@ -151,28 +152,26 @@ class HadronicGenerator {
|
||||
// else, returns a negative value (-999).
|
||||
|
||||
private:
|
||||
|
||||
G4String fPhysicsCase;
|
||||
G4bool fPhysicsCaseIsSupported = false;
|
||||
G4HadronicProcess* fLastHadronicProcess = nullptr;
|
||||
G4ParticleTable* fPartTable = nullptr;
|
||||
std::map< G4ParticleDefinition*, G4HadronicProcess* > fProcessMap;
|
||||
std::map<G4ParticleDefinition*, G4HadronicProcess*> fProcessMap;
|
||||
};
|
||||
|
||||
|
||||
inline G4bool HadronicGenerator::IsPhysicsCaseSupported() const {
|
||||
inline G4bool HadronicGenerator::IsPhysicsCaseSupported() const
|
||||
{
|
||||
return fPhysicsCaseIsSupported;
|
||||
}
|
||||
|
||||
|
||||
inline G4HadronicProcess* HadronicGenerator::GetHadronicProcess() const {
|
||||
inline G4HadronicProcess* HadronicGenerator::GetHadronicProcess() const
|
||||
{
|
||||
return fLastHadronicProcess;
|
||||
}
|
||||
|
||||
|
||||
inline G4HadronicInteraction* HadronicGenerator::GetHadronicInteraction() const {
|
||||
return fLastHadronicProcess == nullptr ? nullptr
|
||||
: fLastHadronicProcess->GetHadronicInteraction();
|
||||
inline G4HadronicInteraction* HadronicGenerator::GetHadronicInteraction() const
|
||||
{
|
||||
return fLastHadronicProcess == nullptr ? nullptr : fLastHadronicProcess->GetHadronicInteraction();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user