Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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"
|
||||
|
||||
class DetectorConstruction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization {
|
||||
public:
|
||||
ActionInitialization( const DetectorConstruction* inputDetectorConstruction = nullptr );
|
||||
virtual ~ActionInitialization();
|
||||
virtual void BuildForMaster() const override;
|
||||
virtual void Build() const override;
|
||||
private:
|
||||
const DetectorConstruction* fPtrDetectorConstruction = nullptr;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 G4FieldManager;
|
||||
class G4UniformMagField;
|
||||
class G4Material;
|
||||
class DetectorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction {
|
||||
public:
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction();
|
||||
|
||||
G4VPhysicalVolume* Construct();
|
||||
void ConstructSDandField();
|
||||
|
||||
void SetMagField( const G4double fieldValue );
|
||||
void SetAbsorberMaterial( const G4String name );
|
||||
void SetActiveMaterial( const G4String name );
|
||||
// Use by the messenger.
|
||||
|
||||
inline G4Material* GetAbsorberMaterial() const;
|
||||
inline G4Material* GetActiveMaterial() const;
|
||||
|
||||
inline void SetIsCalHomogeneous( const G4bool choice );
|
||||
inline void SetIsUnitInLambda( const G4bool choice );
|
||||
inline void SetAbsorberTotalLength( const G4double value );
|
||||
inline void SetCalorimeterRadius( const G4double value );
|
||||
inline void SetActiveLayerNumber( const G4int value );
|
||||
inline void SetActiveLayerSize( const G4double value );
|
||||
// To define the calorimeter geometry.
|
||||
|
||||
inline void SetIsRadiusUnitInLambda( const G4bool choice );
|
||||
|
||||
void UpdateGeometry();
|
||||
|
||||
inline G4double GetCaloLength() const;
|
||||
|
||||
private:
|
||||
|
||||
void DefineMaterials();
|
||||
// Define all the materials.
|
||||
|
||||
G4VPhysicalVolume* ConstructCalorimeter();
|
||||
// To be invoked each time the geometry needs to be updated.
|
||||
|
||||
G4bool areParametersOK();
|
||||
// Return true if all the parameters are sensible, false otherwise.
|
||||
|
||||
void PrintParameters();
|
||||
// Print the various parameters which define the calorimeter.
|
||||
|
||||
G4Material* fVacuum;
|
||||
G4Material* fIron;
|
||||
G4Material* fCopper;
|
||||
G4Material* fTungsten;
|
||||
G4Material* fLead;
|
||||
G4Material* fUranium;
|
||||
G4Material* fPbWO4;
|
||||
G4Material* fPolystyrene;
|
||||
G4Material* fLiquidArgon;
|
||||
G4Material* fSilicon;
|
||||
G4Material* fQuartz;
|
||||
G4Material* fBrass;
|
||||
G4Material* fAluminium;
|
||||
G4Material* fGraphite;
|
||||
G4Material* fAbsorberMaterial;
|
||||
G4Material* fActiveMaterial;
|
||||
|
||||
G4LogicalVolume* fExperimentalHall_log;
|
||||
G4VPhysicalVolume* fExperimentalHall_phys;
|
||||
// World envelope.
|
||||
|
||||
G4LogicalVolume* fLogicCalo;
|
||||
G4VPhysicalVolume* fPhysiCalo;
|
||||
// "Calorimeter".
|
||||
|
||||
G4LogicalVolume* fLogicModule;
|
||||
G4VPhysicalVolume* fPhysiModule;
|
||||
// Module of the "calorimeter".
|
||||
|
||||
G4LogicalVolume* fLogicAbsorber;
|
||||
G4VPhysicalVolume* fPhysiAbsorber;
|
||||
// Absorber layer of the "calorimeter".
|
||||
|
||||
G4LogicalVolume* fLogicActive;
|
||||
G4VPhysicalVolume* fPhysiActive;
|
||||
// Active layer of the "calorimeter".
|
||||
|
||||
G4FieldManager* fFieldMgr;
|
||||
// Pointer to the field manager.
|
||||
|
||||
G4UniformMagField* fUniformMagField;
|
||||
// Pointer to the uniform magnetic field.
|
||||
|
||||
DetectorMessenger* fDetectorMessenger;
|
||||
// Pointer to the Messenger.
|
||||
|
||||
G4bool fIsCalHomogeneous;
|
||||
// If false then Sampling calorimeter;
|
||||
// If true then Homogeneous calorimeter.
|
||||
|
||||
G4bool fIsUnitInLambda;
|
||||
// If false then normal unit of length to express the absorber total length.
|
||||
// If true then lambda (interaction length) to express the absorber total length.
|
||||
|
||||
G4double fAbsorberTotalLength;
|
||||
// This is the total length of the absorber material, expressed
|
||||
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
|
||||
// otherwise in number of lambdas (interaction lengths).
|
||||
// Notice that in the case of a sampling calorimeter (i.e.
|
||||
// theIsCalHomogeneous is false), the active layers are not counted;
|
||||
// in the case of an homogenous calorimeter, this length account
|
||||
// for the overall dimension of the calorimeter.
|
||||
|
||||
G4double fCalorimeterRadius;
|
||||
// This is the radius of the calorimeter which is a cylinder, expressed
|
||||
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
|
||||
// otherwise in number of lambdas (interaction lengths) of the absorber.
|
||||
|
||||
G4int fActiveLayerNumber;
|
||||
G4double fActiveLayerSize;
|
||||
// Number of active layers and length of each of them (in normal unit
|
||||
// of length, e.g. mm): in the case of sampling calorimeter
|
||||
// (i.e. theIsCalHomogeneous is false) the medium is theActiveMaterial;
|
||||
// in the case of an homogeneous calorimeter, the "active layers" are
|
||||
// only a fictitious way to sample the longitudinal energy deposits,
|
||||
// but they are actually made of the same absorber material, and their
|
||||
// thickness is taken into account in theAbsorberTotalLength.
|
||||
|
||||
G4bool fIsRadiusUnitInLambda;
|
||||
// If false then normal unit of length to express the radius bin size.
|
||||
// If true then lambda (interaction length of the absorber) to express
|
||||
// the radius bin size.
|
||||
|
||||
G4double fCaloLength; // total length of the calorimeter along its (z) axis
|
||||
|
||||
// Scoring part
|
||||
G4LogicalVolume* fLogicScoringUpDown;
|
||||
G4VPhysicalVolume* fPhysiScoringUpstream;
|
||||
G4VPhysicalVolume* fPhysiScoringDownstream;
|
||||
G4LogicalVolume* fLogicScoringSide;
|
||||
G4VPhysicalVolume* fPhysiScoringSide;
|
||||
const G4double fScoringThickness = 10.0;
|
||||
};
|
||||
|
||||
inline G4Material* DetectorConstruction::GetAbsorberMaterial() const {
|
||||
return fAbsorberMaterial;
|
||||
}
|
||||
|
||||
inline G4Material* DetectorConstruction::GetActiveMaterial() const {
|
||||
return fActiveMaterial;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetIsCalHomogeneous( const G4bool choice ) {
|
||||
fIsCalHomogeneous = choice;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetIsUnitInLambda( const G4bool choice ) {
|
||||
fIsUnitInLambda = choice;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetAbsorberTotalLength( const G4double value ) {
|
||||
fAbsorberTotalLength = value;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetCalorimeterRadius( const G4double value ) {
|
||||
fCalorimeterRadius = value;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetActiveLayerNumber( const G4int value ) {
|
||||
fActiveLayerNumber = value;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetActiveLayerSize( const G4double value ) {
|
||||
fActiveLayerSize = value;
|
||||
}
|
||||
|
||||
inline void DetectorConstruction::SetIsRadiusUnitInLambda( const G4bool choice ) {
|
||||
fIsRadiusUnitInLambda = choice;
|
||||
}
|
||||
|
||||
inline G4double DetectorConstruction::GetCaloLength() const {
|
||||
return fCaloLength;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 G4UIcmdWithADouble;
|
||||
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorMessenger: public G4UImessenger {
|
||||
public:
|
||||
DetectorMessenger( DetectorConstruction* );
|
||||
~DetectorMessenger();
|
||||
void SetNewValue( G4UIcommand*, G4String ) override;
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
G4UIdirectory* fDetectorDir;
|
||||
G4UIcmdWithADoubleAndUnit* fFieldCommand;
|
||||
G4UIcmdWithAString* fAbsorberMaterial;
|
||||
G4UIcmdWithAString* fActiveMaterial;
|
||||
G4UIcmdWithABool* fIsCalHomogeneous;
|
||||
G4UIcmdWithABool* fIsUnitInLambda;
|
||||
G4UIcmdWithADouble* fAbsorberTotalLength;
|
||||
G4UIcmdWithADouble* fCalorimeterRadius;
|
||||
G4UIcmdWithAnInteger* fActiveLayerNumber;
|
||||
G4UIcmdWithADouble* fActiveLayerSize;
|
||||
G4UIcmdWithABool* fIsRadiusUnitInLambda;
|
||||
G4UIcmdWithoutParameter* fUpdateCommand;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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;
|
||||
class DetectorConstruction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
|
||||
public:
|
||||
PrimaryGeneratorAction( const DetectorConstruction* );
|
||||
~PrimaryGeneratorAction();
|
||||
void GeneratePrimaries( G4Event* anEvent ) override;
|
||||
void SetGunPosition() const;
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
const DetectorConstruction* fPointerDetectorConstruction = nullptr;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 setAbsorberMaterialName( const G4String &inputValue )
|
||||
{ fAbsorberMaterialName = inputValue; }
|
||||
void setActiveMaterialName( const G4String &inputValue ) { fActiveMaterialName = inputValue; }
|
||||
void setCubicVolumeScoringUpDown( const G4double inputValue )
|
||||
{ fCubicVolumeScoringUpDown = inputValue; }
|
||||
void setCubicVolumeScoringSide( const G4double inputValue )
|
||||
{ fCubicVolumeScoringSide = inputValue; }
|
||||
G4int getPrimaryParticleId() const { return fPrimaryParticleId; }
|
||||
G4double getPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; }
|
||||
G4ThreeVector getPrimaryParticleDirection() const { return fPrimaryParticleDirection; }
|
||||
G4String getAbsorberMaterialName() const { return fAbsorberMaterialName; }
|
||||
G4String getActiveMaterialName() const { return fActiveMaterialName; }
|
||||
G4double getCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; }
|
||||
G4double getCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; }
|
||||
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 fAbsorberMaterialName;
|
||||
G4String fActiveMaterialName;
|
||||
G4double fCubicVolumeScoringUpDown;
|
||||
G4double fCubicVolumeScoringSide;
|
||||
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,114 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 volumes 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 getCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; }
|
||||
G4double getCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; }
|
||||
// The cubic-volumes of the scoring volumes are needed to get the fluence from
|
||||
// the sum of step lengths in those scoring volumes.
|
||||
// Notice that two of the three scoring volumes - upstream and downstream -
|
||||
// have the same cubic-volume, that we call "fCubicVolumeScoringUpDown".
|
||||
|
||||
static const G4int numberScoringVolumes = 3; // downstream, side, upstream
|
||||
static const G4int numberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV
|
||||
static const G4int numberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
|
||||
// other-mesons, other-baryons
|
||||
static const G4int numberCombinations =
|
||||
numberScoringVolumes*numberKinematicRegions*numberParticleTypes;
|
||||
static const std::array< G4String, numberScoringVolumes > arrayScoringVolumeNames;
|
||||
static const std::array< G4String, numberKinematicRegions > arrayKinematicRegionNames;
|
||||
static const std::array< G4String, numberParticleTypes > arrayParticleTypeNames;
|
||||
static G4int getIndex( const G4int iScoringVolume, const G4int iKinematicRegion,
|
||||
const G4int iParticleType );
|
||||
|
||||
private:
|
||||
Run* fRunPtr; // Pointer to the Run object
|
||||
G4int fPrimaryParticleId;
|
||||
G4double fPrimaryParticleEnergy;
|
||||
G4ThreeVector fPrimaryParticleDirection;
|
||||
G4String fAbsorberMaterialName;
|
||||
G4String fActiveMaterialName;
|
||||
G4bool fIsFirstStepOfTheEvent;
|
||||
G4bool fIsFirstStepInAbsorberLayer;
|
||||
G4bool fIsFirstStepInActiveLayer;
|
||||
G4bool fIsFirstStepInScoringUpDown;
|
||||
G4bool fIsFirstStepInScoringSide;
|
||||
G4double fCubicVolumeScoringUpDown;
|
||||
G4double fCubicVolumeScoringSide;
|
||||
|
||||
std::array< G4double, numberCombinations > fArraySumStepLengths;
|
||||
// Array to collect the sum of step lengths in the scoring volumes for the whole run,
|
||||
// according to the various cases (kinematical region 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
|
||||
Reference in New Issue
Block a user