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

Detailed Description

This class is meant to compute the log odds for different datasets.

TRestDataSetOdds performs the log odds of the different observables given in the config file and for a particular dataSet. To perform the log odds first the probability density funcion (PDF) is obtained for a set of observables in the desired range. Later on, the log odds is computed as log(1. - odds) - log(odds) obtaining a number which is proportional to how likely is an event with respect the desired distribution; lower the number, more likely is the event to the input distribution. New observables are created in the output dataSet odds_obserbable and the addition of all of them in odds_total. If an input odds file is provided, the different PDFs are retrieved from the input file.

A summary of the basic parameters is described below:

The different observables, range and nBins are added as follow:

<observable name="tckAna_MaxTrack_XYZ_SigmaZ2" range="(0,20)" nBins="100"/>

In addition a TRestCut is used as input for the generation of PDFs, check TRestCut class for more info.

Examples

Example of RML config file:

<TRestDataSetOdds name="LogOdds" verboseLevel="info">
<observable name="tckAna_MaxTrack_XYZ_SigmaZ2" range="(0,20)" nBins="100"/>
<observable name="tckAna_MaxTrackEnergyBalanceXY" range="(-5,5)" nBins="100"/>
<observable name="tckAna_MaxTrack_XZ_nHits" range="(0,20)" nBins="20" />
<observable name="tckAna_MaxTrack_YZ_nHits" range="(0,20)" nBins="20" />
<observable name="tckAna_MaxTrackEnergyRatio" range="(0,0.1)" nBins="100" />
<observable name="tckAna_MaxTrack_XZ_SigmaX" range="(0,10)" nBins="100" />
<observable name="tckAna_MaxTrack_YZ_SigmaY" range="(0,10)" nBins="100" />
<observable name="tckAna_MaxTrackxySigmaBalance" range="(-1,1)" nBins="25"/>
<TRestCut name="EnergyCut" verboseLevel="info">
<cut name="c1" variable="calib_Energy" condition=">4" />
<cut name="c2" variable="calib_Energy" condition="<8" />
<parameter name="dataSetName" value="myDataSet.root"/>
A class to help on cuts definitions. To be used with TRestAnalysisTree.
Definition: TRestCut.h:31
This class is meant to compute the log odds for different datasets.

Example to compute the the odds over a dataSet using restRoot:

[0] TRestDataSetOdds odds ("odds.rml");
[1] odds.SetDataSetName("myDataSet.root");
[2] odds.SetOutputFileName("myComputedOddsDataSet.root");
[3] odds.ComputeLogOdds();

Example to compute the the odds over a dataSet with input odds file using restRoot:

[0] TRestDataSetOdds odds ("odds.rml");
[1] odds.SetDataSetName("myDataSet.root");
[2] odds.SetOutputFileName("myComputedOddsDataSet.root");
[3] odds.odds.SetOddsFile("myOddsDataSet.root");
[4] odds.ComputeLogOdds();

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

History of developments:

2023-03: First implementation of TRestDataSetOdds JuanAn Garcia

Author
: JuanAn Garcia e-mail: juana.nosp@m.ngp@.nosp@m.uniza.nosp@m.r.es

Definition at line 31 of file TRestDataSetOdds.h.

#include <TRestDataSetOdds.h>

Inheritance diagram for TRestDataSetOdds:
TRestMetadata

Public Member Functions

void AddOddsObservable (const std::string &name, const TVector2 &range, int nbins)
 
 ClassDefOverride (TRestDataSetOdds, 1)
 
void ComputeLogOdds ()
 This function computes the log odds for a given dataSet. If no calibration odds file is provided it computes the PDF for the given observables. Otherwise, it takes the PDF from the input file. This function generate different observables odds_obsName and the addition of all of them for a further processing, which is stored in odds_total observable. More...
 
TRestCutGetCut ()
 
std::string GetDataSetName ()
 
std::string GetOddsFile ()
 
std::vector< std::tuple< std::string, TVector2, int > > GetOddsObservables ()
 
std::string GetOutputFileName ()
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestDataSetOdds. More...
 
void SetCut (TRestCut *cut)
 
void SetDataSetName (const std::string &dSName)
 
void SetOddsFile (const std::string &oddsFile)
 
void SetOddsObservables (const std::vector< std::tuple< std::string, TVector2, int > > &obs)
 
