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#include "TRestDetectorReadout.h"
31
34 private:
37
40
42 TRandom3* fRandom = nullptr;
43
44 void Initialize() override;
45 void InitProcess() override;
46
47 std::string fChannelType = "tpc";
48
49 TRestDetectorReadout* fReadout = nullptr;
50
51 protected:
53 Double_t fEnergyRef = 5.9; //<
54
56 Double_t fResolutionAtERef = 15; //<
57
59 ULong_t fSeed = 0; //<
60
61 public:
62 RESTValue GetInputEvent() const override { return fInputEvent; }
63 RESTValue GetOutputEvent() const override { return fOutputEvent; }
64
65 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
66
67 void LoadConfig(const std::string& configFilename, const std::string& name = "");
68
69 void PrintMetadata() override {
71
72 RESTMetadata << "Channel type: " << fChannelType << RESTendl;
73
74 RESTMetadata << "Reference energy (ERef): " << fEnergyRef << RESTendl;
75 RESTMetadata << "Resolution at ERef : " << fResolutionAtERef << RESTendl;
76
77 EndPrintProcess();
78 }
79
80 inline TRestMetadata* GetProcessMetadata() const { return nullptr; }
81
82 const char* GetProcessName() const override { return "smearingProcess"; }
83
85 inline Double_t GetEnergyReference() const { return fEnergyRef; }
86
88 inline Double_t GetResolutionReference() const { return fResolutionAtERef; }
89
91 TRestDetectorHitsSmearingProcess(const char* configFilename);
92
94
95 ClassDefOverride(TRestDetectorHitsSmearingProcess, 4);
96};
97#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 metadata class to generate/store a readout description.
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.