REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
TRestDetectorHitsSmearingProcess Class Reference

Detailed Description

A process to include detector energy resolution in a TRestDetectorHitsEvent.

TRestDetectorHitsSmearingProcess will introduce a stochastic smearing on the energy of the hits for each event. The total energy of each event will be re-distributed following a gaussian shaped function.

The energy resolution will follow a root square law with the energy using the energyReference and the resolutionReference as a pivoting point.

Therefore, the process defines only two parameters, one being the energy at wich the energy resolution is "known", and the FWHM in percentage at that given energy, resolutionReference.

<addProcess type="TRestDetectorHitsSmearingProcess" name="smear"
title="Energy resolution smearing">
<parameter name="energyReference" value="250keV" />
<parameter name="resolutionReference" value="15" />
</addProcess>

The following image is the result of smearing the energy of an electron gun of 250keV. It was produced using the exercise 3.2 inside the day3/session2 at the rest-school repository.


RESTsoft - Software for Rare Event Searches with TPCs

History of developments:

2016-February: First implementation of TRestDetectorHitsSmearingProcess

Author
Javier G. Garza

2023-January: This class has been documented

Author
Javier Galan - javie.nosp@m.r.ga.nosp@m.lan@u.nosp@m.niza.nosp@m.r.es

Definition at line 32 of file TRestDetectorHitsSmearingProcess.h.

#include <TRestDetectorHitsSmearingProcess.h>

Inheritance diagram for TRestDetectorHitsSmearingProcess:
TRestEventProcess TRestMetadata

Public Member Functions

 ClassDefOverride (TRestDetectorHitsSmearingProcess, 3)
 
Double_t GetEnergyReference () const
 Returns the reference energy where the FWHM is defined. More...
 
RESTValue GetInputEvent () const override
 Get pointer to input event. Must be implemented in the derived class. More...
 
RESTValue GetOutputEvent () const override
 Get pointer to output event. Must be implemented in the derived class. More...
 
TRestMetadataGetProcessMetadata () const
 
const char * GetProcessName () const override
 
Double_t GetResolutionReference () const
 Returns the energy resolution in FWHM for the reference energy. More...
 
void LoadConfig (const std::string &configFilename, const std::string &name="")
 
void PrintMetadata () override
 Implemented it in the derived metadata class to print out specific metadata information. More...
 
TRestEventProcessEvent (TRestEvent *inputEvent) override
 The main processing event function. More...
 
 TRestDetectorHitsSmearingProcess ()
 Default constructor. More...
 
 TRestDetectorHitsSmearingProcess (const char *configFilename)
 
 ~TRestDetectorHitsSmearingProcess ()
 Default destructor. More...
 
- Public Member Functions inherited from TRestEventProcess
virtual Bool_t AddInputFile (const std::string &file)
 
bool ApplyCut ()
 
virtual void BeginOfEventProcess (TRestEvent *inputEvent=nullptr)
 Begin of event process, preparation work. Called right before ProcessEvent() More...
 
 ClassDefOverride (TRestEventProcess, 3)
 
virtual void EndOfEventProcess (TRestEvent *inputEvent=nullptr)
 End of event process. Nothing to do. Called directly after ProcessEvent() More...
 
virtual void EndProcess ()
 To be executed at the end of the run (outside event loop) More...
 
TRestAnalysisTreeGetAnalysisTree () const
 Return the local analysis tree (dummy) More...
 
TCanvas * GetCanvas () const
 Get canvas. More...
 
TRestAnalysisTreeGetFullAnalysisTree ()
 
virtual RESTValue GetInputEvent () const =0
 Get pointer to input event. Must be implemented in the derived class. More...
 
std::vector< std::string > GetListOfAddedObservables ()
 
virtual RESTValue GetOutputEvent () const =0
 Get pointer to output event. Must be implemented in the derived class. More...
 
virtual const char * GetProcessName () const =0
 
TRestRunGetRunInfo () const
 Return the pointer of the hosting TRestRun object. More...
 
virtual Long64_t GetTotalBytes () const
 
virtual Long64_t GetTotalBytesRead () const
 Interface to external file reading, get the read bytes. To be implemented in external processes. More...
 
virtual void InitFromConfigFile () override
 To make settings from rml file. This method must be implemented in the derived class. More...
 
virtual void InitProcess ()
 To be executed at the beginning of the run (outside event loop) More...
 
Bool_t isExternal () const
 Return whether this process is external process. More...
 
Int_t LoadSectionMetadata () override
 This method does some preparation of xml section. More...
 
