REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4AnalysisProcess.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
23#ifndef RestCore_TRestGeant4AnalysisProcess
24#define RestCore_TRestGeant4AnalysisProcess
25
26#include <TRestGeant4Event.h>
27#include <TRestGeant4Metadata.h>
28
29#include "TRestEventProcess.h"
30
33 private:
36
39
42
44 std::vector<std::string> fEnergyInObservables;
45
47 std::vector<Int_t> fVolumeID;
48
49 std::vector<std::string> fVolumeName;
50
52 std::vector<std::string> fMeanPosObservables;
53
55 std::vector<Int_t> fVolumeID2;
56
59 std::vector<std::string> fDirID;
60
63 std::vector<std::string> fProcessObservables;
64
66 std::vector<Int_t> fVolumeID3;
67
69 std::vector<std::string> fProcessVolumeName;
70
72 std::vector<std::string> fProcessName;
73
75 std::vector<std::string> fContainsProcessObservables;
76
78 std::vector<std::string> fContainsProcessG4Name;
79
81 std::vector<std::string> fPerProcessObservables;
82
84 std::vector<std::vector<std::string>> fPerProcessG4Names;
85
87 std::vector<std::string> fPerProcessParticle;
88
90 std::vector<std::string> fTrackCounterObservables;
91
93 std::vector<std::string> fParticleTrackCounter;
94
96 std::vector<std::string> fTracksEDepObservables;
97
99 std::vector<std::string> fParticleTrackEdep;
100
106
107 void Initialize() override;
108
109 void LoadDefaultConfig();
110
111 void PrintNotActiveVolumeWarning(const TString& volumeName);
112
113 protected:
114 std::map<std::string, std::string> GetAliasObservableNameToVolume();
115
116 public:
117 static const std::map<std::string, std::string>& GetRestToGeant4ProcessNameMap();
118 std::string GetGeant4ProcessName(const std::string& name) const;
119
120 RESTValue GetInputEvent() const override { return fInputG4Event; }
121 RESTValue GetOutputEvent() const override { return fOutputG4Event; }
122
123 void InitProcess() override;
124 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
125 void EndProcess() override;
126
127 void LoadConfig(const std::string& configFilename, const std::string& name = "");
128
130 void PrintMetadata() override {
132
133 EndPrintProcess();
134 }
135
138
140 const char* GetProcessName() const override { return "Geant4Analysis"; }
141
143 TRestGeant4AnalysisProcess(const char* configFilename);
145
146 ClassDefOverride(TRestGeant4AnalysisProcess, 3);
147};
148#endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
A pure analysis process to extract information from a TRestGeant4Event.
std::vector< std::string > fPerProcessParticle
The particle restriction of each PerProcessXxx observable (empty means any particle).
void Initialize() override
Function to initialize input/output event members and define the section name.
std::vector< std::string > fEnergyInObservables
It stores the name of observables xxxVolumeEDep related to the energy deposition in volume xxx.
std::vector< std::string > fDirID
std::string GetGeant4ProcessName(const std::string &name) const
It returns the Geant4 process name corresponding to name.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void InitProcess() override
Process initialization. Observable names are interpreted and auxiliar observable members,...
TRestGeant4Event * fInputG4Event
A pointer to the specific TRestGeant4Event input.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestGeant4Metadata * fG4Metadata
A pointer to the simulation metadata information accessible to TRestRun.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
~TRestGeant4AnalysisProcess()
Default destructor.
const char * GetProcessName() const override
Returns the name of this process.
std::vector< std::string > fTracksEDepObservables
A std::vector storing the observable name xxxTracksEDep for a given xxx particle.
std::vector< std::string > fParticleTrackCounter
A std::vector storing the xxx particle name extracted from xxxTracksCounter.
std::vector< std::string > fProcessObservables
std::vector< Int_t > fVolumeID2
A std::vector storing the active volume ids corresponding mean position observable xxxMeanPosX,...
Bool_t fPerProcessSensitiveEnergyNorm
If true, PerProcessXxx observables are normalized to the total energy in the sensitive volume.
std::vector< std::string > fProcessVolumeName
A std::vector storing the volume name corresponding to each process observable.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestEventProcess * Maker()
Returns a new instance of this class.
std::vector< std::string > fPerProcessObservables
A std::vector storing the observable names PerProcessXxx (only if fPerProcessSensitiveEnergy).
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
std::vector< std::string > fContainsProcessObservables
A std::vector storing the observable names containsProcessXxx.
std::vector< Int_t > fVolumeID
A std::vector storing the active volume ids of observables xxxVolumeEDep.
TRestGeant4Event * fOutputG4Event
A pointer to the specific TRestGeant4Event output.
std::vector< std::string > fTrackCounterObservables
A std::vector storing the observable name xxxTracksCounter for a given xxx particle.
std::vector< std::vector< std::string > > fPerProcessG4Names
The Geant4 process names contributing to each PerProcessXxx observable.
std::vector< Int_t > fVolumeID3
A std::vector storing the active volume ids corresponding process observable .
static const std::map< std::string, std::string > & GetRestToGeant4ProcessNameMap()
It returns the map between the process names used in REST observables (<volume><Process>Process) and ...
TRestGeant4AnalysisProcess()
Default constructor.
std::vector< std::string > fMeanPosObservables
A std::vector storing the name of active volumes.
std::vector< std::string > fProcessName
A std::vector storing the Geant4 name of the process corresponding to each process observable.
void EndProcess() override
Function to include required actions after all events have been processed.
std::vector< std::string > fContainsProcessG4Name
A std::vector storing the Geant4 process name corresponding to each containsProcessXxx observable.
std::vector< std::string > fParticleTrackEdep
A std::vector storing the xxx particle name extracted from xxxTracksEDep.
void PrintNotActiveVolumeWarning(const TString &volumeName)
It prints a warning when the volume used by an observable is not an active volume.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
An event class to store geant4 generated event information.
The main class to store the Geant4 simulation conditions that will be used by restG4.