23#ifndef REST_TRestComponent
24#define REST_TRestComponent
30#include <ROOT/RDataFrame.hxx>
31#include <ROOT/RVec.hxx>
33#include "TRestDataSet.h"
34#include "TRestMetadata.h"
35#include "TRestResponse.h"
102 if (GetActiveNode() >= 0)
return true;
110 virtual void FillHistograms() = 0;
121 virtual void RegenerateActiveNodeDensity() {}
123 std::string GetNature()
const {
return fNature; }
126 size_t GetDimensions() {
return fVariables.size(); }
127 Int_t GetSamples() {
return fSamples; }
129 Double_t GetActiveNodeValue() {
136 std::vector<std::string> GetVariables()
const {
return fVariables; }
137 std::vector<TVector2> GetRanges()
const {
return fRanges; }
138 std::vector<Int_t> GetNbins()
const {
return fNbins; }
140 Double_t
GetRawRate(std::vector<Double_t> point);
145 Double_t
GetRate(std::vector<Double_t> point);
149 void SetPrecision(
const Float_t& pr) {
fPrecision = pr; }
158 void SetSamples(Int_t samples) {
fSamples = samples; }
164 THnD* GetDensityForNode(Double_t value);
165 THnD* GetDensityForActiveNode();
166 THnD* GetDensity() {
return GetDensityForActiveNode(); }
169 TH2D*
GetHistogram(Double_t node, std::string varName1, std::string varName2);
170 TH3D*
GetHistogram(Double_t node, std::string varName1, std::string varName2, std::string varName3);
173 TH2D*
GetHistogram(std::string varName1, std::string varName2);
174 TH3D*
GetHistogram(std::string varName1, std::string varName2, std::string varName3);
176 ROOT::RVecD GetRandom();
178 ROOT::RDF::RNode GetMonteCarloDataFrame(Int_t N = 100);
180 TCanvas*
DrawComponent(std::vector<std::string> drawVariables, std::vector<std::string> scanVariables,
181 Int_t binScanSize = 1, TString drawOption =
"");
187 void PrintStatistics();
190 TRestComponent(
const char* cfgFileName,
const std::string& name =
"");
It defines a background/signal model distribution in a given parameter space (tipically x,...
Double_t fFirstParameterValue
It defines the first parametric node value in case of automatic parameter generation.
Double_t fLastParameterValue
It defines the upper limit for the automatic parametric node values generation.
UInt_t fSeed
Seed used in random generator.
Double_t fStepParameterValue
It defines the increasing step for automatic parameter list generation.
void InitFromConfigFile() override
It customizes the retrieval of XML data values of this class.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionSolarFlux.
Double_t GetAllNodesIntegratedRate()
This method returns the integrated total rate for all the nodes The result will be returned in s-1.
Int_t fActiveNode
It is used to define the node that will be accessed for rate retrieval.
Int_t FindActiveNode(Double_t node)
It returns the position of the fParameterizationNodes element for the variable name given by argument...
void RegenerateParametricNodes(Double_t from, Double_t to, Double_t step, Bool_t expIncrease=false)
It allows to produce a parameter nodes list providing the initial value, the final value and the step...
Int_t fSamples
It introduces a fixed number of samples (if 0 it will take all available samples)
Int_t GetVariableIndex(std::string varName)
It returns the position of the fVariable element for the variable name given by argument.
Double_t GetBinCenter(Int_t nDim, const Int_t bin)
It returns the bin center of the given component dimension.
void PrintNodes()
It prints out on screen the values of the parametric node.
Double_t GetRawRate(std::vector< Double_t > point)
It returns the intensity/rate (in seconds) corresponding to the generated distribution or formula eva...
Bool_t fExponential
It true the parametric values automatically generated will grow exponentially.
Bool_t fInterpolation
Enables or disables the interpolation at TRestComponentDataSet::GetRawRate.
std::string fParameter
It is used to parameterize a set of distribution densities (e.g. WIMP or axion mass)
Double_t GetNormalizedRate(std::vector< Double_t > point)
It returns the intensity/rate (in seconds) corresponding to the generated distribution or formula eva...
TRestComponent()
Default constructor.
TH1D * GetHistogram(Double_t node, std::string varName)
It returns a 1-dimensional projected histogram for the variable names provided in the argument.
Float_t fPrecision
A precision used to select the node value with a given range defined as a fraction of the value.
std::vector< Int_t > fNbins
The number of bins in which we should divide each variable.
Double_t GetMaxRate()
This method returns the total rate for the node that has the highest contribution The result will be ...
TCanvas * DrawComponent(std::vector< std::string > drawVariables, std::vector< std::string > scanVariables, Int_t binScanSize=1, TString drawOption="")
A method allowing to draw a series of plots representing the density distributions.
void Initialize() override
It initializes the random number. We avoid to define the section name here since we will never define...
TRestResponse * fResponse
A pointer to the detector response.
Double_t GetTotalRate()
This method integrates the rate to all the parameter space defined in the density function....
std::vector< TVector2 > fRanges
The range of each of the variables used to create the PDF distribution.
std::vector< Double_t > fParameterizationNodes
It defines the nodes of the parameterization (Initialized by the dataset)
Bool_t HasNodes()
It returns true if any nodes have been defined.
TCanvas * fCanvas
A canvas for drawing the active node component.
Double_t GetRate(std::vector< Double_t > point)
It returns the intensity/rate (in seconds) corresponding to the generated distribution or formula eva...
TRandom3 * fRandom
Internal process random generator.
std::vector< std::string > fVariables
A list with the branches that will be used to create the distribution space.
~TRestComponent()
Default destructor.
void RegenerateHistograms(UInt_t seed=0)
It will produce a histogram with the distribution defined using the variables and the weights for eac...
Bool_t ValidNode(Double_t node)
It returns true if the node has been properly identified.
Int_t SetActiveNode(Double_t node)
It returns the position of the fParameterizationNodes element for the variable name given by argument...
std::vector< THnD * > fNodeDensity
The generated N-dimensional variable space density for a given node.
std::string fNature
It defines the component type (unknown/signal/background)
A response matrix that might be applied to a given component inside a TRestComponent.