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

Detailed Description

A response matrix that might be applied to a given component inside a TRestComponent.

Documentation TOBE written


REST-for-Physics - Software for Rare Event Searches Toolkit

History of developments:

2023-December: First implementation of TRestResponse Javier Galan

Author
: Javier Galan (javie.nosp@m.r.ga.nosp@m.lan.l.nosp@m.acar.nosp@m.ra@ce.nosp@m.rn.c.nosp@m.h)

Definition at line 29 of file TRestResponse.h.

#include <TRestResponse.h>

Inheritance diagram for TRestResponse:
TRestMetadata

Public Member Functions

Bool_t ApplyInterpolation ()
 
 ClassDefOverride (TRestResponse, 1)
 
Double_t GetBinSize () const
 
TVector2 GetInputRange () const
 
std::vector< std::vector< Float_t > > GetMatrix () const
 
TVector2 GetOrigin () const
 
TVector2 GetOutputRange () const
 
std::vector< std::pair< Double_t, Double_t > > GetResponse (Double_t input)
 This method will return a vector of std::pair, each pair will contain the output energy together with the corresponding response (or efficiency), for the given input energy. More...
 
std::string GetResponseFilename () const
 
std::string GetVariable () const
 
void Initialize () override
 It will initialize the data frame with the filelist and column names (or observables) that have been defined by the user. More...
 
void Interpolate (Bool_t interpolate=true)
 
void LoadResponse (Bool_t transpose=true)
 It loads into the fResponseMatrix data member the response from a file. More...
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestAxionSolarFlux. More...
 
void PrintResponseMatrix (Int_t fromRow, Int_t toRow)
 Prints on screen the information about the metadata members of TRestAxionSolarFlux. More...
 
void SetBinSize (Double_t bSize)
 
void SetOrigin (const TVector2 &v)
 
void SetResponseFilename (std::string responseFile)
 
void SetVariable (const std::string &var)
 
 TRestResponse ()
 Default constructor. More...
 
 TRestResponse (const char *cfgFileName, const std::string &name="")
 Constructor loading data from a config file. More...
 
 ~TRestResponse ()
 Default destructor. More...
 

Private Attributes

Double_t fBinSize = 0.1
 The resolution of the response matrix (binning) More...
 
std::string fFilename = ""
 The filename used to import the response matrix. More...
 
Bool_t fInterpolation = false
 It allows to decide if the returned response should be interpolated (default:false) More...
 
TVector2 fOrigin = TVector2(0, 0)
 First element of the response matrix (input/incident, output/detected) More...
 
std::vector< std::vector< Float_t > > fResponseMatrix
 The response matrix. More...
 
Bool_t fTransposed = false
 Determines if the response matrix has been transposed. More...
 
std::string fVariable = ""
 It defines the variable name for which the response should be applied to. More...
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ TRestResponse() [1/2]

TRestResponse::TRestResponse ( const char *  cfgFileName,
const std::string &  name = "" 
)

Constructor loading data from a config file.

If no configuration path is defined using TRestMetadata::SetConfigFilePath the path to the config file must be specified using full path, absolute or relative.

The default behaviour is that the config file must be specified with full path, absolute or relative.

Parameters
cfgFileNameA const char* giving the path to an RML file.
nameThe name of the specific metadata. It will be used to find the corresponding TRestAxionMagneticField section inside the RML.

Definition at line 64 of file TRestResponse.cxx.

◆ TRestResponse() [2/2]

TRestResponse::TRestResponse ( )

Default constructor.

Definition at line 48 of file TRestResponse.cxx.

◆ ~TRestResponse()

TRestResponse::~TRestResponse ( )

Default destructor.

Definition at line 75 of file TRestResponse.cxx.

Member Function Documentation

◆ ApplyInterpolation()

Bool_t TRestResponse::ApplyInterpolation ( )
inline

Definition at line 58 of file TRestResponse.h.

◆ GetBinSize()

Double_t TRestResponse::GetBinSize ( ) const
inline

Definition at line 61 of file TRestResponse.h.

◆ GetInputRange()

TVector2 TRestResponse::GetInputRange ( ) const
inline

Definition at line 66 of file TRestResponse.h.

◆ GetMatrix()

std::vector< std::vector< Float_t > > TRestResponse::GetMatrix ( ) const
inline

Definition at line 84 of file TRestResponse.h.

◆ GetOrigin()

TVector2 TRestResponse::GetOrigin ( ) const
inline

Definition at line 63 of file TRestResponse.h.