virtual void NotifyAnalysisTreeReset ()
 In case the analysis tree is reset(switched to new file), some process needs to have action. More...
 
virtual Bool_t OpenInputFiles (const std::vector< std::string > &files)
 
virtual TRestEventProcessEvent (TRestEvent *inputEvent)=0
 Process one event. More...
 
std::vector< std::string > ReadObservables ()
 
void RegisterAllObservables (Bool_t value=true)
 
virtual Bool_t ResetEntry ()
 
void SetAnalysisTree (TRestAnalysisTree *tree)
 Set analysis tree of this process, then add observables to it.
 
void SetCanvasSize (Int_t x, Int_t y)
 Set canvas size. More...
 
void SetFriendProcess (TRestEventProcess *p)
 Add friendly process to this process.
 
void SetObservableValidation (bool validate)
 
void SetParallelProcess (TRestEventProcess *p)
 Add parallel process to this process.
 
void SetRunInfo (TRestRun *r)
 Set TRestRun for this process. More...
 
Bool_t singleThreadOnly () const
 Return whether this process is single std::thread only. More...
 
 TRestEventProcess ()
 
 ~TRestEventProcess ()
 

Protected Attributes

Double_t fEnergyRef = 5.9
 Reference energy for the FWHM. More...
 
Double_t fResolutionAtERef = 15
 FWHM at Energy of reference. More...
 
ULong_t fSeed = 0
 The seed to be used for the random generator. More...
 
- Protected Attributes inherited from TRestEventProcess
TRestAnalysisTreefAnalysisTree = nullptr
 
TCanvas * fCanvas = nullptr
 < Canvas for some viewer event More...
 
TVector2 fCanvasSize
 Canvas size. More...
 
std::vector< std::pair< std::string, TVector2 > > fCuts
 Stores cut definitions. Any listed observables should be in the range. More...
 
bool fDynamicObs = false
 It defines whether to use added observables only or all the observables appear in the code. More...
 
bool fIsExternal = false
 It defines if the process reads event data from an external source. More...
 
std::map< std::string, int > fObservablesDefined
 Stores the list of all the appeared process observables in the code. More...
 
std::map< std::string, int > fObservablesUpdated
 Stores the list of process observables updated when processing this event. More...
 
bool fReadOnly = false
 not used, keep for compatibility More...
 
TRestRunfRunInfo = nullptr
 < Pointer to TRestRun object where to find metadata. More...
 
bool fSingleThreadOnly = false
 
bool fValidateObservables = false
 It defines if observable names should be added to the validation list. More...
 

Private Member Functions

void Initialize () override
 Function to initialize input/output event members and define the section name. More...
 
void InitProcess () override
 To be executed at the beginning of the run (outside event loop) More...
 

Private Attributes

TRestDetectorHitsEventfInputEvent = nullptr
 A pointer to the process input event. More...
 
TRestDetectorHitsEventfOutputEvent = nullptr
 A pointer to the process output event. More...
 
TRandom3 * fRandom = nullptr
 A pointer to the random generator initializes with fSeed. More...
 

Additional Inherited Members

- Protected Types inherited from TRestEventProcess
enum  REST_Process_Output { No_Output , Observable , Internal_Var , Full_Output }
 
- Protected Member Functions inherited from TRestEventProcess
void BeginPrintProcess ()
 [name, cut range]
 
void CreateCanvas ()
 Create the canvas. More...
 
void EndPrintProcess ()
 
TRestEventProcessGetFriend (const std::string &nameOrType)
 
TRestEventProcessGetFriendLive (const std::string &nameOrType)
 
template<class T >
T * GetMetadata ()
 Get a metadata object from the host TRestRun. More...
 
TRestMetadataGetMetadata (const std::string &nameOrType)
 
size_t GetNumberOfParallelProcesses () const
 
template<class T >
GetObservableValue (const std::string &name)
 
TRestEventProcessGetParallel (int i)
 
template<class T >
std::vector< T > GetParallelDataMembers (T *member_of_process)
 Get a list of data members from parallel processes which is same to this process's certain data member. More...
 
template<class T >
void SetObservableValue (const std::string &name, const T &value)
 Set observable value for AnalysisTree. More...
 

Constructor & Destructor Documentation

◆ TRestDetectorHitsSmearingProcess()

TRestDetectorHitsSmearingProcess::TRestDetectorHitsSmearingProcess ( )

Default constructor.

Definition at line 77 of file TRestDetectorHitsSmearingProcess.cxx.

◆ ~TRestDetectorHitsSmearingProcess()

