REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4ToDetectorHitsProcess.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_TRestGeant4ToDetectorHitsProcess
24 #define RestCore_TRestGeant4ToDetectorHitsProcess
25 
26 #include <TRestDetectorHitsEvent.h>
27 #include <TRestEventProcess.h>
28 #include <TRestGeant4Event.h>
29 #include <TRestGeant4Metadata.h>
30 
31 #include <string>
32 #include <vector>
33 
36  private:
39 
42 
45 
47  std::vector<Int_t> fVolumeId;
48 
50  std::vector<TString> fVolumeSelection;
51 
52  std::map<std::string, REST_HitType> fHitTypes;
53 
54  void InitFromConfigFile() override;
55 
56  void Initialize() override;
57 
58  void LoadDefaultConfig();
59 
60  protected:
61  // add here the members of your event process
62 
63  public:
64  RESTValue GetInputEvent() const override { return fGeant4Event; }
65 
66  RESTValue GetOutputEvent() const override { return fHitsEvent; }
67 
68  void InitProcess() override;
69 
70  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
71 
72  void LoadConfig(const std::string& configFilename, const std::string& name = "");
73 
74  void PrintMetadata() override;
75 
77  const char* GetProcessName() const override { return "geant4toHits"; }
78 
79  // Constructor
81 
82  explicit TRestGeant4ToDetectorHitsProcess(const char* configFilename);
83 
84  // Destructor
86 
87  ClassDefOverride(TRestGeant4ToDetectorHitsProcess, 2); // Transform a TRestGeant4Event event to a
88  // TRestDetectorHitsEvent (hits-collection event)
89 };
90 
91 #endif
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.
A process to transform a TRestGeant4Event into a TRestDetectorHitsEvent.
void Initialize() override
Function to initialize input/output event members and define the section name.
std::vector< TString > fVolumeSelection
The geometry volume names to be transferred to TRestDetectorHitsEvent.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestDetectorHitsEvent * fHitsEvent
A pointer to the output TRestDetectorHitsEvent.
const char * GetProcessName() const override
Returns the name of this process.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
~TRestGeant4ToDetectorHitsProcess() override
Default destructor.
void InitProcess() override
Process initialization. This process accesses the information inside TRestGeant4Metadata to identify ...
TRestGeant4Metadata * fGeant4Metadata
A pointer to the Geant4 simulation conditions stored in TRestGeant4Metadata.
void InitFromConfigFile() override
Function to read input parameters from the RML TRestGeant4ToDetectorHitsProcess metadata section.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
TRestGeant4Event * fGeant4Event
A pointer to the input TRestGeant4Event.
void PrintMetadata() override
It prints on screen relevant data members from this class.
std::vector< Int_t > fVolumeId
The volume ids from the volumes selected for transfer to TRestDetectorHitsEvent.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.