◆ GetOutputRange()

TVector2 TRestResponse::GetOutputRange ( ) const
inline

Definition at line 70 of file TRestResponse.h.

◆ GetResponse()

std::vector< std::pair< Double_t, Double_t > > TRestResponse::GetResponse ( Double_t  input)

This method will return a vector of std::pair, each pair will contain the output energy together with the corresponding response (or efficiency), for the given input energy.

The output value will be mapped following the binning and the origin given on the metadata members.

Definition at line 140 of file TRestResponse.cxx.

◆ GetResponseFilename()

std::string TRestResponse::GetResponseFilename ( ) const
inline

Definition at line 62 of file TRestResponse.h.

◆ GetVariable()

std::string TRestResponse::GetVariable ( ) const
inline

Definition at line 64 of file TRestResponse.h.

◆ Initialize()

void TRestResponse::Initialize ( )
overridevirtual

It will initialize the data frame with the filelist and column names (or observables) that have been defined by the user.

Reimplemented from TRestMetadata.

Definition at line 81 of file TRestResponse.cxx.

◆ Interpolate()

void TRestResponse::Interpolate ( Bool_t  interpolate = true)
inline

Definition at line 59 of file TRestResponse.h.

◆ LoadResponse()

void TRestResponse::LoadResponse ( Bool_t  transpose = true)

It loads into the fResponseMatrix data member the response from a file.

For the moment only binary data files with format .N???f have been implemented.

The response file should be arranged in a way that the more internal std::vector (row) inside the std::vector <std::vector> table corresponds to a specific transformed energy (output). For example, if we have the incident particle energy (input) and the expected detected energy response (output) for that energy, then each row in the matrix corresponds to a detected energy and each element of that row defines the fraction of incident energies that contributed to that detected energy.

Thats why we may need to transpose the matrix, so that when we can extract a row (detected energy) from the matrix directly, such as fMatrix[n], and we just get the vector that should convolute with the Signal(Ei) that is a vector of signals as a function of incident energy. The resulting scalar product will give the expected signal at the detection energy.

Definition at line 102 of file TRestResponse.cxx.

◆ PrintMetadata()

void TRestResponse::PrintMetadata ( )
overridevirtual

Prints on screen the information about the metadata members of TRestAxionSolarFlux.

Reimplemented from TRestMetadata.

Definition at line 215 of file TRestResponse.cxx.

◆ PrintResponseMatrix()

void TRestResponse::PrintResponseMatrix ( Int_t  fromRow = 0,
Int_t  toRow = 0 
)

Prints on screen the information about the metadata members of TRestAxionSolarFlux.

Definition at line 208 of file TRestResponse.cxx.

◆ SetBinSize()

void TRestResponse::SetBinSize ( Double_t  bSize)
inline

Definition at line 53 of file TRestResponse.h.

◆ SetOrigin()

void TRestResponse::SetOrigin ( const TVector2 &  v)
inline

Definition at line 55 of file TRestResponse.h.

◆ SetResponseFilename()

void TRestResponse::SetResponseFilename ( std::string  responseFile)
inline

Definition at line 54 of file TRestResponse.h.

◆ SetVariable()

void TRestResponse::SetVariable ( const std::string &  var)
inline

Definition at line 56 of file TRestResponse.h.

Field Documentation

◆ fBinSize

Double_t TRestResponse::fBinSize = 0.1
private

The resolution of the response matrix (binning)

Definition at line 41 of file TRestResponse.h.

◆ fFilename

std::string TRestResponse::fFilename = ""
private

The filename used to import the response matrix.

Definition at line 32 of file TRestResponse.h.

◆ fInterpolation

Bool_t TRestResponse::fInterpolation = false
private

It allows to decide if the returned response should be interpolated (default:false)

Definition at line 50 of file TRestResponse.h.

◆ fOrigin

TVector2 TRestResponse::fOrigin = TVector2(0, 0)
private

First element of the response matrix (input/incident, output/detected)

Definition at line 38 of file TRestResponse.h.

◆ fResponseMatrix

std::vector<std::vector<Float_t> > TRestResponse::fResponseMatrix
private

The response matrix.

Definition at line 44 of file TRestResponse.h.

◆ fTransposed

Bool_t TRestResponse::fTransposed = false
private

Determines if the response matrix has been transposed.

Definition at line 47 of file TRestResponse.h.

◆ fVariable

std::string TRestResponse::fVariable = ""
private

It defines the variable name for which the response should be applied to.

Definition at line 35 of file TRestResponse.h.


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