TRestDetectorHitsSmearingProcess::~TRestDetectorHitsSmearingProcess ( )

Default destructor.

Definition at line 82 of file TRestDetectorHitsSmearingProcess.cxx.

Member Function Documentation

◆ GetEnergyReference()

Double_t TRestDetectorHitsSmearingProcess::GetEnergyReference ( ) const
inline

Returns the reference energy where the FWHM is defined.

Definition at line 78 of file TRestDetectorHitsSmearingProcess.h.

◆ GetInputEvent()

RESTValue TRestDetectorHitsSmearingProcess::GetInputEvent ( ) const
inlineoverridevirtual

Get pointer to input event. Must be implemented in the derived class.

Implements TRestEventProcess.

Definition at line 57 of file TRestDetectorHitsSmearingProcess.h.

◆ GetOutputEvent()

RESTValue TRestDetectorHitsSmearingProcess::GetOutputEvent ( ) const
inlineoverridevirtual

Get pointer to output event. Must be implemented in the derived class.

Implements TRestEventProcess.

Definition at line 58 of file TRestDetectorHitsSmearingProcess.h.

◆ GetProcessMetadata()

TRestMetadata * TRestDetectorHitsSmearingProcess::GetProcessMetadata ( ) const
inline

Definition at line 73 of file TRestDetectorHitsSmearingProcess.h.

◆ GetProcessName()

const char * TRestDetectorHitsSmearingProcess::GetProcessName ( ) const
inlineoverridevirtual

Implements TRestEventProcess.

Definition at line 75 of file TRestDetectorHitsSmearingProcess.h.

◆ GetResolutionReference()

Double_t TRestDetectorHitsSmearingProcess::GetResolutionReference ( ) const
inline

Returns the energy resolution in FWHM for the reference energy.

Definition at line 81 of file TRestDetectorHitsSmearingProcess.h.

◆ Initialize()

void TRestDetectorHitsSmearingProcess::Initialize ( )
overrideprivatevirtual

Function to initialize input/output event members and define the section name.

Reimplemented from TRestMetadata.

Definition at line 90 of file TRestDetectorHitsSmearingProcess.cxx.

◆ InitProcess()

void TRestDetectorHitsSmearingProcess::InitProcess ( )
overrideprivatevirtual

To be executed at the beginning of the run (outside event loop)

Reimplemented from TRestEventProcess.

Definition at line 98 of file TRestDetectorHitsSmearingProcess.cxx.

◆ PrintMetadata()

void TRestDetectorHitsSmearingProcess::PrintMetadata ( )
inlineoverridevirtual

Implemented it in the derived metadata class to print out specific metadata information.

Prints metadata content on screen. Usually overloaded by the derived metadata class.

Reimplemented from TRestMetadata.

Definition at line 64 of file TRestDetectorHitsSmearingProcess.h.

◆ ProcessEvent()

TRestEvent * TRestDetectorHitsSmearingProcess::ProcessEvent ( TRestEvent inputEvent)
overridevirtual

The main processing event function.

Implements TRestEventProcess.

Definition at line 109 of file TRestDetectorHitsSmearingProcess.cxx.

Field Documentation

◆ fEnergyRef

Double_t TRestDetectorHitsSmearingProcess::fEnergyRef = 5.9
protected

Reference energy for the FWHM.

Definition at line 48 of file TRestDetectorHitsSmearingProcess.h.

◆ fInputEvent

TRestDetectorHitsEvent* TRestDetectorHitsSmearingProcess::fInputEvent = nullptr
private

A pointer to the process input event.

Definition at line 35 of file TRestDetectorHitsSmearingProcess.h.

◆ fOutputEvent

TRestDetectorHitsEvent* TRestDetectorHitsSmearingProcess::fOutputEvent = nullptr
private

A pointer to the process output event.

Definition at line 38 of file TRestDetectorHitsSmearingProcess.h.

◆ fRandom

TRandom3* TRestDetectorHitsSmearingProcess::fRandom = nullptr
private

A pointer to the random generator initializes with fSeed.

Definition at line 41 of file TRestDetectorHitsSmearingProcess.h.

◆ fResolutionAtERef

Double_t TRestDetectorHitsSmearingProcess::fResolutionAtERef = 15
protected

FWHM at Energy of reference.

Definition at line 51 of file TRestDetectorHitsSmearingProcess.h.

◆ fSeed

ULong_t TRestDetectorHitsSmearingProcess::fSeed = 0
protected

The seed to be used for the random generator.

Definition at line 54 of file TRestDetectorHitsSmearingProcess.h.


The documentation for this class was generated from the following files: