REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4QuenchingProcess.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_TRestGeant4QuenchingProcess
24 #define RestCore_TRestGeant4QuenchingProcess
25 
26 #include <TRestEventProcess.h>
27 
28 #include "TRestGeant4Event.h"
29 #include "TRestGeant4Metadata.h"
30 
33  private:
36 
39 
42 
44  std::map<std::string, std::map<std::string, float_t>> fUserVolumeParticleQuenchingFactor = {};
45 
47  std::map<std::string, std::map<std::string, float_t>> fVolumeParticleQuenchingFactor = {};
48 
49  void Initialize() override;
50  void InitFromConfigFile() override;
51  void LoadDefaultConfig();
52 
53  public:
54  std::vector<std::string> GetUserVolumeExpressions() const;
55  float_t GetQuenchingFactorForVolumeAndParticle(const std::string& volumeName,
56  const std::string& particleName) const;
57 
58  //
59  RESTValue GetInputEvent() const override { return fInputG4Event; }
60  RESTValue GetOutputEvent() const override { return fOutputG4Event; }
61 
62  void InitProcess() override;
63  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
64  void EndProcess() override;
65 
66  void LoadConfig(const std::string& configFilename, const std::string& name = "");
67 
68  void PrintMetadata() override;
69 
72 
74  const char* GetProcessName() const override { return "Geant4Quenching"; }
75 
77  explicit TRestGeant4QuenchingProcess(const char* configFilename);
79 
80  ClassDefOverride(TRestGeant4QuenchingProcess, 1);
81 };
82 #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.
Recomputes the energy of every hit based on quenching factor for each particle and volume.
TRestGeant4Event * fOutputG4Event
A pointer to the specific TRestGeant4Event output.
TRestEventProcess * Maker()
Returns a new instance of this class.
const char * GetProcessName() const override
Returns the name of this process.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestGeant4Metadata * fGeant4Metadata
A pointer to the simulation metadata information accessible to TRestRun.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
std::map< std::string, std::map< std::string, float_t > > fVolumeParticleQuenchingFactor
It stores the quenching factor for each particle for each volume of the simulation.
TRestGeant4Event * fInputG4Event
A pointer to the specific TRestGeant4Event input.
void EndProcess() override
Function to include required actions after all events have been processed.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestGeant4QuenchingProcess()
Default constructor.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestGeant4QuenchingProcess() override
Default destructor.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
std::map< std::string, std::map< std::string, float_t > > fUserVolumeParticleQuenchingFactor
It stores the quenching factor for each particle for each user volume expression.
void InitProcess() override
Process initialization. User volume expressions are matched to physical volumes.