REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4NeutronTaggingProcess.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2020 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_TRestGeant4NeutronTaggingProcess
24#define RestCore_TRestGeant4NeutronTaggingProcess
25
26#include <TRestGeant4Event.h>
27#include <TRestGeant4Metadata.h>
28
29#include "TRestEventProcess.h"
30
32 private:
39
41 std::vector<int> fVetoVolumeIds;
42 std::vector<int> fCaptureVolumeIds;
43 std::vector<int> fShieldingVolumeIds;
44
45 std::string fVetoKeyword = "";
46 std::string fCaptureKeyword = "";
47 std::string fShieldingKeyword = "";
48 std::vector<std::string> fVetoGroupKeywords;
49 std::map<std::string, std::vector<std::string>> fVetoGroupVolumeNames;
50 std::vector<Float_t> fQuenchingFactors;
51
52 // neutrons that undergo neutron capture
53 Int_t fNeutronsCapturedNumber;
55 std::vector<Double_t> fNeutronsCapturedPosX;
56 std::vector<Double_t> fNeutronsCapturedPosY;
57 std::vector<Double_t> fNeutronsCapturedPosZ;
60 std::vector<Double_t> fNeutronsCapturedProductionE;
61 std::vector<Double_t> fNeutronsCapturedEDepByNeutron;
62 std::vector<Double_t> fNeutronsCapturedEDepByNeutronAndChildren;
63 std::vector<Double_t> fNeutronsCapturedEDepByNeutronInVeto;
64 std::vector<Double_t> fNeutronsCapturedEDepByNeutronAndChildrenInVeto;
65 std::vector<Double_t> fNeutronsCapturedEDepByNeutronAndChildrenInVetoMax;
66 std::vector<Double_t> fNeutronsCapturedEDepByNeutronAndChildrenInVetoMin;
67
68 // gammas that are produced from neutron capture
69 Int_t fGammasNeutronCaptureNumber;
70 std::vector<Double_t> fGammasNeutronCapturePosX;
71 std::vector<Double_t> fGammasNeutronCapturePosY;
72 std::vector<Double_t> fGammasNeutronCapturePosZ;
73 std::vector<Int_t> fGammasNeutronCaptureIsCaptureVolume;
74 std::vector<Double_t> fGammasNeutronCaptureProductionE;
75
76 // secondary neutrons that exit the lead shielding
77 Int_t fSecondaryNeutronsShieldingNumber;
78 std::vector<Double_t> fSecondaryNeutronsShieldingExitPosX;
79 std::vector<Double_t> fSecondaryNeutronsShieldingExitPosY;
80 std::vector<Double_t> fSecondaryNeutronsShieldingExitPosZ;
81 std::vector<Int_t> fSecondaryNeutronsShieldingIsCaptured;
82 std::vector<Int_t> fSecondaryNeutronsShieldingIsCapturedInCaptureVolume;
83 std::vector<Double_t> fSecondaryNeutronsShieldingProductionE;
84 std::vector<Double_t> fSecondaryNeutronsShieldingExitE;
85
86 void InitFromConfigFile() override;
87 void Initialize() override;
88 void LoadDefaultConfig();
89 void Reset();
90
91 protected:
92 // add here the members of your event process
93
94 public:
95 RESTValue GetInputEvent() const override { return fInputG4Event; }
96 RESTValue GetOutputEvent() const override { return fOutputG4Event; }
97
98 void InitProcess() override;
99 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
100 void EndProcess() override;
101
102 void LoadConfig(const std::string& configFilename, const std::string& name = "");
103
105 void PrintMetadata() override {
107
108 RESTDebug << "VETO KEYWORD: " << fVetoKeyword << RESTendl;
109 RESTDebug << RESTendl;
110
111 RESTDebug << "VETO GROUP KEYWORDS:" << RESTendl;
112 for (unsigned int i = 0; i < fVetoGroupKeywords.size(); i++) {
113 RESTDebug << "\t" << fVetoGroupKeywords[i] << RESTendl;
114 }
115 RESTDebug << RESTendl;
116
117 RESTDebug << "Found " << fVetoVolumeIds.size() << " veto volumes:" << RESTendl;
118 for (unsigned int i = 0; i < fVetoVolumeIds.size(); i++) {
119 RESTDebug << "\t" << fG4Metadata->GetActiveVolumeName(fVetoVolumeIds[i]) << RESTendl;
120 }
121 RESTDebug << RESTendl;
122
123 // capture volumes
124
125 RESTDebug << "CAPTURE KEYWORD: " << fCaptureKeyword << RESTendl;
126 RESTDebug << RESTendl;
127
128 RESTDebug << "Found " << fCaptureVolumeIds.size() << " Capture volumes:" << RESTendl;
129 for (unsigned int i = 0; i < fCaptureVolumeIds.size(); i++) {
130 RESTDebug << "\t" << fG4Metadata->GetActiveVolumeName(fCaptureVolumeIds[i]) << RESTendl;
131 }
132 RESTDebug << RESTendl;
133
134 // shielding volume/s
135
136 RESTDebug << "SHIELDING KEYWORD: " << fShieldingKeyword << RESTendl;
137 RESTDebug << RESTendl;
138
139 RESTDebug << "Found " << fShieldingVolumeIds.size() << " Shielding volumes:" << RESTendl;
140 for (unsigned int i = 0; i < fShieldingVolumeIds.size(); i++) {
141 RESTDebug << "\t" << fG4Metadata->GetActiveVolumeName(fShieldingVolumeIds[i]) << RESTendl;
142 }
143 RESTDebug << RESTendl;
144
145 RESTDebug << "QUENCHING FACTORS (" << fQuenchingFactors.size() << " Total)" << RESTendl;
146 for (unsigned int i = 0; i < fQuenchingFactors.size(); i++) {
147 RESTDebug << "\t" << fQuenchingFactors[i] << RESTendl;
148 }
149 RESTDebug << RESTendl;
150
151 EndPrintProcess();
152 }
153
157 const char* GetProcessName() const override { return "geant4NeutronTagging"; }
158
160 TRestGeant4NeutronTaggingProcess(const char* configFilename);
162
163 ClassDefOverride(TRestGeant4NeutronTaggingProcess, 1);
164};
165#endif // RestCore_TRestGeant4NeutronTaggingProcess
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
An event class to store geant4 generated event information.
The main class to store the Geant4 simulation conditions that will be used by restG4.
TString GetActiveVolumeName(Int_t n) const
Returns a std::string with the name of the active volume with index n.
std::vector< Int_t > fNeutronsCapturedIsCaptureVolume
If documentation is added perhaps they could be shorter names.
void InitProcess() override
Process initialization.
void Initialize() override
Function to initialize input/output event members and define the section name.
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.
const char * GetProcessName() const override
Returns the name of this process.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void InitFromConfigFile() override
Function to read input parameters from the RML TRestGeant4NeutronTaggingProcess metadata section.
std::vector< int > fVetoVolumeIds
TODO these members should be documented.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void EndProcess() override
Function to include required actions after all events have been processed.
std::vector< Double_t > fNeutronsCapturedPosX
TODO it might be simplified using std::vector<TVector3>
TRestGeant4Event * fOutputG4Event
A pointer to the specific TRestGeant4Event output.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestEventProcess * Maker()
Returns a new instance of this class.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
TRestGeant4Metadata * fG4Metadata
A pointer to the simulation metadata information accessible to TRestRun.
endl_t RESTendl
Termination flag object for TRestStringOutput.