Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -36,36 +36,36 @@
/// Actions initialization.
///
/// Initialization of all user defined actions as well as mandatory
/// particle generator.
/// particle generator.
/// Based on G4 examples/extended/parametrisations/Par01/include/
/// Par01ActionInitialization.hh .
/// @author Anna Zaborowska
class Par02ActionInitialization : public G4VUserActionInitialization {
class Par02ActionInitialization : public G4VUserActionInitialization
{
public:
/// A default constructor: sets the output file name fFileName
/// A default constructor: sets the output file name fFileName
/// (passed to Par02RunAction) to DefaultOutput.root as well as
/// flag fSmear (passed to Par02EventAction) to true indicating
/// that smearing will be performed.
Par02ActionInitialization();
/// A constructor: sets the flag fSmear (passed to Par02EventAction)
/// to true indicating that smearing will be performed.
/// @param aOutName The output file name passed to Par02RunAction.
Par02ActionInitialization( const G4String aOutName );
Par02ActionInitialization(const G4String aOutName);
/// A constructor.
/// @param aOutName The output file name passed to Par02RunAction.
/// @param aSmear The flag indicating if smearing should be done,
/// passed to Par02EventAction.
Par02ActionInitialization( const G4String aOutName, const G4String aSmear );
Par02ActionInitialization(const G4String aOutName, const G4String aSmear);
virtual ~Par02ActionInitialization();
virtual void BuildForMaster() const;
/// A method where all the user actions are created.
/// A method where all the user actions are created.
/// One of them, Par02PrimaryGeneratorAction is a mandatory class.
virtual void Build() const;
@@ -73,10 +73,9 @@ class Par02ActionInitialization : public G4VUserActionInitialization {
/// An output file name. Passed in Build() to the Par02RunAction.
G4String fFileName;
/// A flag indicating if smearing should be performed.
/// Passed in Build() to the Par02EventAction.
/// A flag indicating if smearing should be performed.
/// Passed in Build() to the Par02EventAction.
G4bool fSmear;
};
#endif
@@ -30,31 +30,31 @@
#ifndef PAR02_DETECTOR_CONSTRUCTION_H
#define PAR02_DETECTOR_CONSTRUCTION_H
#include "Par02FastSimModelTracker.hh"
#include "Par02FastSimModelEMCal.hh"
#include "Par02FastSimModelHCal.hh"
#include "Par02FastSimModelTracker.hh"
#include "tls.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "tls.hh"
#include "G4GlobalMagFieldMessenger.hh"
/// Construction of detector geometry.
///
/// A mandatory initialization class of the detector setup.
/// Detector construction allows to use the geometry read from a GDML file.
/// A mandatory initialization class of the detector setup.
/// Detector construction allows to use the geometry read from a GDML file.
/// Based on G4 examples/persistency/gdml/G01/include/G01DetectorConstruction.hh .
/// @author Anna Zaborowska
class Par02DetectorConstruction : public G4VUserDetectorConstruction {
class Par02DetectorConstruction : public G4VUserDetectorConstruction
{
public:
/// A default constructor.
Par02DetectorConstruction();
virtual ~Par02DetectorConstruction();
/// A method invoked by G4RunManager::Initialize()
/// @return A pointer to the world volume.
virtual G4VPhysicalVolume* Construct();
@@ -63,20 +63,19 @@ class Par02DetectorConstruction : public G4VUserDetectorConstruction {
virtual void ConstructSDandField();
/// A vector of the tracking detector regions
std::vector< G4Region* > fTrackerList;
std::vector<G4Region*> fTrackerList;
/// A vector of the the electromagnetic calorimeter regions
std::vector< G4Region* > fECalList;
std::vector<G4Region*> fECalList;
/// A vector of the the hadronic calorimeter regions
std::vector< G4Region* > fHCalList;
std::vector<G4Region*> fHCalList;
/// A vector of the muon detector regions
std::vector< G4Region* > fMuonList;
std::vector<G4Region*> fMuonList;
/// Messenger of the magnetic field
G4GlobalMagFieldMessenger* fMagFieldMessenger;
};
#endif
@@ -38,35 +38,44 @@
/// (dependent on the detector, parametrisation type and particle momentum).
/// @author Anna Zaborowska
class Par02DetectorParametrisation {
class Par02DetectorParametrisation
{
public:
/// A default constructor.
Par02DetectorParametrisation();
~Par02DetectorParametrisation();
/// A parametrisation type (CMS, ATLAS, ALEPH).
enum Parametrisation { eCMS, eATLAS, eALEPH };
enum Parametrisation
{
eCMS,
eATLAS,
eALEPH
};
/// A detector type (tracking detector, electromagnetic calorimeter,
/// hadronic calorimeter).
enum Detector { eTRACKER, eEMCAL, eHCAL };
enum Detector
{
eTRACKER,
eEMCAL,
eHCAL
};
/// Gets the resolution of a detector for a given particle.
/// @param aDetector A detector type.
/// @param aParametrisation A parametrisation type.
/// @param aMomentum A particle momentum.
G4double GetResolution( Detector aDetector, Parametrisation aParametrisation,
G4double aMomentum );
G4double GetResolution(Detector aDetector, Parametrisation aParametrisation,
G4double aMomentum);
/// Gets the efficiency of a detector for a given particle.
/// @param aDetector A detector type.
/// @param aParametrisation A parametrisation type.
/// @param aMomentum A particle momentum.
G4double GetEfficiency( Detector aDetector, Parametrisation aParametrisation,
G4double aMomentum );
G4double GetEfficiency(Detector aDetector, Parametrisation aParametrisation,
G4double aMomentum);
};
#endif
@@ -37,37 +37,35 @@
///
/// Defines the action at the beginning and at the end of each event.
/// It is invoked by a G4EventManager when a G4Event object is sent
/// (which contains primary vertices and particles created by the
/// (which contains primary vertices and particles created by the
/// Par02PrimaryGeneratorAction).
/// @author Anna Zaborowska
class Par02EventAction : public G4UserEventAction {
class Par02EventAction : public G4UserEventAction
{
public:
/// A default constructor.
/// A default constructor.
/// Sets the flag fSmear to true indicating that smearing will be performed.
Par02EventAction();
/// A constructor.
/// @param aSmear The flag indicating if smearing has to be done.
Par02EventAction( G4bool aSmear );
Par02EventAction(G4bool aSmear);
virtual ~Par02EventAction();
/// Defines the actions at the beginning of the event.
/// It sets the Par02EventInformation with fSmear flag.
/// Defines the actions at the beginning of the event.
/// It sets the Par02EventInformation with fSmear flag.
/// It creates all the ntuples defined in Par02Output singleton class.
virtual void BeginOfEventAction( const G4Event* );
virtual void BeginOfEventAction(const G4Event*);
/// Defines the actions at the end of the event.
virtual void EndOfEventAction( const G4Event* );
virtual void EndOfEventAction(const G4Event*);
private:
/// A flag indicating if smearing should be performed.
/// A flag indicating if smearing should be performed.
/// Passed to Par02EventInformation in BeginOfEventAction(const G4Event*).
G4bool fSmear;
};
#endif
@@ -38,34 +38,32 @@
/// Describes the information that can be associated with a G4Event class object.
/// @author Anna Zaborowska
class Par02EventInformation : public G4VUserEventInformation {
class Par02EventInformation : public G4VUserEventInformation
{
public:
/// A default constructor. Sets flag fDoSmearing to true.
Par02EventInformation();
/// A constructor.
/// @param aSmear The flag indicating if smearing should be done.
Par02EventInformation( G4bool aSmear );
Par02EventInformation(G4bool aSmear);
virtual ~Par02EventInformation();
/// Prints event information.
virtual void Print() const;
/// Sets the flag indicating if smearing should be done.
/// @param aSmear A boolean flag.
void SetDoSmearing( G4bool aSmear );
void SetDoSmearing(G4bool aSmear);
/// Gets the flag indicating if smearing should be done.
G4bool GetDoSmearing();
private:
/// A flag indicating if smearing should be performed.
/// A flag indicating if smearing should be performed.
/// It is read by implementations of G4VFastSimulationModel.
G4bool fDoSmearing;
};
#endif
@@ -30,65 +30,64 @@
#ifndef PAR02_EMCAL_FAST_SIM_MODEL_H
#define PAR02_EMCAL_FAST_SIM_MODEL_H
#include "G4VFastSimulationModel.hh"
#include "Par02DetectorParametrisation.hh"
#include "G4Step.hh"
#include "G4VFastSimulationModel.hh"
/// Shortcut to the ordinary tracking for electromagnetic calorimeters.
///
/// The fast simulation model describes what should be done instead of a
/// normal tracking. Instead of the ordinary tracking, a particle deposits
/// its energy at the entrance to the electromagnetic calorimeter and its value
/// is smeared (by Par02Smearer::SmearMomentum()). Based on G4
/// is smeared (by Par02Smearer::SmearMomentum()). Based on G4
/// examples/extended/parametrisations/Par01/include/Par01EMShowerModel.hh .
/// @author Anna Zaborowska
class Par02FastSimModelEMCal : public G4VFastSimulationModel {
class Par02FastSimModelEMCal : public G4VFastSimulationModel
{
public:
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
/// @param aParamType A parametrisation type.
Par02FastSimModelEMCal( G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType );
Par02FastSimModelEMCal(G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
Par02FastSimModelEMCal( G4String aModelName, G4Region* aEnvelope );
Par02FastSimModelEMCal(G4String aModelName, G4Region* aEnvelope);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
Par02FastSimModelEMCal( G4String aModelName );
Par02FastSimModelEMCal(G4String aModelName);
~Par02FastSimModelEMCal();
/// Checks if this model should be applied to this particle type.
/// @param aParticle A particle definition (type).
virtual G4bool IsApplicable( const G4ParticleDefinition& aParticle );
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticle);
/// Checks if the model should be applied, taking into account the
/// kinematics of a track.
/// @param aFastTrack A track.
virtual G4bool ModelTrigger( const G4FastTrack & aFastTrack );
/// Smears the energy deposit and saves it, together with the
virtual G4bool ModelTrigger(const G4FastTrack& aFastTrack);
/// Smears the energy deposit and saves it, together with the
/// position of the deposit, the electromagnetic calorimeter resolution
/// and efficiency to the Par02PrimaryParticleInformation.
/// @param aFastTrack A track.
/// @param aFastStep A step.
virtual void DoIt( const G4FastTrack& aFastTrack, G4FastStep& aFastStep );
virtual void DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep);
private:
/// A pointer to Par02DetectorParametrisation used to get the efficiency and
/// resolution of the detector for a given particle and parametrisation type.
Par02DetectorParametrisation* fCalculateParametrisation;
/// A parametrisation type.
Par02DetectorParametrisation::Parametrisation fParametrisation;
};
#endif
@@ -30,58 +30,58 @@
#ifndef PAR02_HCAL_FAST_SIM_MODEL_H
#define PAR02_HCAL_FAST_SIM_MODEL_H
#include "G4VFastSimulationModel.hh"
#include "Par02DetectorParametrisation.hh"
#include "G4Step.hh"
#include "G4VFastSimulationModel.hh"
/// Shortcut to the ordinary tracking for hadronic calorimeters.
///
/// Fast simulation model describes what should be done instead of a
/// normal tracking. Instead of the ordinary tracking, a particle deposits
/// its energy at the entrance to the hadronic calorimeter and its value
/// is smeared (by Par02Smearer::SmearMomentum()). Based on G4
/// is smeared (by Par02Smearer::SmearMomentum()). Based on G4
/// examples/extended/parametrisations/Par01/include/Par01EMShowerModel.hh .
/// @author Anna Zaborowska
class Par02FastSimModelHCal : public G4VFastSimulationModel {
class Par02FastSimModelHCal : public G4VFastSimulationModel
{
public:
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
/// @param aParamType A parametrisation type.
Par02FastSimModelHCal( G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType );
Par02FastSimModelHCal(G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
Par02FastSimModelHCal( G4String aModelName, G4Region* aEnvelope );
Par02FastSimModelHCal(G4String aModelName, G4Region* aEnvelope);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
Par02FastSimModelHCal( G4String aModelName );
Par02FastSimModelHCal(G4String aModelName);
~Par02FastSimModelHCal();
/// Checks if this model should be applied to this particle type.
/// @param aParticle A particle definition (type).
virtual G4bool IsApplicable( const G4ParticleDefinition& aParticle );
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticle);
/// Checks if the model should be applied, taking into account the
/// kinematics of a track.
/// @param aFastTrack A track.
virtual G4bool ModelTrigger( const G4FastTrack& aFastTrack );
virtual G4bool ModelTrigger(const G4FastTrack& aFastTrack);
/// Smears the energy deposit and saves it, together with the
/// position of the deposit, the hadronic calorimeter resolution and
/// efficiency to the Par02PrimaryParticleInformation.
/// @param aFastTrack A track.
/// @param aFastStep A step.
virtual void DoIt( const G4FastTrack& aFastTrack, G4FastStep& aFastStep );
virtual void DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep);
private:
/// A pointer to Par02DetectorParametrisation used to get the efficiency and
/// resolution of the detector for a given particle and parametrisation type.
Par02DetectorParametrisation* fCalculateParametrisation;
@@ -91,4 +91,3 @@ class Par02FastSimModelHCal : public G4VFastSimulationModel {
};
#endif
@@ -30,70 +30,69 @@
#ifndef PAR02_TRACKER_FAST_SIM_MODEL_H
#define PAR02_TRACKER_FAST_SIM_MODEL_H
#include "G4VFastSimulationModel.hh"
#include "Par02DetectorParametrisation.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4Step.hh"
#include "G4VFastSimulationModel.hh"
/// Shortcut to the ordinary tracking for tracking detectors.
///
/// The fast simulation model describes what should be done instead of a
/// normal tracking. Instead of the ordinary tracking, a particle momentum
/// at the entrance of the tracking detector is smeared
/// at the entrance of the tracking detector is smeared
/// (by Par02Smearer::SmearMomentum()) and the particle is placed at the
/// tracking detector exit, at the place it would reach without the change
/// of its momentum. Based on G4
/// of its momentum. Based on G4
/// examples/extended/parametrisations/Par01/include/Par01EMShowerModel.hh .
/// @author Anna Zaborowska
class Par02FastSimModelTracker : public G4VFastSimulationModel {
class Par02FastSimModelTracker : public G4VFastSimulationModel
{
public:
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
/// @param aParamType A parametrisation type.
Par02FastSimModelTracker( G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType );
Par02FastSimModelTracker(G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aParamType);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
/// @param aEnvelope A region where the model can take over the ordinary tracking.
Par02FastSimModelTracker( G4String aModelName, G4Region* aEnvelope );
Par02FastSimModelTracker(G4String aModelName, G4Region* aEnvelope);
/// A constructor.
/// @param aModelName A name of the fast simulation model.
Par02FastSimModelTracker( G4String aModelName );
Par02FastSimModelTracker(G4String aModelName);
~Par02FastSimModelTracker();
/// Checks if this model should be applied to this particle type.
/// @param aParticle A particle definition (type).
virtual G4bool IsApplicable( const G4ParticleDefinition& aParticle );
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticle);
/// Checks if the model should be applied taking into account the kinematics
/// of a track.
/// @param aFastTrack A track.
virtual G4bool ModelTrigger( const G4FastTrack& aFastTrack );
virtual G4bool ModelTrigger(const G4FastTrack& aFastTrack);
/// Calculates the final position (at the outer boundary of the tracking detector)
/// of a particle with the momentum at the entrance of the tracking detector.
/// Smears the particle momentum and saves it, together with the tracking detector
/// resolution and efficiency to the Par02PrimaryParticleInformation.
/// @param aFastTrack A track.
/// @param aFastStep A step.
virtual void DoIt( const G4FastTrack& aFastTrack, G4FastStep& aFastStep );
virtual void DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep);
private:
/// A pointer to Par02DetectorParametrisation used to get the efficiency and
/// resolution of the tracking detector for a given particle and
/// parametrisation type.
Par02DetectorParametrisation* fCalculateParametrisation;
/// A parametrisation type.
Par02DetectorParametrisation::Parametrisation fParametrisation;
};
#endif
@@ -39,49 +39,56 @@
/// Root output file.
/// @author Anna Zaborowska
class Par02Output {
class Par02Output
{
public:
/// Indicates to which ntuple to save the information.
enum SaveType { eNoSave, eSaveMC, eSaveTracker, eSaveEMCal, eSaveHCal };
enum SaveType
{
eNoSave,
eSaveMC,
eSaveTracker,
eSaveEMCal,
eSaveHCal
};
/// Allows the access to the unique Par02Output object.
/// @return A pointer to the Par02Output class.
static Par02Output* Instance();
/// Sets the file name of the output root file.
/// @param name The name of the file.
void SetFileName( G4String name );
void SetFileName(G4String name);
/// Gets the file name of the output root file.
/// @return The name of the file.
G4String GetFileName();
/// Sets fFileNameWithRunNo that indicates whether to add the run number
/// to the file name.
/// @param app If add the run number.
void AppendName( G4bool app );
void AppendName(G4bool app);
/// Calls the G4AnalysisManager::Instance(). It sets the file name of the
/// output file based on fFileName and fFileNameWithRunNo and opens the file.
/// @param runID A run number (to be added to file name if fFileNameWithRunNo
/// is true).
void StartAnalysis( G4int runID );
/// Calls the G4AnalysisManager::Instance().
void StartAnalysis(G4int runID);
/// Calls the G4AnalysisManager::Instance().
/// It writes to the output file and close it.
void EndAnalysis();
/// Creates Ntuples used to store information about particle (its ID, PDG code,
/// energy deposits, etc.). To be called for each event in Par02EventAction.
void CreateNtuples();
/// Creates histograms to combine information from all the events in the run.
/// To be called for each run in Par02RunAction.
void CreateHistograms();
/// Saves the information about the particle (track).
/// @param aWhatToSave enum indicating what kind of information to store
/// @param aWhatToSave enum indicating what kind of information to store
/// (in which ntuple).
/// @param aPartID A unique ID within event (taken Geant TrackID).
/// @param aPDG A PDG code of a particle.
@@ -89,39 +96,36 @@ class Par02Output {
/// position of energy deposit in calorimeter).
/// @param aResolution A resolution of the detector that was used.
/// @param aEfficiency An efficiency of the detector that was used.
/// @param aEnergy An energy deposit (for calorimeters only:
/// @param aEnergy An energy deposit (for calorimeters only:
/// Par02Output::SaveType::eEMCal or Par02Output::SaveType::eHCal).
void SaveTrack( SaveType aWhatToSave, G4int aPartID, G4int aPDG,
G4ThreeVector aVector, G4double aResolution = 0,
G4double aEfficiency = 1, G4double aEnergy = 0 ) ;
void SaveTrack(SaveType aWhatToSave, G4int aPartID, G4int aPDG, G4ThreeVector aVector,
G4double aResolution = 0, G4double aEfficiency = 1, G4double aEnergy = 0);
/// Fills the histogram.
/// @param HNo Number of a histogram (decided by the order of creation
/// in CreateHistograms(), the first one is 0).
/// @param value A value to be filled into the histogram.
void FillHistogram( G4int HNo, G4double value ) const;
void FillHistogram(G4int HNo, G4double value) const;
~Par02Output();
protected:
/// A default, protected constructor (due to singleton pattern).
Par02Output();
private:
/// The pointer to the only Par02Output class object.
static Par02Output* fPar02Output;
/// Current ntuple Id
/// Current ntuple Id
static G4ThreadLocal G4int fCurrentNtupleId;
/// A name of the output root file.
G4String fFileName;
/// If true, a run number should be added to the file. Default: false.
G4bool fFileNameWithRunNo;
/// A control value of particle ID to ensure that data saved to various ntuples
/// match the same particle. It is set when Monte Carlo information is saved
/// and checked for all the detectors.
@@ -129,4 +133,3 @@ class Par02Output {
};
#endif
@@ -35,25 +35,24 @@
/// Construction of a physics list.
///
/// A mandatory initialization class of the physics list.
/// A mandatory initialization class of the physics list.
/// For the purposes of fast simulation, only transportation, decays and
/// parametrisation is used. Based on G4
/// parametrisation is used. Based on G4
/// examples/extended/parametrisations/Par01/include/Par01PhysicsList.hh .
/// @author Anna Zaborowska
class Par02PhysicsList : public G4VUserPhysicsList {
class Par02PhysicsList : public G4VUserPhysicsList
{
public:
/// A default constructor. Sets the default cut value.
Par02PhysicsList();
virtual ~Par02PhysicsList();
protected:
/// Constructs particles: bosons, leptons, mesons, baryons and ions.
virtual void ConstructParticle();
/// Constructs physics processes: particle transportation, decays,
/// parametrisation (for the purpose of fast parametric simulation).
virtual void ConstructProcess();
@@ -66,13 +65,13 @@ class Par02PhysicsList : public G4VUserPhysicsList {
/// Constructs all leptons.
virtual void ConstructLeptons();
/// Constructs all mesons.
virtual void ConstructMesons();
/// Constructs all barions.
virtual void ConstructBaryons();
/// Constructs light ions.
virtual void ConstructIons();
@@ -81,12 +80,11 @@ class Par02PhysicsList : public G4VUserPhysicsList {
/// Adds decay process.
virtual void ConstructGeneral();
/// Adds the particle transport.
/// Adds the particle transport.
/// G4CoupledTransportation is used to allow the calculation of the expected
/// position of the particle within a G4VFastSimulationModel.
virtual void AddTransportation();
};
#endif
@@ -42,12 +42,13 @@ class G4Event;
/// event generator Pythia8 is used as generator and it is interfaced
/// to Geant4 via HepMC.
class Par02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
class Par02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
Par02PrimaryGeneratorAction();
~Par02PrimaryGeneratorAction();
virtual void GeneratePrimaries( G4Event* anEvent );
virtual void GeneratePrimaries(G4Event* anEvent);
G4ParticleGun* GetParticleGun();
private:
@@ -55,4 +56,3 @@ class Par02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
};
#endif
@@ -30,8 +30,8 @@
#ifndef PAR02_PRIMARY_PARTICLE_INFORMATION_H
#define PAR02_PRIMARY_PARTICLE_INFORMATION_H
#include "G4VUserPrimaryParticleInformation.hh"
#include "G4ThreeVector.hh"
#include "G4VUserPrimaryParticleInformation.hh"
#include "globals.hh"
/// Primary particle information
@@ -40,181 +40,170 @@
/// class object.
/// @author Anna Zaborowska
class Par02PrimaryParticleInformation : public G4VUserPrimaryParticleInformation {
class Par02PrimaryParticleInformation : public G4VUserPrimaryParticleInformation
{
public:
/// A constructor.
/// @param aID A unique particle ID within event.
/// @param aPDG A PDG code of the particle.
/// @param aMomentum An initial particle momentum (at the primary vertex).
Par02PrimaryParticleInformation( G4int aID, G4int aPDG, G4ThreeVector aMomentum );
Par02PrimaryParticleInformation(G4int aID, G4int aPDG, G4ThreeVector aMomentum);
virtual ~Par02PrimaryParticleInformation();
/// Prints the information about the particle.
virtual void Print() const;
/// Sets the initial particle momentum (from particle generator).
/// @param aMomentum The particle momentum.
inline void SetMCMomentum( G4ThreeVector aMomentum ) { fMomentumMC = aMomentum; };
inline void SetMCMomentum(G4ThreeVector aMomentum) { fMomentumMC = aMomentum; };
/// Gets the initial particle momentum (from particle generator).
inline G4ThreeVector GetMCMomentum() { return fMomentumMC; };
/// Sets the particle momentum at the entrance to the tracker detector.
/// @param aMomentum The particle momentum.
inline void SetTrackerMomentum( G4ThreeVector aMomentum )
{ fMomentumTracker = aMomentum; };
inline void SetTrackerMomentum(G4ThreeVector aMomentum) { fMomentumTracker = aMomentum; };
/// Gets the particle momentum at the entrance to the tracker detector.
inline G4ThreeVector GetTrackerMomentum() { return fMomentumTracker; }
/// Sets the tracker detector resolution.
/// Sets the tracker detector resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
/// @param aResolution The detector resolution
/// @param aResolution The detector resolution
/// (particle type and momentum dependent).
inline void SetTrackerResolution( G4double aResolution )
{ fResolutionTracker = aResolution; };
/// Gets the tracking detector resolution.
inline void SetTrackerResolution(G4double aResolution) { fResolutionTracker = aResolution; };
/// Gets the tracking detector resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
inline G4double GetTrackerResolution() { return fResolutionTracker; };
/// Sets the tracking detector efficiency.
/// Sets the tracking detector efficiency.
/// Currently not used (efficiency is 1).
/// @param aEfficiency The detector efficiency.
inline void SetTrackerEfficiency( G4double aEfficiency )
{ fEfficiencyTracker = aEfficiency; };
/// Gets the tracker detector efficiency.
inline void SetTrackerEfficiency(G4double aEfficiency) { fEfficiencyTracker = aEfficiency; };
/// Gets the tracker detector efficiency.
/// Currently not used (efficiency is 1).
inline G4double GetTrackerEfficiency() { return fEfficiencyTracker; };
/// Sets the position of the energy deposit in the electromagnetic calorimeter.
/// @param aPosition The position of the energy deposit.
inline void SetEMCalPosition( G4ThreeVector aPosition )
{ fPositionEMCal = aPosition; };
inline void SetEMCalPosition(G4ThreeVector aPosition) { fPositionEMCal = aPosition; };
/// Gets the position of the energy deposit in the electromagnetic calorimeter.
inline G4ThreeVector GetEMCalPosition() { return fPositionEMCal; };
/// Sets the energy deposit in the electromagnetic calorimeter.
/// @param aEnergy The energy deposited in the detector.
inline void SetEMCalEnergy( G4double aEnergy ) { fEnergyEMCal = aEnergy; };
inline void SetEMCalEnergy(G4double aEnergy) { fEnergyEMCal = aEnergy; };
/// Sets the energy deposit in the electromagnetic calorimeter.
inline G4double GetEMCalEnergy() { return fEnergyEMCal; };
/// Sets the electromagnetic calorimeter resolution.
/// Sets the electromagnetic calorimeter resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
/// @param aResolution The calorimeter resolution
/// @param aResolution The calorimeter resolution
/// (particle type and momentum dependent).
inline void SetEMCalResolution( G4double aResolution )
{ fResolutionEMCal = aResolution; };
/// Gets the electromagnetic calorimeter resolution.
inline void SetEMCalResolution(G4double aResolution) { fResolutionEMCal = aResolution; };
/// Gets the electromagnetic calorimeter resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
inline G4double GetEMCalResolution() { return fResolutionEMCal; };
/// Sets the electromagnetic calorimeter efficiency.
/// Sets the electromagnetic calorimeter efficiency.
/// Currently not used (efficiency is 1).
/// @param aEfficiency The detector efficiency.
inline void SetEMCalEfficiency( G4double aEfficiency )
{ fEfficiencyEMCal = aEfficiency; };
/// Gets the electromagnetic calorimeter efficiency.
inline void SetEMCalEfficiency(G4double aEfficiency) { fEfficiencyEMCal = aEfficiency; };
/// Gets the electromagnetic calorimeter efficiency.
/// Currently not used (efficiency is 1).
inline G4double GetEMCalEfficiency() { return fEfficiencyEMCal; };
/// Sets the position of the energy deposit in the hadronic calorimeter.
/// @param aPosition The position of the energy deposit.
inline void SetHCalPosition( G4ThreeVector aPosition )
{ fPositionHCal = aPosition; };
inline void SetHCalPosition(G4ThreeVector aPosition) { fPositionHCal = aPosition; };
/// Gets the position of the energy deposit in the hadronic calorimeter.
inline G4ThreeVector GetHCalPosition() { return fPositionHCal; };
/// Sets the energy deposit in the hadronic calorimeter.
/// @param aEnergy The energy deposited in the detector.
inline void SetHCalEnergy( G4double aEnergy ) { fEnergyHCal = aEnergy; };
inline void SetHCalEnergy(G4double aEnergy) { fEnergyHCal = aEnergy; };
/// Sets the energy deposit in the hadronic calorimeter.
inline G4double GetHCalEnergy() { return fEnergyHCal; };
/// Sets the hadronic calorimeter resolution.
/// Sets the hadronic calorimeter resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
/// @param aResolution The calorimeter resolution
/// @param aResolution The calorimeter resolution
/// (particle type and momentum dependent).
inline void SetHCalResolution( G4double aResolution )
{ fResolutionHCal = aResolution; };
/// Gets the hadronic calorimeter resolution.
inline void SetHCalResolution(G4double aResolution) { fResolutionHCal = aResolution; };
/// Gets the hadronic calorimeter resolution.
/// Currently equal to -1 if AtlFast type of smearing is used.
inline G4double GetHCalResolution() { return fResolutionHCal; };
/// Sets the hadronic calorimeter efficiency.
/// Sets the hadronic calorimeter efficiency.
/// Currently not used (efficiency is 1).
/// @param aEfficiency The detector efficiency.
inline void SetHCalEfficiency( G4double aEfficiency )
{ fEfficiencyHCal = aEfficiency; };
/// Gets the hadronic calorimeter efficiency.
inline void SetHCalEfficiency(G4double aEfficiency) { fEfficiencyHCal = aEfficiency; };
/// Gets the hadronic calorimeter efficiency.
/// Currently not used (efficiency is 1).
inline G4double GetHCalEfficiency() { return fEfficiencyHCal; };
/// Gets the particle unique ID (within event). Can be set only in the constructor.
inline G4int GetPartID() const { return fPartID; };
/// Gets the standard PDG code. Can be set only in the constructor.
inline G4int GetPDG() const { return fPDG; };
private:
/// A particle unique ID.
G4int fPartID;
/// A particle type (PDG code).
G4int fPDG;
/// A particle initial momentum (from particle generator).
G4ThreeVector fMomentumMC;
/// A particle momentum at the entrance to the tracking detector.
G4ThreeVector fMomentumTracker;
/// A resolution of the tracking detector.
G4double fResolutionTracker;
/// An efficiency of the tracking detector.
/// Currently not used (equal to 1).
G4double fEfficiencyTracker;
/// A position of the energy deposited in the electromagnetic calorimeter.
G4ThreeVector fPositionEMCal;
/// An energy deposited in the electromagnetic calorimeter.
G4double fEnergyEMCal;
/// The resolution of the electromagnetic calorimeter.
G4double fResolutionEMCal;
/// The efficiency of the electromagnetic calorimeter.
/// The efficiency of the electromagnetic calorimeter.
/// Currently not used (equal to 1).
G4double fEfficiencyEMCal;
/// A position of the energy deposited in the hadronic calorimeter.
G4ThreeVector fPositionHCal;
/// An energy deposited in the hadronic calorimeter.
G4double fEnergyHCal;
/// The resolution of the hadronic calorimeter.
G4double fResolutionHCal;
/// The efficiency of the hadronic calorimeter.
/// The efficiency of the hadronic calorimeter.
/// Currently not used (equal to 1).
G4double fEfficiencyHCal;
};
#endif
@@ -38,30 +38,29 @@ class G4Run;
/// Run action (before/after run processing).
///
/// Defines the action at the beginning and at the end of each run.
/// Content of G4Run cannot be changed.
/// Content of G4Run cannot be changed.
/// The class needs to be set in G4RunManager::SetUserAction().
/// @author Anna Zaborowska
class Par02RunAction : public G4UserRunAction {
class Par02RunAction : public G4UserRunAction
{
public:
/// A default constructor.
/// @param OutName The output root file name
/// @param OutName The output root file name
/// (it will store all the events within one run).
Par02RunAction( const G4String OutName = "SimpleOutput" );
Par02RunAction(const G4String OutName = "SimpleOutput");
virtual ~Par02RunAction();
/// Defines the actions at the beginning of the run.
/// Defines the actions at the beginning of the run.
/// It starts the analysis (create output root file) and create all the
/// histograms defined in Par02Output singleton class.
virtual void BeginOfRunAction( const G4Run* );
/// Defines the actions at the end of the run.
virtual void BeginOfRunAction(const G4Run*);
/// Defines the actions at the end of the run.
/// It ends the analysis (write and close output root file) via Par02Output
/// singleton class.
virtual void EndOfRunAction( const G4Run* );
virtual void EndOfRunAction(const G4Run*);
};
#endif
@@ -30,11 +30,12 @@
#ifndef PAR02_SMEARER_H
#define PAR02_SMEARER_H
#include "Par02Output.hh"
#include "globals.hh"
#include "G4Track.hh"
#include "CLHEP/Random/JamesRandom.h"
#include "CLHEP/Random/RandGauss.h"
#include "Par02Output.hh"
#include "G4Track.hh"
#include "globals.hh"
/// Smearing of the particle momentum or energy.
///
@@ -43,54 +44,51 @@
/// the momentum (energy) is smeared with Gaussian distribution.
/// @author Anna Zaborowska
class Par02Smearer {
class Par02Smearer
{
public:
/// Allows the access to the unique Par02Smearer class object.
/// @return A pointer to the Par02Smearer class.
static Par02Smearer* Instance();
/// Smears the momentum with a given resolution.
/// @param aTrack A track to smear.
/// @param aResolution A resolution. Gaussian smearing is done with a
/// @param aResolution A resolution. Gaussian smearing is done with a
/// given resolution as a standard deviation.
G4ThreeVector SmearMomentum( const G4Track* aTrack, G4double aResolution = -1 );
G4ThreeVector SmearMomentum(const G4Track* aTrack, G4double aResolution = -1);
/// Smears the energy deposit with a given resolution.
/// @param aTrack A track to smear.
/// @param aResolution A resolution. Gaussian smearing is done with a
/// given resolution as a standard deviation.
G4double SmearEnergy( const G4Track* aTrack, G4double aResolution = -1 );
G4double SmearEnergy(const G4Track* aTrack, G4double aResolution = -1);
/// First possible type of smearing. Smears the momentum with a given resolution.
/// @param aTrackOriginal A track to smear.
/// @param aResolution A resolution taken as a standard deviation of a
/// Gaussian distribution.
G4ThreeVector SmearGaussian( const G4Track* aTrackOriginal, G4double aResolution );
G4ThreeVector SmearGaussian(const G4Track* aTrackOriginal, G4double aResolution);
/// Returns a random number from a Gaussian distribution.
/// @param aMean The mean of the Gaussian distribution.
/// @param aStandardDeviation The standard deviation of a Gaussian distribution.
G4double Gauss( G4double aMean, G4double aStandardDeviation );
G4double Gauss(G4double aMean, G4double aStandardDeviation);
protected:
/// A default constructor.
Par02Smearer();
~Par02Smearer();
private:
/// A pointer to Par02Smearer object.
static Par02Smearer* fPar02Smearer;
/// CLHEP random engine.
CLHEP::HepRandomEngine* fRandomEngine;
/// CLHEP random engine used in gaussian smearing.
CLHEP::RandGauss* fRandomGauss;
};
#endif
@@ -39,9 +39,9 @@
/// The class needs to be set in G4RunManager::SetUserAction().
/// @author Anna Zaborowska
class Par02TrackingAction : public G4UserTrackingAction {
class Par02TrackingAction : public G4UserTrackingAction
{
public:
/// A default constructor.
Par02TrackingAction();
@@ -49,14 +49,13 @@ class Par02TrackingAction : public G4UserTrackingAction {
/// Defines the actions at the start of processing the track.
/// It checks the pseudorapidity range and if the particle is a primary.
virtual void PreUserTrackingAction( const G4Track* track );
/// Defines the actions at the end of processing the track.
virtual void PreUserTrackingAction(const G4Track* track);
/// Defines the actions at the end of processing the track.
/// It saves the information of MC data (PDG code, initial momentum),
/// tracker (momentum), EMCal and HCal (energy deposit and its position)
/// as well as resolution and efficiency for all the detectors.
virtual void PostUserTrackingAction( const G4Track* track );
virtual void PostUserTrackingAction(const G4Track* track);
};
#endif