REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4VetoAnalysisProcess.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_TRestGeant4VetoAnalysisProcess
24#define RestCore_TRestGeant4VetoAnalysisProcess
25
26#include <TRestEventProcess.h>
27
28#include <string>
29
30#include "TRestGeant4Event.h"
31#include "TRestGeant4Metadata.h"
32
33struct Veto {
34 std::string name;
35 std::string alias{};
36 std::string group{};
37 int layer{};
38 int number{};
39 TVector3 position{};
40 double length{};
41};
42
44 private:
45 std::string fVetoVolumesExpression; // identify veto volumes
46
47 public:
48 inline std::string GetVetoVolumesExpression() const { return fVetoVolumesExpression; }
49
50 private:
51 TRestGeant4Event* fInputEvent = nullptr;
52 TRestGeant4Event* fOutputEvent = nullptr;
53 const TRestGeant4Metadata* fGeant4Metadata = nullptr;
54
55 std::vector<Veto> fVetoVolumes;
56
57 void InitFromConfigFile() override;
58 void Initialize() override;
59 void LoadDefaultConfig();
60
61 public:
62 RESTValue GetInputEvent() const override { return fInputEvent; }
63 RESTValue GetOutputEvent() const override { return fOutputEvent; }
64
65 static Veto GetVetoFromString(const std::string& vetoString);
66
67 inline void SetGeant4Metadata(const TRestGeant4Metadata* metadata) {
68 fGeant4Metadata = metadata;
69 } // TODO: We should not need this! but `GetMetadata<TRestGeant4Metadata>()` is not working early in the
70 // processing (look at the tests for more details)
71
72 void InitProcess() override;
73 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
74 void EndProcess() override;
75
76 void LoadConfig(const std::string& configFilename, const std::string& name = "");
77
78 void PrintMetadata() override;
79
80 const char* GetProcessName() const override { return "geant4VetoAnalysis"; }
81
83 TRestGeant4VetoAnalysisProcess(const char* configFilename);
85
86 ClassDefOverride(TRestGeant4VetoAnalysisProcess, 4);
87};
88#endif // RestCore_TRestGeant4VetoAnalysisProcess
A base class for any REST event process.
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.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void EndProcess() override
Function to include required actions after all events have been processed.
void InitFromConfigFile() override
Function to read input parameters from the RML TRestGeant4VetoAnalysisProcess metadata section.
void Initialize() override
Function to initialize input/output event members and define the section name.
void InitProcess() override
Process initialization.