Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Par04RunAction Class Reference

Run action. More...

#include <Doxymodules_parameterisations.h>

Inheritance diagram for Par04RunAction:
G4UserRunAction

Public Member Functions

 Par04RunAction (Par04DetectorConstruction *aDetector, Par04EventAction *aEventAction)
 Constructor. Defines the histograms.
 
virtual ~Par04RunAction ()
 
virtual void BeginOfRunAction (const G4Run *) final
 Open the file for the analysis.
 
virtual void EndOfRunAction (const G4Run *) final
 Write and close the file.
 

Private Attributes

Par04DetectorConstructionfDetector
 Pointer to detector construction to retrieve the detector dimensions to setup the histograms.
 
Par04EventActionfEventAction
 Pointer to event action to save hits.
 
std::chrono::steady_clock::time_point fChronoStart
 Timer measurement.
 
std::chrono::steady_clock::time_point fChronoEnd
 

Detailed Description

Run action.

Create analysis file and define control histograms for showers in detectors. Histograms are configured taking into account the dimensions of the readout mesh. Ntuple with hits is also stored. It contains energy of the primary particle, coordinates (cylindrical) of the hit and the deposited energy.

Definition at line 91 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par04RunAction()

Par04RunAction::Par04RunAction ( Par04DetectorConstruction aDetector,
Par04EventAction aEventAction 
)

Constructor. Defines the histograms.

Definition at line 37 of file Par04RunAction.cc.

39 , fDetector(aDetector)
40 , fEventAction(aEventAction)
41{
42 // Create analysis manager
43 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
44 analysisManager->SetDefaultFileType("root");
45
46 // Default filename, can be overriden with /analysis/setFileName
47 analysisManager->SetFileName("Par04Output");
48}
Par04EventAction * fEventAction
Pointer to event action to save hits.
Par04DetectorConstruction * fDetector
Pointer to detector construction to retrieve the detector dimensions to setup the histograms.

◆ ~Par04RunAction()

Par04RunAction::~Par04RunAction ( )
virtualdefault

Member Function Documentation

◆ BeginOfRunAction()

void Par04RunAction::BeginOfRunAction ( const G4Run )
finalvirtual

Open the file for the analysis.

Definition at line 56 of file Par04RunAction.cc.

