Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ActionInitialization : public G4VUserActionInitialization {
public:
ActionInitialization();
virtual ~ActionInitialization();
virtual void BuildForMaster() const override;
virtual void Build() const override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_H
#define DetectorConstruction_H 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction {
public:
DetectorConstruction();
~DetectorConstruction();
G4VPhysicalVolume* Construct();
void SetMaterial( const G4String name );
inline G4Material* GetMaterial() const;
inline void SetRadius( const G4double value );
inline G4double GetRadius() const;
void UpdateGeometry();
private:
G4VPhysicalVolume* ConstructSphere(); // To be invoked each time the geometry needs
// to be updated
void PrintParameters();
G4Material* fMaterial;
G4LogicalVolume* fExperimentalHall_log;
G4VPhysicalVolume* fExperimentalHall_phys;
G4LogicalVolume* fLogicSphere;
G4VPhysicalVolume* fPhysiSphere;
G4LogicalVolume* fLogicScoringShell;
G4VPhysicalVolume* fPhysiScoringShell;
DetectorMessenger* fDetectorMessenger;
G4double fRadius;
const G4double fScoringThickness = 10.0; //***LOOKHERE*** thickness of the scoring shell
};
inline G4Material* DetectorConstruction::GetMaterial() const {
return fMaterial;
}
inline void DetectorConstruction::SetRadius( const G4double value ) {
fRadius = value;
}
inline G4double DetectorConstruction::GetRadius() const {
return fRadius;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorMessenger.hh
/// \brief Definition of the DetectorMessenger class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger {
public:
DetectorMessenger( DetectorConstruction* );
~DetectorMessenger();
void SetNewValue( G4UIcommand*, G4String ) override;
private:
DetectorConstruction* fDetector;
G4UIdirectory* fDetectorDir;
G4UIcmdWithAString* fMaterial;
G4UIcmdWithADoubleAndUnit* fRadius;
G4UIcmdWithoutParameter* fUpdateCommand;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
void GeneratePrimaries( G4Event* anEvent ) override;
void SetGunPosition() const;
private:
G4ParticleGun* fParticleGun;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file Run.hh
/// \brief Definition of the Run class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef Run_h
#define Run_h 1
#include "G4Run.hh"
#include "G4ThreeVector.hh"
#include "SteppingAction.hh"
#include <array>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class Run : public G4Run {
// This class accumulates relevant quantities related to particle fluence collected during
// the run.
// ( Note: these information are provided via calls of accessor methods of this Run class
// made by SteppingAction::UserSteppingAction. )
// At the end of a run, the printInfo method is called by the run-action to print out
// some summary information about these quantities.
// In multithreaded (MT) mode, an object of this class is filled up for each working thread,
// and then merged (automatically by the Geant4 kernel) into another object (of this class)
// owned by the master class; the printInfo method is then called only for the latter run
// object.
// Note that, for simplicity and brevity, we avoid histograms and print-out instead some
// statistics (compute by ourself) at the end of the run.
public:
Run();
~Run();
virtual void RecordEvent( const G4Event* anEvent ) override;
// This method is called automatically by the Geant4 kernel (not by the user!) at the end
// of each event. In the case of multithreaded mode, it is called only for the working thread
// that handled that event.
virtual void Merge( const G4Run* aRun ) override;
// This method is called automatically by the Geant4 kernel (not by the user!) only in the
// case of multithreaded mode and only for working threads.
void printInfo() const;
// This method is called by RunAction::EndOfRunAction : in the case of multithreaded mode,
// only the master thread calls it.
void setPrimaryParticleId( const G4int inputValue ) { fPrimaryParticleId = inputValue; }
void setPrimaryParticleEnergy( const G4double inputValue )
{ fPrimaryParticleEnergy = inputValue; }
void setPrimaryParticleDirection( const G4ThreeVector &inputValue )
{ fPrimaryParticleDirection = inputValue; }
void setTargetMaterialName( const G4String &inputValue ) { fTargetMaterialName = inputValue; }
void setCubicVolumeScoringShell( const G4double inputValue )
{ fCubicVolumeScoringShell = inputValue; }
G4int getPrimaryParticleId() const { return fPrimaryParticleId; }
G4double getPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; }
G4ThreeVector getPrimaryParticleDirection() const { return fPrimaryParticleDirection; }
G4String getTargetMaterialName() const { return fTargetMaterialName; }
G4double getCubicVolumeScoringShell() const { return fCubicVolumeScoringShell; }
void setArray( const std::array< G4double, SteppingAction::numberCombinations >& inputArray );
std::array< G4double, SteppingAction::numberCombinations > getArray() const { return fArray; }
// Accessor methods useful to transfer information collected by the stepping-action
// into this Run class
private:
G4int fNumEvents;
G4int fPrimaryParticleId;
G4double fPrimaryParticleEnergy;
G4ThreeVector fPrimaryParticleDirection;
G4String fTargetMaterialName;
G4double fCubicVolumeScoringShell;
std::array< G4double, SteppingAction::numberCombinations > fArray;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h
#include "G4UserRunAction.hh"
class G4Run;
class SteppingAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction: public G4UserRunAction {
public:
RunAction( SteppingAction* steppingAction = nullptr );
virtual ~RunAction();
virtual void BeginOfRunAction( const G4Run* aRun ) override;
virtual void EndOfRunAction( const G4Run* aRun ) override;
virtual G4Run* GenerateRun() override;
private:
SteppingAction* fSteppingAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_H
#define SteppingAction_H 1
#include "globals.hh"
#include "G4UserSteppingAction.hh"
#include "G4ThreeVector.hh"
#include <array>
class Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction {
public:
SteppingAction();
virtual ~SteppingAction();
virtual void UserSteppingAction( const G4Step* ) override;
// This is the main method where the step lengths of particles inside
// the scoring shell are collected, and then the corresponding fluences
// are filled up in the Run object where they are stored (and then
// printed out at the end of the Run).
// (For simplicity and brevity, we avoid histograms and compute instead
// some statistics ourself, which will be print-out at the end of the run.)
void initialize();
// This method is called by RunAction::BeginOfRunAction for the
// initialization of the stepping-action at the beginning of each Run.
// This is necessary because different runs can have different primary particle
// types, kinetic energies, and detector configurations.
void setRunPointer( Run* inputValue = nullptr ) { fRunPtr = inputValue; }
// This method is called by RunAction::BeginOfRunAction for providing to the
// stepping-action the pointer to the run object at the beginning of each Run.
// This pointer is then used to pass the information collected by the stepping-action
// to the run object.
G4double getCubicVolumeScoringShell() const { return fCubicVolumeScoringShell; }
// The cubic-volume of the scoring shell is needed to get the fluence from the
// sum of step lengths inside that scoring shell.
static const G4int numberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV
static const G4int numberScoringPositions = 2; // forward, backward (hemisphere with
// respect to the primary particle direction)
static const G4int numberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
// other-mesons, other-baryons
static const G4int numberCombinations =
numberKinematicRegions*numberScoringPositions*numberParticleTypes;
static const std::array< G4String, numberKinematicRegions > arrayKinematicRegionNames;
static const std::array< G4String, numberScoringPositions > arrayScoringPositionNames;
static const std::array< G4String, numberParticleTypes > arrayParticleTypeNames;
static G4int getIndex( const G4int iKinematicRegion, const G4int iScoringPosition,
const G4int iParticleType );
private:
Run* fRunPtr; // Pointer to the Run object
G4int fPrimaryParticleId;
G4double fPrimaryParticleEnergy;
G4ThreeVector fPrimaryParticleDirection;
G4String fTargetMaterialName;
G4bool fIsFirstStepOfTheEvent;
G4bool fIsFirstStepInTarget;
G4bool fIsFirstStepInScoringShell;
G4double fCubicVolumeScoringShell;
std::array< G4double, numberCombinations > fArraySumStepLengths;
// Array to collect the sum of step lengths in the scoring shell for the whole run,
// according to the various cases (kinematical region, scoring position and particle type).
// Note that the fluence in a scoring volume is defined as sum of step lengths
// in that scoring volume divided by the cubic-volume of that scoring volume.
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif