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
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<define/>
@@ -73,18 +73,18 @@
</materials>
<solids>
<tube aunit="deg" deltaphi="360" lunit="mm" name="TrackerBarrel" rmax="1490" rmin="500" startphi="0" z="6000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalBarrel0x7ff5f9e7b300" rmax="2990" rmin="1500" startphi="0" z="6000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="TrackerBarrel" rmax="1490" rmin="500" startphi="0" z="6000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalBarrel0x7ff5f9e7b300" rmax="2990" rmin="1500" startphi="0" z="6000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalEndCap_10x7ff5f9e7b630" rmax="2990" rmin="1500" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalEndCap_20x7ff5f9e7bc30" rmax="2990" rmin="1500" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalForward_10x7ff5f9e7c050" rmax="3000" rmin="500" startphi="0" z="1000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalForward_20x7ff5f9e7c330" rmax="3000" rmin="500" startphi="0" z="1000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="ECalForward_20x7ff5f9e7c330" rmax="3000" rmin="500" startphi="0" z="1000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalBarrel0x7ff5f9e7cf80" rmax="8000" rmin="3000" startphi="0" z="6000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalEndCap_10x7ff5f9e7d3d0" rmax="8000" rmin="3000" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalEndCap_20x7ff5f9e7d6b0" rmax="8000" rmin="3000" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalForward_10x7ff5f9e7b840" rmax="4000" rmin="500" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalForward_20x7ff5f9e7dc40" rmax="4000" rmin="500" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="HCalForward_20x7ff5f9e7dc40" rmax="4000" rmin="500" startphi="0" z="2000"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonEndCap_10x7ff5f9e7eec0" rmax="15500" rmin="3000" startphi="0" z="100"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonEndCap_20x7ff5f9e7f1a0" rmax="15500" rmin="3000" startphi="0" z="100"/>
@@ -97,155 +97,155 @@
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonForward_30x7ff5f9e806d0" rmax="5000" rmin="500" startphi="0" z="100"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonForward_40x7ff5f9e809a0" rmax="5000" rmin="500" startphi="0" z="100"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonForward_50x7ff5f9e80c70" rmax="5000" rmin="500" startphi="0" z="100"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonForward_60x7ff5f9e80f40" rmax="5000" rmin="500" startphi="0" z="100"/>
<tube aunit="deg" deltaphi="360" lunit="mm" name="MuonForward_60x7ff5f9e80f40" rmax="5000" rmin="500" startphi="0" z="100"/>
<box lunit="mm" name="world_volume0x7ff5f9e788a0" x="100000" y="100000" z="200000"/>
</solids>
<structure>
<!-- Tracker -->
<structure>
<!-- Tracker -->
<volume name="TrackerBarrelLog">
<materialref ref="Beryllium0x7ff5f9e3baf0"/>
<solidref ref="TrackerBarrel"/>
<solidref ref="TrackerBarrel"/>
<auxiliary auxtype="FastSimModel" auxvalue="TrackerBarrel"/>
</volume>
<!-- EM Calorimeters -->
</volume>
<!-- EM Calorimeters -->
<volume name="ECalBarrel0x7ff5f9e7b420">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="ECalBarrel0x7ff5f9e7b300"/>
<solidref ref="ECalBarrel0x7ff5f9e7b300"/>
<auxiliary auxtype="FastSimModel" auxvalue="ECalBarrel"/>
</volume>
</volume>
<volume name="ECalEndCap_10x7ff5f9e7b710">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="ECalEndCap_10x7ff5f9e7b630"/>
<solidref ref="ECalEndCap_10x7ff5f9e7b630"/>
<auxiliary auxtype="FastSimModel" auxvalue="ECalEndCap1"/>
</volume>
<volume name="ECalEndCap_20x7ff5f9e7bd10">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="ECalEndCap_20x7ff5f9e7bc30"/>
<solidref ref="ECalEndCap_20x7ff5f9e7bc30"/>
<auxiliary auxtype="FastSimModel" auxvalue="ECalEndCap2"/>
</volume>
<volume name="ECalForward_10x7ff5f9e7c130">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="ECalForward_10x7ff5f9e7c050"/>
<solidref ref="ECalForward_10x7ff5f9e7c050"/>
<auxiliary auxtype="FastSimModel" auxvalue="ECalForward1"/>
</volume>
<volume name="ECalForward_20x7ff5f9e7c490">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="ECalForward_20x7ff5f9e7c330"/>
<solidref ref="ECalForward_20x7ff5f9e7c330"/>
<auxiliary auxtype="FastSimModel" auxvalue="ECalForward2"/>
</volume>
<!-- Hadron Calorimeters -->
</volume>
<!-- Hadron Calorimeters -->
<volume name="HCalBarrel0x7ff5f9e7d060">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="HCalBarrel0x7ff5f9e7cf80"/>
<solidref ref="HCalBarrel0x7ff5f9e7cf80"/>
<auxiliary auxtype="FastSimModel" auxvalue="HCalBarrel"/>
</volume>
<volume name="HCalEndCap_10x7ff5f9e7d4b0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="HCalEndCap_10x7ff5f9e7d3d0"/>
<solidref ref="HCalEndCap_10x7ff5f9e7d3d0"/>
<auxiliary auxtype="FastSimModel" auxvalue="HCalEndCap1"/>
</volume>
<volume name="HCalEndCap_20x7ff5f9e7d790">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="HCalEndCap_20x7ff5f9e7d6b0"/>
<solidref ref="HCalEndCap_20x7ff5f9e7d6b0"/>
<auxiliary auxtype="FastSimModel" auxvalue="HCalEndCap2"/>
</volume>
<volume name="HCalForward_10x7ff5f9e7daf0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="HCalForward_10x7ff5f9e7b840"/>
<solidref ref="HCalForward_10x7ff5f9e7b840"/>
<auxiliary auxtype="FastSimModel" auxvalue="HCalForward1"/>
</volume>
<volume name="HCalForward_20x7ff5f9e7b9d0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="HCalForward_20x7ff5f9e7dc40"/>
<solidref ref="HCalForward_20x7ff5f9e7dc40"/>
<auxiliary auxtype="FastSimModel" auxvalue="HCalForward2"/>
</volume>
<!-- Muon Detectors -->
</volume>
<!-- Muon Detectors -->
<volume name="MuonEndCap_10x7ff5f9e7efa0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_10x7ff5f9e7eec0"/>
<solidref ref="MuonEndCap_10x7ff5f9e7eec0"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap1"/>
</volume>
<volume name="MuonEndCap_20x7ff5f9e7f280">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_20x7ff5f9e7f1a0"/>
<solidref ref="MuonEndCap_20x7ff5f9e7f1a0"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap2"/>
</volume>
<volume name="MuonEndCap_30x7ff5f9e7f550">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_30x7ff5f9e7f470"/>
<solidref ref="MuonEndCap_30x7ff5f9e7f470"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap3"/>
</volume>
<volume name="MuonEndCap_40x7ff5f9e7f820">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_40x7ff5f9e7f740"/>
<solidref ref="MuonEndCap_40x7ff5f9e7f740"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap4"/>
</volume>
<volume name="MuonEndCap_50x7ff5f9e7faf0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_50x7ff5f9e7fa10"/>
<solidref ref="MuonEndCap_50x7ff5f9e7fa10"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap5"/>
</volume>
<volume name="MuonEndCap_60x7ff5f9e7fdc0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonEndCap_60x7ff5f9e7fce0"/>
<solidref ref="MuonEndCap_60x7ff5f9e7fce0"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonEndCap6"/>
</volume>
<volume name="MuonForward_10x7ff5f9e80200">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_10x7ff5f9e80120"/>
<solidref ref="MuonForward_10x7ff5f9e80120"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward1"/>
</volume>
<volume name="MuonForward_20x7ff5f9e804e0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_20x7ff5f9e80400"/>
<solidref ref="MuonForward_20x7ff5f9e80400"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward2"/>
</volume>
<volume name="MuonForward_30x7ff5f9e807b0">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_30x7ff5f9e806d0"/>
<solidref ref="MuonForward_30x7ff5f9e806d0"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward3"/>
</volume>
<volume name="MuonForward_40x7ff5f9e80a80">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_40x7ff5f9e809a0"/>
<solidref ref="MuonForward_40x7ff5f9e809a0"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward4"/>
</volume>
<volume name="MuonForward_50x7ff5f9e80d50">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_50x7ff5f9e80c70"/>
<solidref ref="MuonForward_50x7ff5f9e80c70"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward5"/>
</volume>
<volume name="MuonForward_60x7ff5f9e81020">
<materialref ref="Aluminum0x7ff5f9e42670"/>
<solidref ref="MuonForward_60x7ff5f9e80f40"/>
<solidref ref="MuonForward_60x7ff5f9e80f40"/>
<auxiliary auxtype="FastSimModel" auxvalue="MuonForward6"/>
</volume>
<!-- World and Physical Volumes -->
</volume>
<!-- World and Physical Volumes -->
<volume name="world_volume0x7ff5f9e77ca0">
<materialref ref="Air0x7ff5f9e72ea0"/>
<solidref ref="world_volume0x7ff5f9e788a0"/>
<!-- Tracker -->
<solidref ref="world_volume0x7ff5f9e788a0"/>
<!-- Tracker -->
<physvol name="TrackerBarrelVol">
<volumeref ref="TrackerBarrelLog"/>
</physvol>
<!-- EM Calorimeters -->
<!-- EM Calorimeters -->
<physvol name="ECalBarrel0x7ff5f9e7b560">
<volumeref ref="ECalBarrel0x7ff5f9e7b420"/>
@@ -265,9 +265,9 @@
<physvol name="ECalForward_20x7ff5f9e7c2e0">
<volumeref ref="ECalForward_20x7ff5f9e7c490"/>
<position name="ECalForward_20x7ff5f9e7c2e0_pos" unit="mm" x="0" y="0" z="-23700"/>
</physvol>
<!-- Hadron Calorimeters -->
</physvol>
<!-- Hadron Calorimeters -->
<physvol name="HCalBarrel0x7ff5f9e7d190">
<volumeref ref="HCalBarrel0x7ff5f9e7d060"/>
@@ -287,9 +287,9 @@
<physvol name="HCalForward_20x7ff5f9e7ba60">
<volumeref ref="HCalForward_20x7ff5f9e7b9d0"/>
<position name="HCalForward_20x7ff5f9e7ba60_pos" unit="mm" x="0" y="0" z="-27000"/>
</physvol>
<!-- Muon Detectors -->
</physvol>
<!-- Muon Detectors -->
<physvol name="MuonEndCap_10x7ff5f9e7f0d0">
<volumeref ref="MuonEndCap_10x7ff5f9e7efa0"/>
@@ -338,13 +338,13 @@
<physvol name="MuonForward_60x7ff5f9e81140">
<volumeref ref="MuonForward_60x7ff5f9e81020"/>
<position name="MuonForward_60x7ff5f9e81140_pos" unit="mm" x="0" y="0" z="-31500"/>
</physvol>
</physvol>
</volume>
</volume>
</structure>
<setup name="Default" version="1.0">
<world ref="world_volume0x7ff5f9e77ca0"/>
@@ -39,23 +39,21 @@
//
//-------------------------------------------------------------------
#include "G4Types.hh"
#include "G4UImanager.hh"
#include "G4RunManagerFactory.hh"
#include "Par02ActionInitialization.hh"
#include "Par02DetectorConstruction.hh"
#include "Par02PhysicsList.hh"
#include "Par02ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4RunManagerFactory.hh"
#include "G4Types.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
int main( int argc, char** argv ) {
int main(int argc, char** argv)
{
// Instantiate G4UIExecutive if interactive mode
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
@@ -67,16 +65,16 @@ int main( int argc, char** argv ) {
// Detector/mass geometry:
auto detector = new Par02DetectorConstruction();
runManager->SetUserInitialization( detector );
runManager->SetUserInitialization(detector);
// PhysicsList (including G4FastSimulationManagerProcess)
auto physicsList = new Par02PhysicsList;
runManager->SetUserInitialization( physicsList );
runManager->SetUserInitialization(physicsList);
//-------------------------------
// UserAction classes
//-------------------------------
runManager->SetUserInitialization( new Par02ActionInitialization );
runManager->SetUserInitialization(new Par02ActionInitialization);
// Initialize Run manager
runManager->Initialize();
@@ -88,17 +86,18 @@ int main( int argc, char** argv ) {
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
if ( ui ) {
if (ui) {
//--------------------------
// Define (G)UI
//--------------------------
ui->SessionStart();
delete ui;
} else {
}
else {
G4String command = "/control/execute ";
G4String fileName = argv[1];
G4UImanager * UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand( command+fileName );
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand(command + fileName);
}
// Free the store: user actions, physics_list and detector_description are
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -74,14 +74,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
Default graphics system is: TSG_OFFSCREEN (based on batch session).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
Use "vis/open" without parameters to get these defaults.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -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
@@ -28,28 +28,31 @@
/// \brief Implementation of the Par02ActionInitialization class
#include "Par02ActionInitialization.hh"
#include "Par02EventAction.hh"
#include "Par02PrimaryGeneratorAction.hh"
#include "Par02RunAction.hh"
#include "Par02EventAction.hh"
#include "Par02TrackingAction.hh"
#include "G4UIcommand.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02ActionInitialization::Par02ActionInitialization() :
G4VUserActionInitialization(), fFileName( "DefaultOutput" ), fSmear( true ) {}
Par02ActionInitialization::Par02ActionInitialization()
: G4VUserActionInitialization(), fFileName("DefaultOutput"), fSmear(true)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02ActionInitialization::Par02ActionInitialization( const G4String aOutName,
const G4String aSmear ) :
G4VUserActionInitialization(), fFileName( aOutName ),
fSmear( G4UIcommand::ConvertToBool( aSmear ) ) {}
Par02ActionInitialization::Par02ActionInitialization(const G4String aOutName, const G4String aSmear)
: G4VUserActionInitialization(), fFileName(aOutName), fSmear(G4UIcommand::ConvertToBool(aSmear))
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02ActionInitialization::Par02ActionInitialization( const G4String aOutName ) :
G4VUserActionInitialization(), fFileName( aOutName ), fSmear( true ) {}
Par02ActionInitialization::Par02ActionInitialization(const G4String aOutName)
: G4VUserActionInitialization(), fFileName(aOutName), fSmear(true)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -57,18 +60,19 @@ Par02ActionInitialization::~Par02ActionInitialization() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02ActionInitialization::BuildForMaster() const {
SetUserAction( new Par02RunAction( fFileName ) );
void Par02ActionInitialization::BuildForMaster() const
{
SetUserAction(new Par02RunAction(fFileName));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02ActionInitialization::Build() const {
SetUserAction( new Par02PrimaryGeneratorAction );
SetUserAction( new Par02RunAction( fFileName ) );
SetUserAction( new Par02EventAction( fSmear ) );
SetUserAction( new Par02TrackingAction );
void Par02ActionInitialization::Build() const
{
SetUserAction(new Par02PrimaryGeneratorAction);
SetUserAction(new Par02RunAction(fFileName));
SetUserAction(new Par02EventAction(fSmear));
SetUserAction(new Par02TrackingAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,13 +28,13 @@
/// \brief Implementation of the Par02DetectorConstruction class
#include "Par02DetectorConstruction.hh"
#include "G4ProductionCuts.hh"
#include "G4SystemOfUnits.hh"
#include "G4RegionStore.hh"
#include "G4AutoDelete.hh"
#include "G4GDMLParser.hh"
#include "G4AutoDelete.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4ProductionCuts.hh"
#include "G4RegionStore.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,66 +46,65 @@ Par02DetectorConstruction::~Par02DetectorConstruction() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* Par02DetectorConstruction::Construct() {
G4VPhysicalVolume* Par02DetectorConstruction::Construct()
{
G4GDMLParser parser;
parser.Read( "Par02FullDetector.gdml" );
parser.Read("Par02FullDetector.gdml");
G4cout << "Geometry loaded from file .......Par02FullDetector.gdml " << G4endl;
// This GDML detector description uses the auxiliary information part to store
// information regarding which Geant4 volumes have a fast simulation model.
const G4GDMLAuxMapType* aAuxMap = parser.GetAuxMap();
for ( G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin();
iter != aAuxMap->end(); ++iter ) {
for ( G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
vit != (*iter).second.end(); ++vit ) {
if ( (*vit).type == "FastSimModel" ) {
for (G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin(); iter != aAuxMap->end(); ++iter) {
for (G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
vit != (*iter).second.end(); ++vit)
{
if ((*vit).type == "FastSimModel") {
G4LogicalVolume* myvol = (*iter).first;
if ( ( myvol->GetName() ).find( "Tracker" ) != std::string::npos ) {
fTrackerList.push_back( new G4Region( myvol->GetName() ) );
fTrackerList.back()->AddRootLogicalVolume( myvol );
if ((myvol->GetName()).find("Tracker") != std::string::npos) {
fTrackerList.push_back(new G4Region(myvol->GetName()));
fTrackerList.back()->AddRootLogicalVolume(myvol);
G4cout << G4endl << "tracker !!!" << G4endl;
} else if ( ( myvol->GetName() ).find( "HCal" ) != std::string::npos ) {
fHCalList.push_back( new G4Region( myvol->GetName() ) );
fHCalList.back()->AddRootLogicalVolume( myvol );
}
else if ((myvol->GetName()).find("HCal") != std::string::npos) {
fHCalList.push_back(new G4Region(myvol->GetName()));
fHCalList.back()->AddRootLogicalVolume(myvol);
G4cout << G4endl << "hcal !!!" << G4endl;
} else if ( ( myvol->GetName() ).find( "ECal" ) != std::string::npos ) {
fECalList.push_back( new G4Region( myvol->GetName() ) );
fECalList.back()->AddRootLogicalVolume( myvol );
}
else if ((myvol->GetName()).find("ECal") != std::string::npos) {
fECalList.push_back(new G4Region(myvol->GetName()));
fECalList.back()->AddRootLogicalVolume(myvol);
G4cout << G4endl << "ecal !!!" << G4endl;
} else if ( ( myvol->GetName() ).find( "Muon" ) != std::string::npos ) {
fMuonList.push_back( new G4Region( myvol->GetName() ) );
fMuonList.back()->AddRootLogicalVolume( myvol );
} else {
}
else if ((myvol->GetName()).find("Muon") != std::string::npos) {
fMuonList.push_back(new G4Region(myvol->GetName()));
fMuonList.back()->AddRootLogicalVolume(myvol);
}
else {
G4cout << G4endl << "NOT A KNOWN DETECTOR !!!" << G4endl;
}
}
}
}
for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() );
iterTracker++ ) {
fTrackerList[ iterTracker ]->SetProductionCuts( new G4ProductionCuts() );
fTrackerList[ iterTracker ]->GetProductionCuts()->SetProductionCut
( 1.0* ( ( *fTrackerList[ iterTracker ]->GetRootLogicalVolumeIterator() )->
GetMaterial()->GetRadlen() ) );
fTrackerList[ iterTracker ]->GetProductionCuts()->
SetProductionCut( 1.0*m, idxG4GammaCut );
for (G4int iterTracker = 0; iterTracker < G4int(fTrackerList.size()); iterTracker++) {
fTrackerList[iterTracker]->SetProductionCuts(new G4ProductionCuts());
fTrackerList[iterTracker]->GetProductionCuts()->SetProductionCut(
1.0
* ((*fTrackerList[iterTracker]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
fTrackerList[iterTracker]->GetProductionCuts()->SetProductionCut(1.0 * m, idxG4GammaCut);
}
for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
fECalList[ iterECal ]->SetProductionCuts( new G4ProductionCuts() );
fECalList[ iterECal ]->GetProductionCuts()->SetProductionCut
( 0.5* ( ( *fECalList[ iterECal ]->GetRootLogicalVolumeIterator() )->
GetMaterial()->GetRadlen() ) );
fECalList[ iterECal ]->GetProductionCuts()->
SetProductionCut( 0.1*m, idxG4GammaCut );
for (G4int iterECal = 0; iterECal < G4int(fECalList.size()); iterECal++) {
fECalList[iterECal]->SetProductionCuts(new G4ProductionCuts());
fECalList[iterECal]->GetProductionCuts()->SetProductionCut(
0.5 * ((*fECalList[iterECal]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
fECalList[iterECal]->GetProductionCuts()->SetProductionCut(0.1 * m, idxG4GammaCut);
}
for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
fHCalList[ iterHCal ]->SetProductionCuts( new G4ProductionCuts() );
fHCalList[ iterHCal ]->GetProductionCuts()->SetProductionCut(
0.5* ( ( *fHCalList[iterHCal]->GetRootLogicalVolumeIterator() )->
GetMaterial()->GetRadlen() ) );
fHCalList[ iterHCal ]->GetProductionCuts()->
SetProductionCut( 1.0*m, idxG4GammaCut );
for (G4int iterHCal = 0; iterHCal < G4int(fHCalList.size()); iterHCal++) {
fHCalList[iterHCal]->SetProductionCuts(new G4ProductionCuts());
fHCalList[iterHCal]->GetProductionCuts()->SetProductionCut(
0.5 * ((*fHCalList[iterHCal]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
fHCalList[iterHCal]->GetProductionCuts()->SetProductionCut(1.0 * m, idxG4GammaCut);
}
// Returns the pointer to the physical world.
@@ -114,37 +113,34 @@ G4VPhysicalVolume* Par02DetectorConstruction::Construct() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02DetectorConstruction::ConstructSDandField() {
for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() );
iterTracker++ ) {
void Par02DetectorConstruction::ConstructSDandField()
{
for (G4int iterTracker = 0; iterTracker < G4int(fTrackerList.size()); iterTracker++) {
// Bound the fast simulation model for the tracker subdetector
// to all the corresponding Geant4 regions
Par02FastSimModelTracker* fastSimModelTracker
= new Par02FastSimModelTracker( "fastSimModelTracker", fTrackerList[ iterTracker ],
Par02DetectorParametrisation::eCMS );
Par02FastSimModelTracker* fastSimModelTracker = new Par02FastSimModelTracker(
"fastSimModelTracker", fTrackerList[iterTracker], Par02DetectorParametrisation::eCMS);
// Register the fast simulation model for deleting
G4AutoDelete::Register(fastSimModelTracker);
}
for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
for (G4int iterECal = 0; iterECal < G4int(fECalList.size()); iterECal++) {
// Bound the fast simulation model for the electromagnetic calorimeter
// to all the corresponding Geant4 regions
Par02FastSimModelEMCal* fastSimModelEMCal
= new Par02FastSimModelEMCal( "fastSimModelEMCal", fECalList[ iterECal ],
Par02DetectorParametrisation::eCMS );
Par02FastSimModelEMCal* fastSimModelEMCal = new Par02FastSimModelEMCal(
"fastSimModelEMCal", fECalList[iterECal], Par02DetectorParametrisation::eCMS);
// Register the fast simulation model for deleting
G4AutoDelete::Register(fastSimModelEMCal);
}
for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
for (G4int iterHCal = 0; iterHCal < G4int(fHCalList.size()); iterHCal++) {
// Bound the fast simulation model for the hadronic calorimeter
// to all the corresponding Geant4 regions
Par02FastSimModelHCal* fastSimModelHCal
= new Par02FastSimModelHCal( "fastSimModelHCal", fHCalList[ iterHCal ],
Par02DetectorParametrisation::eCMS );
Par02FastSimModelHCal* fastSimModelHCal = new Par02FastSimModelHCal(
"fastSimModelHCal", fHCalList[iterHCal], Par02DetectorParametrisation::eCMS);
// Register the fast simulation model for deleting
G4AutoDelete::Register( fastSimModelHCal );
G4AutoDelete::Register(fastSimModelHCal);
}
// Currently we don't have a fast muon simulation model to be bound
// to all the corresponding Geant4 regions.
@@ -153,9 +149,8 @@ void Par02DetectorConstruction::ConstructSDandField() {
// Add global magnetic field
G4ThreeVector fieldValue = G4ThreeVector();
fMagFieldMessenger = new G4GlobalMagFieldMessenger( fieldValue );
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
fMagFieldMessenger->SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,6 +28,7 @@
/// \brief Implementation of the Par02DetectorParametrisation class
#include "Par02DetectorParametrisation.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
@@ -41,51 +42,53 @@ Par02DetectorParametrisation::~Par02DetectorParametrisation() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double Par02DetectorParametrisation::GetResolution( Detector aDetector,
Parametrisation aParam,
G4double aMomentum ) {
G4double Par02DetectorParametrisation::GetResolution(Detector aDetector, Parametrisation aParam,
G4double aMomentum)
{
aMomentum /= GeV; // To make sure momentum's unit is GeV
G4double res = 1.0;
if ( aParam == eCMS ) {
switch ( aDetector ) {
case Par02DetectorParametrisation::eTRACKER :
if (aParam == eCMS) {
switch (aDetector) {
case Par02DetectorParametrisation::eTRACKER:
res = 0.013;
break;
case Par02DetectorParametrisation::eEMCAL :
res = std::sqrt( std::pow( 0.03 / std::sqrt( aMomentum ), 2 ) // stochastic
+ std::pow( 0.12 / aMomentum, 2 ) // noise
+ std::pow( 0.003, 2 ) ); // constant
case Par02DetectorParametrisation::eEMCAL:
res = std::sqrt(std::pow(0.03 / std::sqrt(aMomentum), 2) // stochastic
+ std::pow(0.12 / aMomentum, 2) // noise
+ std::pow(0.003, 2)); // constant
break;
case Par02DetectorParametrisation::eHCAL :
res = std::sqrt( std::pow( 1.1 / std::sqrt( aMomentum ), 2 ) // stochastic
+ std::pow( 0.09, 2 ) ); // constant
case Par02DetectorParametrisation::eHCAL:
res = std::sqrt(std::pow(1.1 / std::sqrt(aMomentum), 2) // stochastic
+ std::pow(0.09, 2)); // constant
break;
}
} else if ( aParam == eATLAS ) {
switch ( aDetector ) {
case Par02DetectorParametrisation::eTRACKER :
}
else if (aParam == eATLAS) {
switch (aDetector) {
case Par02DetectorParametrisation::eTRACKER:
res = 0.01;
break;
case Par02DetectorParametrisation::eEMCAL :
res = std::sqrt( std::pow( 0.1 / std::sqrt( aMomentum ), 2 ) // stochastic
+ std::pow( 0.0017, 2 ) ); // constant
case Par02DetectorParametrisation::eEMCAL:
res = std::sqrt(std::pow(0.1 / std::sqrt(aMomentum), 2) // stochastic
+ std::pow(0.0017, 2)); // constant
break;
case Par02DetectorParametrisation::eHCAL :
res = std::sqrt( std::pow( 0.55 / std::sqrt( aMomentum ), 2 ) // stochastic
+ std::pow( 0.06, 2 ) ); // constant
case Par02DetectorParametrisation::eHCAL:
res = std::sqrt(std::pow(0.55 / std::sqrt(aMomentum), 2) // stochastic
+ std::pow(0.06, 2)); // constant
break;
}
} else if ( aParam == eALEPH ) {
switch ( aDetector ) {
case Par02DetectorParametrisation::eTRACKER :
}
else if (aParam == eALEPH) {
switch (aDetector) {
case Par02DetectorParametrisation::eTRACKER:
res = 0.01;
break;
case Par02DetectorParametrisation::eEMCAL :
res = std::sqrt( std::pow( 0.18 / std::sqrt( aMomentum ), 2 ) // stochastic
+ std::pow( 0.009, 2 ) ); // constant
case Par02DetectorParametrisation::eEMCAL:
res = std::sqrt(std::pow(0.18 / std::sqrt(aMomentum), 2) // stochastic
+ std::pow(0.009, 2)); // constant
break;
case Par02DetectorParametrisation::eHCAL :
res = 0.85 / std::sqrt( aMomentum ); // stochastic
case Par02DetectorParametrisation::eHCAL:
res = 0.85 / std::sqrt(aMomentum); // stochastic
break;
}
}
@@ -94,19 +97,19 @@ G4double Par02DetectorParametrisation::GetResolution( Detector aDetector,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double Par02DetectorParametrisation::GetEfficiency( Detector aDetector,
Parametrisation /*aParam*/,
G4double /*aMomentum*/ ) {
G4double Par02DetectorParametrisation::GetEfficiency(Detector aDetector, Parametrisation /*aParam*/,
G4double /*aMomentum*/)
{
// For the time being, we set the efficiency to 1.0
G4double eff = 1.0;
switch ( aDetector ) {
case Par02DetectorParametrisation::eTRACKER :
switch (aDetector) {
case Par02DetectorParametrisation::eTRACKER:
eff = 1.0;
break;
case Par02DetectorParametrisation::eEMCAL :
case Par02DetectorParametrisation::eEMCAL:
eff = 1.0;
break;
case Par02DetectorParametrisation::eHCAL :
case Par02DetectorParametrisation::eHCAL:
eff = 1.0;
break;
}
@@ -114,4 +117,3 @@ G4double Par02DetectorParametrisation::GetEfficiency( Detector aDetector,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,23 +28,25 @@
/// \brief Implementation of the Par02EventAction class
#include "Par02EventAction.hh"
#include "Par02EventInformation.hh"
#include "Par02RunAction.hh"
#include "Par02Output.hh"
#include "G4RunManager.hh"
#include "Par02RunAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02EventAction::Par02EventAction() : G4UserEventAction(), fSmear( 1 ) {}
Par02EventAction::Par02EventAction() : G4UserEventAction(), fSmear(1) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02EventAction::Par02EventAction( G4bool aSmear ) :
G4UserEventAction(), fSmear( aSmear ) {}
Par02EventAction::Par02EventAction(G4bool aSmear) : G4UserEventAction(), fSmear(aSmear) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,15 +54,14 @@ Par02EventAction::~Par02EventAction() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02EventAction::BeginOfEventAction( const G4Event* /*aEvent*/ ) {
G4EventManager::GetEventManager()->SetUserInformation(
new Par02EventInformation( fSmear ) );
void Par02EventAction::BeginOfEventAction(const G4Event* /*aEvent*/)
{
G4EventManager::GetEventManager()->SetUserInformation(new Par02EventInformation(fSmear));
Par02Output::Instance()->CreateNtuples();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02EventAction::EndOfEventAction( const G4Event* /*aEvent*/ ) {}
void Par02EventAction::EndOfEventAction(const G4Event* /*aEvent*/) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,11 +31,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02EventInformation::Par02EventInformation() : fDoSmearing( true ) {}
Par02EventInformation::Par02EventInformation() : fDoSmearing(true) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02EventInformation::Par02EventInformation( G4bool aSmear ): fDoSmearing( aSmear ) {}
Par02EventInformation::Par02EventInformation(G4bool aSmear) : fDoSmearing(aSmear) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,22 +43,23 @@ Par02EventInformation::~Par02EventInformation() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02EventInformation::SetDoSmearing( G4bool aSmear ) {
void Par02EventInformation::SetDoSmearing(G4bool aSmear)
{
fDoSmearing = aSmear;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02EventInformation::GetDoSmearing() {
G4bool Par02EventInformation::GetDoSmearing()
{
return fDoSmearing;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02EventInformation::Print() const {
G4cout << "Par02EventInformation: " << G4endl
<< "do smearing: " << fDoSmearing << G4endl;
void Par02EventInformation::Print() const
{
G4cout << "Par02EventInformation: " << G4endl << "do smearing: " << fDoSmearing << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,42 +28,46 @@
/// \brief Implementation of the Par02FastSimModelEMCal class
#include "Par02FastSimModelEMCal.hh"
#include "Par02EventInformation.hh"
#include "Par02Output.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "Par02Smearer.hh"
#include "Par02Output.hh"
#include "G4Track.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4AnalysisManager.hh"
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Event.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Track.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName,
G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( aType ) {}
Par02FastSimModelEMCal::Par02FastSimModelEMCal(G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aType)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(aType)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName,
G4Region* aEnvelope ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelEMCal::Par02FastSimModelEMCal(G4String aModelName, G4Region* aEnvelope)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName ) :
G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelEMCal::Par02FastSimModelEMCal(G4String aModelName)
: G4VFastSimulationModel(aModelName),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,74 +75,87 @@ Par02FastSimModelEMCal::~Par02FastSimModelEMCal() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelEMCal::IsApplicable(
const G4ParticleDefinition& aParticleType ) {
G4bool Par02FastSimModelEMCal::IsApplicable(const G4ParticleDefinition& aParticleType)
{
// Applicable for electrons, positrons, and gammas
return &aParticleType == G4Electron::Definition() ||
&aParticleType == G4Positron::Definition() ||
&aParticleType == G4Gamma::Definition();
return &aParticleType == G4Electron::Definition() || &aParticleType == G4Positron::Definition()
|| &aParticleType == G4Gamma::Definition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelEMCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
G4bool Par02FastSimModelEMCal::ModelTrigger(const G4FastTrack& /*aFastTrack*/)
{
return true; // No kinematical restrictions to apply the parametrisation
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02FastSimModelEMCal::DoIt( const G4FastTrack& aFastTrack,
G4FastStep& aFastStep ) {
//G4cout << " ________EMCal model triggered _________" << G4endl;
void Par02FastSimModelEMCal::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep)
{
// G4cout << " ________EMCal model triggered _________" << G4endl;
// Kill the parameterised particle at the entrance of the electromagnetic calorimeter
aFastStep.KillPrimaryTrack();
aFastStep.ProposePrimaryTrackPathLength( 0.0 );
aFastStep.ProposePrimaryTrackPathLength(0.0);
G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
// Consider only primary tracks (do nothing else for secondary e-, e+, gammas)
G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition();
if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
auto info = (Par02EventInformation*)
G4EventManager::GetEventManager()->GetUserInformation();
if ( info->GetDoSmearing() ) {
if (!aFastTrack.GetPrimaryTrack()->GetParentID()) {
auto info = (Par02EventInformation*)G4EventManager::GetEventManager()->GetUserInformation();
if (info->GetDoSmearing()) {
// Smearing according to the electromagnetic calorimeter resolution
G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
G4double res = fCalculateParametrisation->GetResolution(
Par02DetectorParametrisation::eEMCAL, fParametrisation, Porg.mag() );
G4double eff = fCalculateParametrisation->GetEfficiency(
Par02DetectorParametrisation::eEMCAL, fParametrisation, Porg.mag() );
G4double res = fCalculateParametrisation->GetResolution(Par02DetectorParametrisation::eEMCAL,
fParametrisation, Porg.mag());
G4double eff = fCalculateParametrisation->GetEfficiency(Par02DetectorParametrisation::eEMCAL,
fParametrisation, Porg.mag());
G4double Esm;
Esm = std::abs( Par02Smearer::Instance()->
SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) );
Par02Output::Instance()->FillHistogram( 1, (Esm/MeV) / (Edep/MeV) );
Esm = std::abs(Par02Smearer::Instance()->SmearEnergy(aFastTrack.GetPrimaryTrack(), res));
Par02Output::Instance()->FillHistogram(1, (Esm / MeV) / (Edep / MeV));
// Setting the values of Pos, Esm, res and eff
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetEMCalPosition( Pos );
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetEMCalEnergy( Esm );
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetEMCalResolution( res );
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetEMCalEfficiency( eff );
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetEMCalPosition(Pos);
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetEMCalEnergy(Esm);
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetEMCalResolution(res);
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetEMCalEfficiency(eff);
// The (smeared) energy of the particle is deposited in the step
// (which corresponds to the entrance of the electromagnetic calorimeter)
aFastStep.ProposeTotalEnergyDeposited( Esm );
} else {
aFastStep.ProposeTotalEnergyDeposited(Esm);
}
else {
// No smearing: simply setting the value of Edep
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetEMCalEnergy( Edep );
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetEMCalEnergy(Edep);
// The (initial) energy of the particle is deposited in the step
// (which corresponds to the entrance of the electromagnetic calorimeter)
aFastStep.ProposeTotalEnergyDeposited( Edep );
aFastStep.ProposeTotalEnergyDeposited(Edep);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,38 +28,43 @@
/// \brief Implementation of the Par02FastSimModelHCal class
#include "Par02FastSimModelHCal.hh"
#include "Par02EventInformation.hh"
#include "Par02Output.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "Par02Smearer.hh"
#include "Par02Output.hh"
#include "G4Track.hh"
#include "G4AnalysisManager.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4AnalysisManager.hh"
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4Track.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName,
G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( aType ) {}
Par02FastSimModelHCal::Par02FastSimModelHCal(G4String aModelName, G4Region* aEnvelope,
Par02DetectorParametrisation::Parametrisation aType)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(aType)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName,
G4Region* aEnvelope ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelHCal::Par02FastSimModelHCal(G4String aModelName, G4Region* aEnvelope)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName ) :
G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelHCal::Par02FastSimModelHCal(G4String aModelName)
: G4VFastSimulationModel(aModelName),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -67,78 +72,77 @@ Par02FastSimModelHCal::~Par02FastSimModelHCal() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelHCal::IsApplicable( const G4ParticleDefinition& aParticleType ) {
G4bool Par02FastSimModelHCal::IsApplicable(const G4ParticleDefinition& aParticleType)
{
G4bool isOk = false;
// Applicable to all hadrons, i.e. any particle made of quarks
if ( aParticleType.GetQuarkContent(1) +
aParticleType.GetQuarkContent(2) +
aParticleType.GetQuarkContent(3) +
aParticleType.GetQuarkContent(4) +
aParticleType.GetQuarkContent(5) +
aParticleType.GetQuarkContent(6) != 0 ) {
if (aParticleType.GetQuarkContent(1) + aParticleType.GetQuarkContent(2)
+ aParticleType.GetQuarkContent(3) + aParticleType.GetQuarkContent(4)
+ aParticleType.GetQuarkContent(5) + aParticleType.GetQuarkContent(6)
!= 0)
{
isOk = true;
}
return isOk;
return isOk;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelHCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
G4bool Par02FastSimModelHCal::ModelTrigger(const G4FastTrack& /*aFastTrack*/)
{
return true; // No kinematical restrictions to apply the parametrisation
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02FastSimModelHCal::DoIt( const G4FastTrack& aFastTrack,
G4FastStep& aFastStep ) {
//G4cout << " ________HCal model triggered _________" << G4endl;
void Par02FastSimModelHCal::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep)
{
// G4cout << " ________HCal model triggered _________" << G4endl;
// Kill the parameterised particle at the entrance of the hadronic calorimeter
aFastStep.KillPrimaryTrack();
aFastStep.ProposePrimaryTrackPathLength( 0.0 );
aFastStep.ProposePrimaryTrackPathLength(0.0);
G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
// Consider only primary tracks (do nothing else for secondary hadrons)
G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition();
if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
auto info = (Par02EventInformation*)
G4EventManager::GetEventManager()->GetUserInformation();
if ( info->GetDoSmearing() ) {
if (!aFastTrack.GetPrimaryTrack()->GetParentID()) {
auto info = (Par02EventInformation*)G4EventManager::GetEventManager()->GetUserInformation();
if (info->GetDoSmearing()) {
// Smearing according to the hadronic calorimeter resolution
G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
G4double res = fCalculateParametrisation->
GetResolution( Par02DetectorParametrisation::eHCAL,
fParametrisation, Porg.mag() );
G4double eff = fCalculateParametrisation->
GetEfficiency( Par02DetectorParametrisation::eHCAL,
fParametrisation, Porg.mag() );
G4double res = fCalculateParametrisation->GetResolution(Par02DetectorParametrisation::eHCAL,
fParametrisation, Porg.mag());
G4double eff = fCalculateParametrisation->GetEfficiency(Par02DetectorParametrisation::eHCAL,
fParametrisation, Porg.mag());
G4double Esm;
Esm = std::abs( Par02Smearer::Instance()->
SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) );
Par02Output::Instance()->FillHistogram( 2, (Esm/MeV) / (Edep/MeV) );
Esm = std::abs(Par02Smearer::Instance()->SmearEnergy(aFastTrack.GetPrimaryTrack(), res));
Par02Output::Instance()->FillHistogram(2, (Esm / MeV) / (Edep / MeV));
// Setting the values of Pos, Esm, res and eff
auto primaryInfo=
static_cast<Par02PrimaryParticleInformation*>(
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) ;
primaryInfo->SetHCalPosition( Pos );
primaryInfo->SetHCalEnergy( Esm );
primaryInfo->SetHCalResolution( res );
primaryInfo->SetHCalEfficiency( eff );
auto primaryInfo = static_cast<Par02PrimaryParticleInformation*>(
(aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle())
->GetUserInformation());
primaryInfo->SetHCalPosition(Pos);
primaryInfo->SetHCalEnergy(Esm);
primaryInfo->SetHCalResolution(res);
primaryInfo->SetHCalEfficiency(eff);
// The (smeared) energy of the particle is deposited in the step
// (which corresponds to the entrance of the hadronic calorimeter)
aFastStep.ProposeTotalEnergyDeposited( Esm );
} else {
aFastStep.ProposeTotalEnergyDeposited(Esm);
}
else {
// No smearing: simply setting the value of Edep
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetHCalEnergy( Edep );
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetHCalEnergy(Edep);
// The (initial) energy of the particle is deposited in the step
// (which corresponds to the entrance of the hadronic calorimeter)
aFastStep.ProposeTotalEnergyDeposited( Edep );
aFastStep.ProposeTotalEnergyDeposited(Edep);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,46 +28,49 @@
/// \brief Implementation of the Par02FastSimModelTracker class
#include "Par02FastSimModelTracker.hh"
#include "Par02EventInformation.hh"
#include "Par02Output.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "Par02Smearer.hh"
#include "Par02Output.hh"
#include "G4Track.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4AnalysisManager.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
#include "G4PathFinder.hh"
#include "G4Event.hh"
#include "G4FieldTrack.hh"
#include "G4FieldTrackUpdator.hh"
#include "G4Gamma.hh"
#include "G4PathFinder.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Track.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelTracker::Par02FastSimModelTracker( G4String aModelName,
G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( aType ) {}
Par02FastSimModelTracker::Par02FastSimModelTracker(
G4String aModelName, G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(aType)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelTracker::Par02FastSimModelTracker( G4String aModelName,
G4Region* aEnvelope ) :
G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelTracker::Par02FastSimModelTracker(G4String aModelName, G4Region* aEnvelope)
: G4VFastSimulationModel(aModelName, aEnvelope),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02FastSimModelTracker::Par02FastSimModelTracker( G4String aModelName ) :
G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
fParametrisation( Par02DetectorParametrisation::eCMS ) {}
Par02FastSimModelTracker::Par02FastSimModelTracker(G4String aModelName)
: G4VFastSimulationModel(aModelName),
fCalculateParametrisation(),
fParametrisation(Par02DetectorParametrisation::eCMS)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -75,86 +78,89 @@ Par02FastSimModelTracker::~Par02FastSimModelTracker() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelTracker::IsApplicable( const G4ParticleDefinition&
aParticleType ) {
G4bool Par02FastSimModelTracker::IsApplicable(const G4ParticleDefinition& aParticleType)
{
return aParticleType.GetPDGCharge() != 0; // Applicable for all charged particles
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool Par02FastSimModelTracker::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
G4bool Par02FastSimModelTracker::ModelTrigger(const G4FastTrack& /*aFastTrack*/)
{
return true; // No kinematical restrictions to apply the parametrisation
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02FastSimModelTracker::DoIt( const G4FastTrack& aFastTrack,
G4FastStep& aFastStep ) {
void Par02FastSimModelTracker::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep)
{
G4cout << " ________Tracker model triggered _________" << G4endl;
// Calculate the final position (at the outer boundary of the tracking detector)
// of the particle with the momentum at the entrance of the tracking detector.
G4Track track = * aFastTrack.GetPrimaryTrack();
G4FieldTrack aFieldTrack( '0' );
G4FieldTrackUpdator::Update( &aFieldTrack, &track );
G4Track track = *aFastTrack.GetPrimaryTrack();
G4FieldTrack aFieldTrack('0');
G4FieldTrackUpdator::Update(&aFieldTrack, &track);
G4double retSafety = -1.0;
ELimited retStepLimited;
G4FieldTrack endTrack( 'a' );
G4double currentMinimumStep = 10.0*m; // Temporary: change that to sth connected
// to particle momentum.
G4FieldTrack endTrack('a');
G4double currentMinimumStep = 10.0 * m; // Temporary: change that to sth connected
// to particle momentum.
G4PathFinder* fPathFinder = G4PathFinder::GetInstance();
/*G4double lengthAlongCurve = */
fPathFinder->ComputeStep( aFieldTrack,
currentMinimumStep,
0,
aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(),
retSafety,
retStepLimited,
endTrack,
aFastTrack.GetPrimaryTrack()->GetVolume() );
/*G4double lengthAlongCurve = */
fPathFinder->ComputeStep(aFieldTrack, currentMinimumStep, 0,
aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(), retSafety,
retStepLimited, endTrack, aFastTrack.GetPrimaryTrack()->GetVolume());
// Place the particle at the tracking detector exit
// Place the particle at the tracking detector exit
// (at the place it would reach without the change of its momentum).
aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() );
aFastStep.ProposePrimaryTrackFinalPosition(endTrack.GetPosition());
// Consider only primary tracks (do nothing else for secondary charged particles)
G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
auto info = (Par02EventInformation*)
G4EventManager::GetEventManager()->GetUserInformation();
if ( info->GetDoSmearing() ) {
if (!aFastTrack.GetPrimaryTrack()->GetParentID()) {
auto info = (Par02EventInformation*)G4EventManager::GetEventManager()->GetUserInformation();
if (info->GetDoSmearing()) {
// Smearing according to the tracking detector resolution
G4double res = fCalculateParametrisation->
GetResolution( Par02DetectorParametrisation::eTRACKER,
fParametrisation, Porg.mag() );
G4double eff = fCalculateParametrisation->
GetEfficiency( Par02DetectorParametrisation::eTRACKER,
fParametrisation, Porg.mag() );
G4double res = fCalculateParametrisation->GetResolution(
Par02DetectorParametrisation::eTRACKER, fParametrisation, Porg.mag());
G4double eff = fCalculateParametrisation->GetEfficiency(
Par02DetectorParametrisation::eTRACKER, fParametrisation, Porg.mag());
G4ThreeVector Psm;
Psm = Par02Smearer::Instance()->
SmearMomentum( aFastTrack.GetPrimaryTrack(), res );
Par02Output::Instance()->FillHistogram( 0, ((Psm.mag()/MeV) / (Porg.mag()/MeV)) );
Psm = Par02Smearer::Instance()->SmearMomentum(aFastTrack.GetPrimaryTrack(), res);
Par02Output::Instance()->FillHistogram(0, ((Psm.mag() / MeV) / (Porg.mag() / MeV)));
// Setting the values of Psm, res and eff
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetTrackerMomentum( Psm );
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetTrackerResolution( res );
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetTrackerEfficiency( eff );
} else {
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetTrackerMomentum(Psm);
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetTrackerResolution(res);
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetTrackerEfficiency(eff);
}
else {
// No smearing: simply setting the value of Porg
( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
GetUserInformation() ) )->SetTrackerMomentum( Porg );
((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
aFastTrack.GetPrimaryTrack()
->GetDynamicParticle()
->GetPrimaryParticle())
->GetUserInformation()))
->SetTrackerMomentum(Porg);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,13 +28,14 @@
/// \brief Implementation of the Par02Output class
#include "Par02Output.hh"
#include "Par02EventInformation.hh"
#include "G4AnalysisManager.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4AnalysisManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -44,7 +45,8 @@ G4ThreadLocal G4int Par02Output::fCurrentID = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02Output::Par02Output() : fFileNameWithRunNo( false ) {
Par02Output::Par02Output() : fFileNameWithRunNo(false)
{
fFileName = "DefaultOutput.root";
}
@@ -54,8 +56,9 @@ Par02Output::~Par02Output() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02Output* Par02Output::Instance() {
if ( ! fPar02Output ) {
Par02Output* Par02Output::Instance()
{
if (!fPar02Output) {
fPar02Output = new Par02Output();
}
return fPar02Output;
@@ -63,39 +66,44 @@ Par02Output* Par02Output::Instance() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::SetFileName( G4String aName ) {
void Par02Output::SetFileName(G4String aName)
{
fFileName = aName;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::AppendName( G4bool aApp ) {
void Par02Output::AppendName(G4bool aApp)
{
fFileNameWithRunNo = aApp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String Par02Output::GetFileName() {
G4String Par02Output::GetFileName()
{
return fFileName;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::StartAnalysis( G4int aRunID ) {
void Par02Output::StartAnalysis(G4int aRunID)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( fFileNameWithRunNo ) {
fFileName += "_run";
fFileName += G4UIcommand::ConvertToString( aRunID );
if (fFileNameWithRunNo) {
fFileName += "_run";
fFileName += G4UIcommand::ConvertToString(aRunID);
}
analysisManager->SetDefaultFileType("root");
analysisManager->SetVerboseLevel( 1 );
analysisManager->SetFileName( fFileName );
analysisManager->OpenFile( fFileName );
analysisManager->SetVerboseLevel(1);
analysisManager->SetFileName(fFileName);
analysisManager->OpenFile(fFileName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::EndAnalysis() {
void Par02Output::EndAnalysis()
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
@@ -103,40 +111,41 @@ void Par02Output::EndAnalysis() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::CreateNtuples() {
void Par02Output::CreateNtuples()
{
const G4Event* event = G4RunManager::GetRunManager()->GetCurrentEvent();
G4String evName = "Event_";
evName += G4UIcommand::ConvertToString( event->GetEventID() );
evName += G4UIcommand::ConvertToString(event->GetEventID());
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
fCurrentNtupleId = analysisManager->CreateNtuple( evName, evName );
fCurrentNtupleId = analysisManager->CreateNtuple(evName, evName);
analysisManager->CreateNtupleIColumn( "particleID" ); // column Id = 0
analysisManager->CreateNtupleIColumn( "PID" ); // column Id = 1
analysisManager->CreateNtupleDColumn( "MC_pX" ); // column Id = 2
analysisManager->CreateNtupleDColumn( "MC_pY" ); // column Id = 3
analysisManager->CreateNtupleDColumn( "MC_pZ" ); // column Id = 4
analysisManager->CreateNtupleIColumn("particleID"); // column Id = 0
analysisManager->CreateNtupleIColumn("PID"); // column Id = 1
analysisManager->CreateNtupleDColumn("MC_pX"); // column Id = 2
analysisManager->CreateNtupleDColumn("MC_pY"); // column Id = 3
analysisManager->CreateNtupleDColumn("MC_pZ"); // column Id = 4
analysisManager->CreateNtupleDColumn( "tracker_res" ); // column Id = 5
analysisManager->CreateNtupleDColumn( "tracker_eff" ); // column Id = 6
analysisManager->CreateNtupleDColumn( "tracker_pX" ); // column Id = 7
analysisManager->CreateNtupleDColumn( "tracker_pY" ); // column Id = 8
analysisManager->CreateNtupleDColumn( "tracker_pZ" ); // column Id = 9
analysisManager->CreateNtupleDColumn("tracker_res"); // column Id = 5
analysisManager->CreateNtupleDColumn("tracker_eff"); // column Id = 6
analysisManager->CreateNtupleDColumn("tracker_pX"); // column Id = 7
analysisManager->CreateNtupleDColumn("tracker_pY"); // column Id = 8
analysisManager->CreateNtupleDColumn("tracker_pZ"); // column Id = 9
analysisManager->CreateNtupleDColumn( "emcal_res" ); // column Id = 10
analysisManager->CreateNtupleDColumn( "emcal_eff" ); // column Id = 11
analysisManager->CreateNtupleDColumn( "emcal_X" ); // column Id = 12
analysisManager->CreateNtupleDColumn( "emcal_Y" ); // column Id = 13
analysisManager->CreateNtupleDColumn( "emcal_Z" ); // column Id = 14
analysisManager->CreateNtupleDColumn( "emcal_E" ); // column Id = 15
analysisManager->CreateNtupleDColumn("emcal_res"); // column Id = 10
analysisManager->CreateNtupleDColumn("emcal_eff"); // column Id = 11
analysisManager->CreateNtupleDColumn("emcal_X"); // column Id = 12
analysisManager->CreateNtupleDColumn("emcal_Y"); // column Id = 13
analysisManager->CreateNtupleDColumn("emcal_Z"); // column Id = 14
analysisManager->CreateNtupleDColumn("emcal_E"); // column Id = 15
analysisManager->CreateNtupleDColumn( "hcal_res" ); // column Id = 16
analysisManager->CreateNtupleDColumn( "hcal_eff" ); // column Id = 17
analysisManager->CreateNtupleDColumn( "hcal_X" ); // column Id = 18
analysisManager->CreateNtupleDColumn( "hcal_Y" ); // column Id = 19
analysisManager->CreateNtupleDColumn( "hcal_Z" ); // column Id = 20
analysisManager->CreateNtupleDColumn( "hcal_E" ); // column Id = 21
analysisManager->CreateNtupleDColumn("hcal_res"); // column Id = 16
analysisManager->CreateNtupleDColumn("hcal_eff"); // column Id = 17
analysisManager->CreateNtupleDColumn("hcal_X"); // column Id = 18
analysisManager->CreateNtupleDColumn("hcal_Y"); // column Id = 19
analysisManager->CreateNtupleDColumn("hcal_Z"); // column Id = 20
analysisManager->CreateNtupleDColumn("hcal_E"); // column Id = 21
analysisManager->FinishNtuple( fCurrentNtupleId );
analysisManager->FinishNtuple(fCurrentNtupleId);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -144,69 +153,69 @@ void Par02Output::CreateNtuples() {
void Par02Output::CreateHistograms()
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->CreateH1( "Pdiff", "momentum smeared in tracker", 100, 0.8, 1.2 );
analysisManager->SetH1XAxisTitle( 0, "p_{smeared}/p_{true}" );
analysisManager->SetH1YAxisTitle( 0, "Entries" );
analysisManager->CreateH1( "EMCalEdiff", "energy smeared in EMCal", 100, 0.8, 1.2 );
analysisManager->SetH1XAxisTitle( 1, "E_{smeared}/E_{true}" );
analysisManager->SetH1YAxisTitle( 1, "Entries" );
analysisManager->CreateH1( "HCalEdiff", "energy smeared in HCal", 100, 0.0, 2.0 );
analysisManager->SetH1XAxisTitle( 2, "E_{smeared}/E_{true}" );
analysisManager->SetH1YAxisTitle( 2, "Entries" );
analysisManager->CreateH1("Pdiff", "momentum smeared in tracker", 100, 0.8, 1.2);
analysisManager->SetH1XAxisTitle(0, "p_{smeared}/p_{true}");
analysisManager->SetH1YAxisTitle(0, "Entries");
analysisManager->CreateH1("EMCalEdiff", "energy smeared in EMCal", 100, 0.8, 1.2);
analysisManager->SetH1XAxisTitle(1, "E_{smeared}/E_{true}");
analysisManager->SetH1YAxisTitle(1, "Entries");
analysisManager->CreateH1("HCalEdiff", "energy smeared in HCal", 100, 0.0, 2.0);
analysisManager->SetH1XAxisTitle(2, "E_{smeared}/E_{true}");
analysisManager->SetH1YAxisTitle(2, "Entries");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::SaveTrack( SaveType aWhatToSave, G4int aPartID, G4int aPDG,
G4ThreeVector aVector, G4double aResolution,
G4double aEfficiency, G4double aEnergy ) {
void Par02Output::SaveTrack(SaveType aWhatToSave, G4int aPartID, G4int aPDG, G4ThreeVector aVector,
G4double aResolution, G4double aEfficiency, G4double aEnergy)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
switch( aWhatToSave ) {
case Par02Output::eNoSave :
switch (aWhatToSave) {
case Par02Output::eNoSave:
break;
case Par02Output::eSaveMC : {
analysisManager->FillNtupleIColumn( fCurrentNtupleId, 0, aPartID );
analysisManager->FillNtupleIColumn( fCurrentNtupleId, 1, aPDG );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 2, aVector.x() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 3, aVector.y() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 4, aVector.z() );
case Par02Output::eSaveMC: {
analysisManager->FillNtupleIColumn(fCurrentNtupleId, 0, aPartID);
analysisManager->FillNtupleIColumn(fCurrentNtupleId, 1, aPDG);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 2, aVector.x());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 3, aVector.y());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 4, aVector.z());
fCurrentID = aPartID;
break;
}
case Par02Output::eSaveTracker : {
if ( aPartID != fCurrentID ) G4cout <<
" Wrong particle - trying to save Tracker information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 5, aResolution );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 6, aEfficiency );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 7, aVector.x() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 8, aVector.y() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 9, aVector.z() );
case Par02Output::eSaveTracker: {
if (aPartID != fCurrentID)
G4cout << " Wrong particle - trying to save Tracker information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 5, aResolution);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 6, aEfficiency);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 7, aVector.x());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 8, aVector.y());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 9, aVector.z());
break;
}
case Par02Output::eSaveEMCal : {
if ( aPartID != fCurrentID ) G4cout <<
" Wrong particle - trying to save EMCal information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 10, aResolution );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 11, aEfficiency );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 12, aVector.x() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 13, aVector.y() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 14, aVector.z() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 15, aEnergy );
case Par02Output::eSaveEMCal: {
if (aPartID != fCurrentID)
G4cout << " Wrong particle - trying to save EMCal information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 10, aResolution);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 11, aEfficiency);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 12, aVector.x());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 13, aVector.y());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 14, aVector.z());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 15, aEnergy);
break;
}
case Par02Output::eSaveHCal : {
if ( aPartID != fCurrentID ) G4cout <<
" Wrong particle - trying to save HCal information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 16, aResolution );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 17, aEfficiency );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 18, aVector.x() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 19, aVector.y() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 20, aVector.z() );
analysisManager->FillNtupleDColumn( fCurrentNtupleId, 21, aEnergy );
analysisManager->AddNtupleRow( fCurrentNtupleId );
case Par02Output::eSaveHCal: {
if (aPartID != fCurrentID)
G4cout << " Wrong particle - trying to save HCal information of different particle"
<< G4endl;
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 16, aResolution);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 17, aEfficiency);
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 18, aVector.x());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 19, aVector.y());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 20, aVector.z());
analysisManager->FillNtupleDColumn(fCurrentNtupleId, 21, aEnergy);
analysisManager->AddNtupleRow(fCurrentNtupleId);
break;
}
}
@@ -214,10 +223,10 @@ void Par02Output::SaveTrack( SaveType aWhatToSave, G4int aPartID, G4int aPDG,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02Output::FillHistogram( G4int aHistNo, G4double aValue ) const {
void Par02Output::FillHistogram(G4int aHistNo, G4double aValue) const
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1( aHistNo, aValue );
analysisManager->FillH1(aHistNo, aValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,48 +28,45 @@
/// \brief Implementation of the Par02PhysicsList class
#include "Par02PhysicsList.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4BaryonConstructor.hh"
#include "G4ComptonScattering.hh"
#include "G4Decay.hh"
#include "G4FastSimulationManagerProcess.hh"
#include "G4GammaConversion.hh"
#include "G4IonConstructor.hh"
#include "G4LeptonConstructor.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
#include <iomanip>
#include "G4FastSimulationManagerProcess.hh"
#include "G4Decay.hh"
#include "G4LeptonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuIonisation.hh"
#include "G4MuMultipleScattering.hh"
#include "G4MuPairProduction.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eIonisation.hh"
#include "G4eMultipleScattering.hh"
#include "G4eplusAnnihilation.hh"
#include "G4hIonisation.hh"
#include "G4hMultipleScattering.hh"
#include "G4ios.hh"
#include "globals.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02PhysicsList::Par02PhysicsList() : G4VUserPhysicsList() {
SetVerboseLevel( 1 );
defaultCutValue = 0.1*m;
Par02PhysicsList::Par02PhysicsList() : G4VUserPhysicsList()
{
SetVerboseLevel(1);
defaultCutValue = 0.1 * m;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -78,7 +75,8 @@ Par02PhysicsList::~Par02PhysicsList() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructParticle() {
void Par02PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called for all particles
// which you want to use.
// This ensures that objects of these particle types will be created in the program.
@@ -91,7 +89,8 @@ void Par02PhysicsList::ConstructParticle() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructBosons() {
void Par02PhysicsList::ConstructBosons()
{
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
G4Gamma::GammaDefinition();
@@ -100,35 +99,40 @@ void Par02PhysicsList::ConstructBosons() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructLeptons() {
void Par02PhysicsList::ConstructLeptons()
{
G4LeptonConstructor pConstructor;
pConstructor.ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructMesons() {
void Par02PhysicsList::ConstructMesons()
{
G4MesonConstructor pConstructor;
pConstructor.ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructBaryons() {
G4BaryonConstructor pConstructor;
void Par02PhysicsList::ConstructBaryons()
{
G4BaryonConstructor pConstructor;
pConstructor.ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructIons() {
void Par02PhysicsList::ConstructIons()
{
G4IonConstructor pConstructor;
pConstructor.ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructProcess() {
void Par02PhysicsList::ConstructProcess()
{
AddTransportation();
AddParameterisation();
ConstructGeneral();
@@ -136,57 +140,59 @@ void Par02PhysicsList::ConstructProcess() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::AddTransportation() {
//UseCoupledTransportation();
void Par02PhysicsList::AddTransportation()
{
// UseCoupledTransportation();
G4VUserPhysicsList::AddTransportation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::ConstructGeneral() {
auto theDecayProcess = new G4Decay();
auto particleIterator=GetParticleIterator();
void Par02PhysicsList::ConstructGeneral()
{
auto theDecayProcess = new G4Decay();
auto particleIterator = GetParticleIterator();
particleIterator->reset();
while ( (*particleIterator)() ) {
while ((*particleIterator)()) {
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if ( theDecayProcess->IsApplicable( *particle ) ) {
pmanager->AddProcess( theDecayProcess );
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager->SetProcessOrdering( theDecayProcess, idxPostStep );
pmanager->SetProcessOrdering( theDecayProcess, idxAtRest );
pmanager->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::AddParameterisation() {
G4FastSimulationManagerProcess* fastSimProcess =
new G4FastSimulationManagerProcess( "G4FSMP" );
void Par02PhysicsList::AddParameterisation()
{
G4FastSimulationManagerProcess* fastSimProcess = new G4FastSimulationManagerProcess("G4FSMP");
// Registers the fastSimProcess with all the particles as a discrete and
// continuous process (this works in all cases; in the case that parallel
// geometries are not used, as in this example, it would be enough to
// add it as a discrete process).
auto particleIterator=GetParticleIterator();
auto particleIterator = GetParticleIterator();
particleIterator->reset();
while ( (*particleIterator)() ) {
while ((*particleIterator)()) {
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
//pmanager->AddDiscreteProcess( fastSimProcess ); // No parallel geometry
pmanager->AddProcess( fastSimProcess, -1, 0, 0 ); // General
// pmanager->AddDiscreteProcess( fastSimProcess ); // No parallel geometry
pmanager->AddProcess(fastSimProcess, -1, 0, 0); // General
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PhysicsList::SetCuts() {
if ( verboseLevel > 1 ) {
void Par02PhysicsList::SetCuts()
{
if (verboseLevel > 1) {
G4cout << "Par02PhysicsList::SetCuts:";
}
SetCutsWithDefault();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,41 +28,45 @@
/// \brief Implementation of the Par02PrimaryGeneratorAction class
#include "Par02PrimaryGeneratorAction.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02PrimaryGeneratorAction::Par02PrimaryGeneratorAction() {
Par02PrimaryGeneratorAction::Par02PrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun( n_particle );
fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle =
particleTable->FindParticle( particleName = "geantino" );
fParticleGun->SetParticleDefinition( particle );
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "geantino");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection( G4ThreeVector( 0.0, 1.0, 0.0 ) );
fParticleGun->SetParticleEnergy( 100.0*GeV );
fParticleGun->SetParticlePosition( G4ThreeVector( 0.0, 0.0, 0.0 ) );
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 1.0, 0.0));
fParticleGun->SetParticleEnergy(100.0 * GeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, 0.0));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02PrimaryGeneratorAction::~Par02PrimaryGeneratorAction() {
Par02PrimaryGeneratorAction::~Par02PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PrimaryGeneratorAction::GeneratePrimaries( G4Event* anEvent ) {
fParticleGun->GeneratePrimaryVertex( anEvent );
void Par02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGun->GeneratePrimaryVertex(anEvent);
// Loop over the vertices, and then over primary particles,
// and for each primary particle create an info object, in
@@ -71,26 +75,23 @@ void Par02PrimaryGeneratorAction::GeneratePrimaries( G4Event* anEvent ) {
// of a trivial particle gun generator, but it is useful in the more
// realistic case of a Monte Carlo event generator like Pythia8.
G4int count_particles = 0;
for ( G4int ivtx = 0; ivtx < anEvent->GetNumberOfPrimaryVertex(); ivtx++ ) {
for ( G4int ipp = 0; ipp < anEvent->GetPrimaryVertex( ivtx )->GetNumberOfParticle();
ipp++ ) {
G4PrimaryParticle* primary_particle =
anEvent->GetPrimaryVertex( ivtx )->GetPrimary( ipp );
if ( primary_particle ) {
primary_particle->SetUserInformation( new Par02PrimaryParticleInformation(
count_particles, primary_particle->GetPDGcode(),
primary_particle->GetMomentum() ) );
count_particles++;
for (G4int ivtx = 0; ivtx < anEvent->GetNumberOfPrimaryVertex(); ivtx++) {
for (G4int ipp = 0; ipp < anEvent->GetPrimaryVertex(ivtx)->GetNumberOfParticle(); ipp++) {
G4PrimaryParticle* primary_particle = anEvent->GetPrimaryVertex(ivtx)->GetPrimary(ipp);
if (primary_particle) {
primary_particle->SetUserInformation(new Par02PrimaryParticleInformation(
count_particles, primary_particle->GetPDGcode(), primary_particle->GetMomentum()));
count_particles++;
}
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleGun* Par02PrimaryGeneratorAction::GetParticleGun() {
G4ParticleGun* Par02PrimaryGeneratorAction::GetParticleGun()
{
return fParticleGun;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,12 +31,23 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02PrimaryParticleInformation::Par02PrimaryParticleInformation(
G4int aPartID, G4int aPDG, G4ThreeVector aMomentum ) :
fPartID( aPartID ), fPDG( aPDG ), fMomentumMC( aMomentum ),
fMomentumTracker( 0 ), fResolutionTracker( 0 ), fEfficiencyTracker( 0 ),
fPositionEMCal( 0 ), fEnergyEMCal( 0 ), fResolutionEMCal( 0 ), fEfficiencyEMCal( 0 ),
fPositionHCal( 0 ), fEnergyHCal( 0 ), fResolutionHCal( 0 ), fEfficiencyHCal( 0 ) {}
Par02PrimaryParticleInformation::Par02PrimaryParticleInformation(G4int aPartID, G4int aPDG,
G4ThreeVector aMomentum)
: fPartID(aPartID),
fPDG(aPDG),
fMomentumMC(aMomentum),
fMomentumTracker(0),
fResolutionTracker(0),
fEfficiencyTracker(0),
fPositionEMCal(0),
fEnergyEMCal(0),
fResolutionEMCal(0),
fEfficiencyEMCal(0),
fPositionHCal(0),
fEnergyHCal(0),
fResolutionHCal(0),
fEfficiencyHCal(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -44,20 +55,18 @@ Par02PrimaryParticleInformation::~Par02PrimaryParticleInformation() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02PrimaryParticleInformation::Print() const {
void Par02PrimaryParticleInformation::Print() const
{
G4cout << "Par02PrimaryParticleInformation: PDG code " << fPDG << G4endl
<< "Particle unique ID: " << fPartID << G4endl
<< "MC momentum: " << fMomentumMC << G4endl
<< "Particle unique ID: " << fPartID << G4endl << "MC momentum: " << fMomentumMC << G4endl
<< "Tracker momentum: " << fMomentumTracker << G4endl
<< "Tracker resolution: " << fResolutionTracker << G4endl
<< "Tracker efficiency: " << fEfficiencyTracker << G4endl
<< "EMCal energy: " << fEnergyEMCal << " at " << fPositionEMCal << G4endl
<< "EMCal resolution: " << fResolutionEMCal << G4endl
<< "EMCal efficiency: " << fEfficiencyEMCal << G4endl
<< "HCal energy: " << fEnergyHCal << " at "<< fPositionHCal << G4endl
<< "HCal resolution: " << fResolutionHCal << G4endl
<< "EMCal efficiency: " << fEfficiencyEMCal << G4endl << "HCal energy: " << fEnergyHCal
<< " at " << fPositionHCal << G4endl << "HCal resolution: " << fResolutionHCal << G4endl
<< "HCal efficiency: " << fEfficiencyHCal << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,41 +27,45 @@
/// \file Par02RunAction.cc
/// \brief Implementation of the Par02RunAction class
#include "Par02Output.hh"
#include "Par02RunAction.hh"
#include "Par02Output.hh"
#include "G4Run.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02RunAction::Par02RunAction( const G4String aOutName ) :
G4UserRunAction() {
Par02Output::Instance()->SetFileName( aOutName );
Par02RunAction::Par02RunAction(const G4String aOutName) : G4UserRunAction()
{
Par02Output::Instance()->SetFileName(aOutName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02RunAction::~Par02RunAction() {
#ifdef G4MULTITHREADED
if ( isMaster ) delete Par02Output::Instance();
#else
Par02RunAction::~Par02RunAction()
{
#ifdef G4MULTITHREADED
if (isMaster) delete Par02Output::Instance();
#else
delete Par02Output::Instance();
#endif
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02RunAction::BeginOfRunAction( const G4Run* aRun ) {
Par02Output::Instance()->StartAnalysis( aRun->GetRunID() );
void Par02RunAction::BeginOfRunAction(const G4Run* aRun)
{
Par02Output::Instance()->StartAnalysis(aRun->GetRunID());
Par02Output::Instance()->CreateHistograms();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02RunAction::EndOfRunAction( const G4Run* /*aRun*/ ) {
void Par02RunAction::EndOfRunAction(const G4Run* /*aRun*/)
{
Par02Output::Instance()->EndAnalysis();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,13 +28,16 @@
/// \brief Implementation of the Par02Smearer class
#include "Par02Smearer.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "G4FieldManager.hh"
#include "G4PrimaryParticle.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4TransportationManager.hh"
#include "G4FieldManager.hh"
#include "G4UniformMagField.hh"
#include "G4UnitsTable.hh"
#include <ctime>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,10 +46,11 @@ Par02Smearer* Par02Smearer::fPar02Smearer = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02Smearer::Par02Smearer() {
time_t seed = time( NULL );
fRandomEngine = new CLHEP::HepJamesRandom( static_cast< long >( seed ) );
fRandomGauss = new CLHEP::RandGauss( fRandomEngine );
Par02Smearer::Par02Smearer()
{
time_t seed = time(NULL);
fRandomEngine = new CLHEP::HepJamesRandom(static_cast<long>(seed));
fRandomGauss = new CLHEP::RandGauss(fRandomEngine);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,8 +59,9 @@ Par02Smearer::~Par02Smearer() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par02Smearer* Par02Smearer::Instance() {
if ( ! fPar02Smearer ) {
Par02Smearer* Par02Smearer::Instance()
{
if (!fPar02Smearer) {
fPar02Smearer = new Par02Smearer();
}
return fPar02Smearer;
@@ -64,22 +69,23 @@ Par02Smearer* Par02Smearer::Instance() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreeVector Par02Smearer::SmearMomentum( const G4Track* aTrackOriginal,
G4double aResolution ) {
return SmearGaussian( aTrackOriginal, aResolution );
G4ThreeVector Par02Smearer::SmearMomentum(const G4Track* aTrackOriginal, G4double aResolution)
{
return SmearGaussian(aTrackOriginal, aResolution);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double Par02Smearer::SmearEnergy( const G4Track* aTrackOriginal,
G4double aResolution ) {
G4double Par02Smearer::SmearEnergy(const G4Track* aTrackOriginal, G4double aResolution)
{
G4double newE = -1.0;
while ( newE < 0.0 ) { // To ensure that the resulting value is not negative
// (vital for energy smearing, does not change direction
// for momentum smearing)
if ( aResolution != -1.0 ) {
newE = aTrackOriginal->GetKineticEnergy() * Gauss( 1.0, aResolution );
} else {
while (newE < 0.0) { // To ensure that the resulting value is not negative
// (vital for energy smearing, does not change direction
// for momentum smearing)
if (aResolution != -1.0) {
newE = aTrackOriginal->GetKineticEnergy() * Gauss(1.0, aResolution);
}
else {
newE = aTrackOriginal->GetKineticEnergy();
}
}
@@ -88,20 +94,20 @@ G4double Par02Smearer::SmearEnergy( const G4Track* aTrackOriginal,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreeVector Par02Smearer::SmearGaussian( const G4Track* aTrackOriginal,
G4double aResolution ) {
G4ThreeVector Par02Smearer::SmearGaussian(const G4Track* aTrackOriginal, G4double aResolution)
{
G4ThreeVector originP = aTrackOriginal->GetMomentum();
G4ThreeVector originPos = aTrackOriginal->GetPosition();
G4double rdm = Gauss( 1.0, aResolution );
G4ThreeVector smearedMom( originP.x()*rdm, originP.y()*rdm, originP.z()*rdm );
G4double rdm = Gauss(1.0, aResolution);
G4ThreeVector smearedMom(originP.x() * rdm, originP.y() * rdm, originP.z() * rdm);
return smearedMom;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double Par02Smearer::Gauss( G4double aMean, G4double aStandardDeviation ) {
return fRandomGauss->fire( aMean, aStandardDeviation );
G4double Par02Smearer::Gauss(G4double aMean, G4double aStandardDeviation)
{
return fRandomGauss->fire(aMean, aStandardDeviation);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,17 +28,18 @@
/// \brief Implementation of the Par02TrackingAction class
#include "Par02TrackingAction.hh"
#include "Par02EventInformation.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "Par02Output.hh"
#include "G4ThreeVector.hh"
#include "Par02EventInformation.hh"
#include "Par02Output.hh"
#include "Par02PrimaryParticleInformation.hh"
#include "G4EventManager.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4TrackingManager.hh"
#include "Randomize.hh"
#include <iomanip>
#include <vector>
@@ -52,48 +53,38 @@ Par02TrackingAction::~Par02TrackingAction() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02TrackingAction::PreUserTrackingAction( const G4Track* aTrack ) {
void Par02TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
{
// Kill the tracks that have a small transverse momentum or that are not
// in the central region.
if ( aTrack->GetMomentum().perp() < 1.0*MeV ||
std::abs( aTrack->GetMomentum().pseudoRapidity() ) > 5.5 ) {
( (G4Track*) aTrack )->SetTrackStatus( fStopAndKill );
if (aTrack->GetMomentum().perp() < 1.0 * MeV
|| std::abs(aTrack->GetMomentum().pseudoRapidity()) > 5.5)
{
((G4Track*)aTrack)->SetTrackStatus(fStopAndKill);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par02TrackingAction::PostUserTrackingAction( const G4Track* aTrack ) {
if ( aTrack->GetTrackStatus() == fStopAndKill && aTrack->GetParentID() == 0 ) {
auto info = (Par02PrimaryParticleInformation*)
aTrack->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation();
//info->Print();
Par02Output::Instance()->SaveTrack( Par02Output::eSaveMC,
info->GetPartID(),
info->GetPDG(),
info->GetMCMomentum()/MeV );
Par02Output::Instance()->SaveTrack( Par02Output::eSaveTracker,
info->GetPartID(),
info->GetPDG(),
info->GetTrackerMomentum()/MeV,
info->GetTrackerResolution(),
info->GetTrackerEfficiency() );
Par02Output::Instance()->SaveTrack( Par02Output::eSaveEMCal,
info->GetPartID(),
info->GetPDG(),
info->GetEMCalPosition()/mm,
info->GetEMCalResolution(),
info->GetEMCalEfficiency(),
info->GetEMCalEnergy()/MeV );
Par02Output::Instance()->SaveTrack( Par02Output::eSaveHCal,
info->GetPartID(),
info->GetPDG(),
info->GetHCalPosition()/mm,
info->GetHCalResolution(),
info->GetHCalEfficiency(),
info->GetHCalEnergy()/MeV );
void Par02TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
if (aTrack->GetTrackStatus() == fStopAndKill && aTrack->GetParentID() == 0) {
auto info = (Par02PrimaryParticleInformation*)aTrack->GetDynamicParticle()
->GetPrimaryParticle()
->GetUserInformation();
// info->Print();
Par02Output::Instance()->SaveTrack(Par02Output::eSaveMC, info->GetPartID(), info->GetPDG(),
info->GetMCMomentum() / MeV);
Par02Output::Instance()->SaveTrack(Par02Output::eSaveTracker, info->GetPartID(), info->GetPDG(),
info->GetTrackerMomentum() / MeV,
info->GetTrackerResolution(), info->GetTrackerEfficiency());
Par02Output::Instance()->SaveTrack(Par02Output::eSaveEMCal, info->GetPartID(), info->GetPDG(),
info->GetEMCalPosition() / mm, info->GetEMCalResolution(),
info->GetEMCalEfficiency(), info->GetEMCalEnergy() / MeV);
Par02Output::Instance()->SaveTrack(Par02Output::eSaveHCal, info->GetPartID(), info->GetPDG(),
info->GetHCalPosition() / mm, info->GetHCalResolution(),
info->GetHCalEfficiency(), info->GetHCalEnergy() / MeV);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......