57{
58 // Get analysis manager
59 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
60
61 // Create directories
62 analysisManager->SetNtupleMerging(true);
63 analysisManager->SetVerboseLevel(0);
64
65 // Get detector dimensions
66 G4int cellNumZ = fDetector->GetMeshNbOfCells().z();
67 G4int cellNumRho = fDetector->GetMeshNbOfCells().x();
68 G4int cellNumPhi = fDetector->GetMeshNbOfCells().y();
69 G4double cellSizeZ = fDetector->GetMeshSizeOfCells().z();
70 G4double cellSizeRho = fDetector->GetMeshSizeOfCells().x();
71 G4double cellSizePhi = fDetector->GetMeshSizeOfCells().y();
72 // Default max value of energy stored in histogram (in GeV)
73 G4double maxEnergy = 1000;
74
75 // Creating control histograms
76 analysisManager->CreateH1("energyParticle", "Primary energy;E_{MC} (GeV);Entries", 1024, 0,
77 1.1 * maxEnergy);
78 analysisManager->CreateH1("energyDepositedInVirtual", "Deposited energy;E_{MC} (GeV);Entries",
79 1024, 0, 1.1 * maxEnergy);
80 analysisManager->CreateH1(
81 "energyRatioInVirtual", "Ratio of energy deposited to primary;E_{dep} / E_{MC};Entries",
82 1024, 0, 1);
83 analysisManager->CreateH1("time", "Simulation time; time (s);Entries", 2048, 0, 100);
84 analysisManager->CreateH1("longProfile", "Longitudinal profile;t (mm);#LTE#GT (MeV)", cellNumZ,
85 -0.5 * cellSizeZ, (cellNumZ - 0.5) * cellSizeZ);
86 analysisManager->CreateH1("transProfile", "Transverse profile;r (mm);#LTE#GT (MeV)", cellNumRho,
87 -0.5 * cellSizeRho, (cellNumRho - 0.5) * cellSizeRho);
88 analysisManager->CreateH1("longFirstMoment",
89 "First moment of longitudinal distribution;#LT#lambda#GT (mm);Entries",
90 1024, -0.5 * cellSizeZ,
91 cellNumZ * cellSizeZ / 2); // arbitrary scaling of max value on axis
92 analysisManager->CreateH1("transFirstMoment",
93 "First moment of transverse distribution;#LTr#GT "
94 "(mm);Entries",
95 1024, -0.5 * cellSizeRho,
96 cellNumRho * cellSizeRho /
97 1); // arbitrary scaling of max value on axis
98 analysisManager->CreateH1(
99 "longSecondMoment",
100 "Second moment of longitudinal distribution;#LT#lambda^{2}#GT "
101 "(mm^{2});Entries",
102 1024, 0, std::pow(cellNumZ * cellSizeZ, 2) / 25); // arbitrary scaling of max value on axis
103 analysisManager->CreateH1(
104 "transSecondMoment", "Second moment of transverse distribution;#LTr^{2}#GT (mm^{2});Entries",
105 1024, 0, std::pow(cellNumRho * cellSizeRho, 2) / 5); // arbitrary scaling of max value on axis
106 analysisManager->CreateH1("hitType", "hit type;type (0=full, 1= fast);Entries", 2, -0.5, 1.5);
107 analysisManager->CreateH1("phiProfile",
108 "Azimuthal angle profile, centred at mean;phi;#LTE#GT (MeV)",
109 cellNumPhi, - (cellNumPhi - 0.5) * cellSizePhi,
110 (cellNumPhi - 0.5) * cellSizePhi);
111 analysisManager->CreateH1("numHitsInVirtual", "Number of hits above 0.5 keV", 4048, 0, 20000);
112 analysisManager->CreateH1("cellEnergy", "Cell energy distribution;log10(E/MeV);Entries",
113 1024, -4, 2);
114 analysisManager->CreateH1("numDepositsInVirtual", "Number of deposits in all cells per event",
115 4048, 0, 40000);
116 analysisManager->CreateH1("cellDepositsInVirtual",
117 "Distribution of number of deposits per cell per event", 4048, 0, 1024);
118 analysisManager->CreateH1("energyDepositedInPhysical",
119 "Deposited energy in physical detector readout;E_{MC} (GeV);Entries",
120 1024, 0, 1.1 * maxEnergy);
121 analysisManager->CreateH1("energyRatioInPhysical",
122 "Ratio of energy deposited in physical readout to primary; E_{dep} / E_{MC};Entries",
123 1024, 0, 1);
124 analysisManager->CreateH1("numHitsInPhysical", "Number of hits in physical readout above 0.5 keV",
125 4048, 0, 5000);
126 analysisManager->CreateH1("cellEnergyInPhysical",
127 "Physical cell energy distribution;log10(E/MeV);Entries", 1024, -4, 2);
128 analysisManager->CreateH1("numDepositsInPhysical",
129 "Number of deposits in all physical cells per event", 4048, 0, 40000);
130 analysisManager->CreateH1("cellDepositsInPhysical",
131 "Distribution of number of deposits per physical cell per event",
132 4048, 0, 1024);
133
134 // Creating ntuple
135 analysisManager->CreateNtuple("global", "Event data");
136 analysisManager->CreateNtupleDColumn("EnergyMC");
137 analysisManager->CreateNtupleDColumn("SimTime");
138 analysisManager->FinishNtuple();
139
140 analysisManager->CreateNtuple("virtualReadout", "Cylindrical mesh readout");
141 analysisManager->CreateNtupleDColumn("EnergyCell", fEventAction->GetCalEdep());
142 analysisManager->CreateNtupleIColumn("rhoCell", fEventAction->GetCalRho());
143 analysisManager->CreateNtupleIColumn("phiCell", fEventAction->GetCalPhi());
144 analysisManager->CreateNtupleIColumn("zCell", fEventAction->GetCalZ());
145 analysisManager->FinishNtuple();
146
147 analysisManager->CreateNtuple("physicalReadout", "Detector physical readout");
148 analysisManager->CreateNtupleDColumn("EnergyCell", fEventAction->GetPhysicalCalEdep());
149 analysisManager->CreateNtupleIColumn("layerCell", fEventAction->GetPhysicalCalLayer());
150 analysisManager->CreateNtupleIColumn("rowCell", fEventAction->GetPhysicalCalRow());
151 analysisManager->CreateNtupleIColumn("sliceCell", fEventAction->GetPhysicalCalSlice());
152 analysisManager->FinishNtuple();
153
154 analysisManager->OpenFile();
155}
G4ThreeVector GetMeshSizeOfCells() const
Get size of Mesh cells in cylindrical coordinates (r, phi, z)
G4ThreeVector GetMeshNbOfCells() const
Get number of Mesh cells in cylindrical coordinates (r, phi, z)
std::vector< G4int > & GetPhysicalCalSlice()
std::vector< G4int > & GetCalZ()
std::vector< G4int > & GetCalPhi()
std::vector< G4int > & GetCalRho()
std::vector< G4double > & GetCalEdep()
std::vector< G4int > & GetPhysicalCalRow()
std::vector< G4double > & GetPhysicalCalEdep()
std::vector< G4int > & GetPhysicalCalLayer()

◆ EndOfRunAction()

void Par04RunAction::EndOfRunAction ( const G4Run )
finalvirtual

Write and close the file.

Definition at line 159 of file Par04RunAction.cc.

160{
161 auto analysisManager = G4AnalysisManager::Instance();
162 analysisManager->Write();
163 analysisManager->CloseFile();
164}

Member Data Documentation

◆ fDetector

Par04DetectorConstruction* Par04RunAction::fDetector
private

Pointer to detector construction to retrieve the detector dimensions to setup the histograms.

Definition at line 72 of file Par04RunAction.hh.

◆ fEventAction

Par04EventAction* Par04RunAction::fEventAction
private

Pointer to event action to save hits.

Definition at line 74 of file Par04RunAction.hh.

◆ fChronoStart

std::chrono::steady_clock::time_point Par04RunAction::fChronoStart
private

Timer measurement.

Definition at line 76 of file Par04RunAction.hh.

◆ fChronoEnd

std::chrono::steady_clock::time_point Par04RunAction::fChronoEnd
private

Definition at line 77 of file Par04RunAction.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration