REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorHitsSmearingProcess.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 https://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 https://www.gnu.org/licenses/. *
20  * For the list of contributors see $REST_PATH/CREDITS. *
21  *************************************************************************/
22 
23 #ifndef RestCore_TRestDetectorHitsSmearingProcess
24 #define RestCore_TRestDetectorHitsSmearingProcess
25 
26 #include <TRandom3.h>
27 #include <TRestEventProcess.h>
28 
29 #include "TRestDetectorHitsEvent.h"
30 
33  private:
36 
39 
41  TRandom3* fRandom = nullptr;
42 
43  void Initialize() override;
44  void InitProcess() override;
45 
46  protected:
48  Double_t fEnergyRef = 5.9; //<
49 
51  Double_t fResolutionAtERef = 15; //<
52 
54  ULong_t fSeed = 0; //<
55 
56  public:
57  RESTValue GetInputEvent() const override { return fInputEvent; }
58  RESTValue GetOutputEvent() const override { return fOutputEvent; }
59 
60  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
61 
62  void LoadConfig(const std::string& configFilename, const std::string& name = "");
63 
64  void PrintMetadata() override {
66 
67  RESTMetadata << " reference energy (ERef): " << fEnergyRef << RESTendl;
68  RESTMetadata << " resolution at ERef : " << fResolutionAtERef << RESTendl;
69 
70  EndPrintProcess();
71  }
72 
73  inline TRestMetadata* GetProcessMetadata() const { return nullptr; }
74 
75  const char* GetProcessName() const override { return "smearingProcess"; }
76 
78  inline Double_t GetEnergyReference() const { return fEnergyRef; }
79 
81  inline Double_t GetResolutionReference() const { return fResolutionAtERef; }
82 
84  TRestDetectorHitsSmearingProcess(const char* configFilename);
85 
87 
88  ClassDefOverride(TRestDetectorHitsSmearingProcess, 3);
89 };
90 #endif
A process to include detector energy resolution in a TRestDetectorHitsEvent.
void Initialize() override
Function to initialize input/output event members and define the section name.
Double_t fEnergyRef
Reference energy for the FWHM.
Double_t fResolutionAtERef
FWHM at Energy of reference.
Double_t GetEnergyReference() const
Returns the reference energy where the FWHM is defined.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestDetectorHitsEvent * fOutputEvent
A pointer to the process output event.
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.
TRestDetectorHitsEvent * fInputEvent
A pointer to the process input event.
Double_t GetResolutionReference() const
Returns the energy resolution in FWHM for the reference energy.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
TRandom3 * fRandom
A pointer to the random generator initializes with fSeed.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
ULong_t fSeed
The seed to be used for the random generator.
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 base class for any REST metadata class.
Definition: TRestMetadata.h:74
endl_t RESTendl
Termination flag object for TRestStringOutput.