void SetOutputFileName (const std::string &outName)
 
 TRestDataSetOdds ()
 Default constructor. More...
 
 TRestDataSetOdds (const char *configFilename, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestDataSetOdds ()
 Default destructor. More...
 

Private Member Functions

void InitFromConfigFile () override
 Function to initialize some variables from configfile. More...
 
void Initialize () override
 Function to initialize input/output event members and define the section name. More...
 

Private Attributes

TRestCutfCut = nullptr
 Cuts over the dataset for PDF selection. More...
 
std::string fDataSetName = ""
 Name of the dataSet inside the config file. More...
 
std::map< std::string, TH1F * > fHistos
 Map containing the PDF of the different observables. More...
 
std::vector< std::string > fObsName
 Vector containing different obserbable names. More...
 
std::vector< int > fObsNbins
 Vector containing number of bins for the different observables. More...
 
std::vector< TVector2 > fObsRange
 Vector containing different obserbable ranges. More...
 
std::string fOddsFile = ""
 Name of the odds file to be used to get the PDF. More...
 
std::string fOutputFileName = ""
 Name of the output file. More...
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ TRestDataSetOdds() [1/2]

TRestDataSetOdds::TRestDataSetOdds ( )

Default constructor.

Definition at line 112 of file TRestDataSetOdds.cxx.

◆ TRestDataSetOdds() [2/2]

TRestDataSetOdds::TRestDataSetOdds ( const char *  configFilename,
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
configFilenameA const char* that defines the RML filename.
nameThe name of the metadata section. It will be used to find the corresponding TRestDataSetOdds section inside the RML.

Definition at line 128 of file TRestDataSetOdds.cxx.

◆ ~TRestDataSetOdds()

TRestDataSetOdds::~TRestDataSetOdds ( )

Default destructor.

Definition at line 139 of file TRestDataSetOdds.cxx.

Member Function Documentation

◆ AddOddsObservable()

void TRestDataSetOdds::AddOddsObservable ( const std::string &  name,
const TVector2 &  range,
int  nbins 
)

Definition at line 296 of file TRestDataSetOdds.cxx.

◆ ComputeLogOdds()

void TRestDataSetOdds::ComputeLogOdds ( )

This function computes the log odds for a given dataSet. If no calibration odds file is provided it computes the PDF for the given observables. Otherwise, it takes the PDF from the input file. This function generate different observables odds_obsName and the addition of all of them for a further processing, which is stored in odds_total observable.

Definition at line 204 of file TRestDataSetOdds.cxx.

◆ GetCut()

TRestCut * TRestDataSetOdds::GetCut ( )
inline

Definition at line 69 of file TRestDataSetOdds.h.

◆ GetDataSetName()

std::string TRestDataSetOdds::GetDataSetName ( )
inline

Definition at line 67 of file TRestDataSetOdds.h.

◆ GetOddsFile()

std::string TRestDataSetOdds::GetOddsFile ( )
inline

Definition at line 66 of file TRestDataSetOdds.h.

◆ GetOddsObservables()

std::vector< std::tuple< std::string, TVector2, int > > TRestDataSetOdds::GetOddsObservables ( )

Definition at line 284 of file TRestDataSetOdds.cxx.

◆ GetOutputFileName()

std::string TRestDataSetOdds::GetOutputFileName ( )
inline

Definition at line 68 of file TRestDataSetOdds.h.

◆ InitFromConfigFile()

void TRestDataSetOdds::InitFromConfigFile ( )
overrideprivatevirtual

Function to initialize some variables from configfile.

Reimplemented from TRestMetadata.

Definition at line 151 of file TRestDataSetOdds.cxx.

◆ Initialize()

void TRestDataSetOdds::Initialize ( )
overrideprivatevirtual

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

Reimplemented from TRestMetadata.

Definition at line 145 of file TRestDataSetOdds.cxx.

◆ PrintMetadata()

void TRestDataSetOdds::PrintMetadata ( )
overridevirtual

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

Reimplemented from TRestMetadata.

Definition at line 312 of file TRestDataSetOdds.cxx.

◆ SetCut()

void TRestDataSetOdds::SetCut ( TRestCut cut)
inline

Definition at line 74 of file TRestDataSetOdds.h.

◆ SetDataSetName()

void TRestDataSetOdds::SetDataSetName ( const std::string &  dSName)
inline

Definition at line 71 of file TRestDataSetOdds.h.

◆ SetOddsFile()

void TRestDataSetOdds::SetOddsFile ( const std::string &  oddsFile)
inline

Definition at line 73 of file TRestDataSetOdds.h.

◆ SetOddsObservables()

void TRestDataSetOdds::SetOddsObservables ( const std::vector< std::tuple< std::string, TVector2, int > > &  obs)

Definition at line 302 of file TRestDataSetOdds.cxx.

◆ SetOutputFileName()

void TRestDataSetOdds::SetOutputFileName ( const std::string &  outName)
inline

Definition at line 72 of file TRestDataSetOdds.h.

Field Documentation

◆ fCut

TRestCut* TRestDataSetOdds::fCut = nullptr
private

Cuts over the dataset for PDF selection.

Definition at line 52 of file TRestDataSetOdds.h.

◆ fDataSetName

std::string TRestDataSetOdds::fDataSetName = ""
private

Name of the dataSet inside the config file.

Definition at line 37 of file TRestDataSetOdds.h.

◆ fHistos

std::map<std::string, TH1F*> TRestDataSetOdds::fHistos
private

Map containing the PDF of the different observables.

Definition at line 55 of file TRestDataSetOdds.h.

◆ fObsName

std::vector<std::string> TRestDataSetOdds::fObsName
private

Vector containing different obserbable names.

Definition at line 40 of file TRestDataSetOdds.h.

◆ fObsNbins

std::vector<int> TRestDataSetOdds::fObsNbins
private

Vector containing number of bins for the different observables.

Definition at line 46 of file TRestDataSetOdds.h.

◆ fObsRange

std::vector<TVector2> TRestDataSetOdds::fObsRange
private

Vector containing different obserbable ranges.

Definition at line 43 of file TRestDataSetOdds.h.

◆ fOddsFile

std::string TRestDataSetOdds::fOddsFile = ""
private

Name of the odds file to be used to get the PDF.

Definition at line 49 of file TRestDataSetOdds.h.

◆ fOutputFileName

std::string TRestDataSetOdds::fOutputFileName = ""
private

Name of the output file.

Definition at line 34 of file TRestDataSetOdds.h.


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