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.
 
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.
 
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.
 
 TRestDataSetOdds (const char *configFilename, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestDataSetOdds ()
 Default destructor.
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

Constructor & Destructor Documentation

◆ TRestDataSetOdds()

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.


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