|
Crombie Tools
|
Can be created using the CrombieTools.SkimmingTools.Corrector module. More...
#include <Corrector.h>
Inheritance diagram for Corrector:Public Types | |
| enum | HistReader { eValue = 0, eZeroCenteredUnc, eUnityCenteredUnc } |
| Used to set the way to read the correction histogram. More... | |
Public Types inherited from Debug | |
| enum | DebugLevel { eQuiet = 0, eError, eInfo, eDebug } |
| Different possible debug levels. More... | |
Public Member Functions | |
| Corrector (TString name="correction") | |
| Constructor setting the name of a branch it would like to write to. More... | |
| virtual | ~Corrector () |
| void | AddInExpression (TString expres) |
| Add an expression to read from the histogram. More... | |
| Bool_t | CompareFileName (TString fileName) |
| Compares the file name to the Regex and returns true if corrections will be applied. More... | |
| virtual Corrector * | Copy () |
| Copy this Corrector for parallelization. More... | |
| Float_t | Evaluate () |
| Evaluate the TTree pointer fInTree at its current entry. More... | |
| std::pair< bool, Float_t > | EvaluateWithFlag () |
| Evaluate the TTree pointer fInTree at its current entry and return a status bit corresponding to cut. More... | |
| virtual std::vector< TString > | GetFormulas () |
| Gets the list of formulas that this corrector is using. More... | |
| TString | GetName () const |
| Get the name of the branch that this Corrector would like to write to. More... | |
| void | SetBinning (UInt_t num, Double_t min, Double_t max) |
| Set the binning when the histograms do not store the correct x values. More... | |
| void | SetCorrectionFile (TString fileName) |
| Set the file containing the correction histogram by name. More... | |
| void | SetCorrectionHist (TString histName) |
| Set the correction histogram name within the correction file. More... | |
| void | SetCorrectionHist (TString hist1, TString hist2) |
| Set two histograms to divide in order to obtain the correction histogram. More... | |
| void | SetHistReader (HistReader reader) |
| Set the type of histogram reader. More... | |
| void | SetInCut (TString cut) |
| Set a cut for the corrector. More... | |
| virtual void | SetInTree (TTree *tree) |
| Set the pointer to the TTree this Corrector is reading. More... | |
| void | SetMatchFileName (TString regexpr) |
| Set a RegEx for the Corrector to check against the filename. If no match, corrections are not applied. More... | |
Public Member Functions inherited from Debug | |
| Debug () | |
| virtual | ~Debug () |
| DebugLevel | GetDebugLevel () |
| Gets the verbosity for a class. More... | |
| template<typename T , typename... V> | |
| void | Message (DebugLevel level, T message, V... more) |
| Sends a message if the verbosity level is appropriate. More... | |
| void | Message (DebugLevel level) |
| void | SetDebugLevel (DebugLevel level) |
| Sets the verbosity for a class. More... | |
Public Attributes | |
| bool | Merge = true |
| Flag determining whether or not to merge into the CorrectorApplicator branch. More... | |
Protected Member Functions | |
| virtual Float_t | DoEval () |
| Function that actually does the evaluation of the correction factor. More... | |
| Double_t | GetFormulaResult (Int_t index, Bool_t use_mins=true) |
| Evaluate one of the formulae. If use_lims, then don't give a result that would go off the relevant axis. More... | |
| Int_t | GetNumDims () |
| Get the number of dimensions that the formulas hold. More... | |
| void | InitializeTree () |
| Function to initialize TTreeFormula on the tree. More... | |
Protected Member Functions inherited from Debug | |
| void | DisplayFunc (const char *func) |
| Sends the name of the function during debuggin. More... | |
Protected Attributes | |
| TTreeFormula * | fCutFormula = NULL |
| Formula for cut. More... | |
| TString | fInCut = "1" |
| Corrector cut. More... | |
| TTree * | fInTree = NULL |
| Pointer to tree being read. More... | |
| Bool_t | fIsCopy = false |
| Track if instance is a copy. More... | |
| Bool_t | fMatchedFileName |
| A flag telling this corrector if the file has been matched. More... | |
| TString | fName |
| Name of branch to write to. More... | |
Private Member Functions | |
| void | SetMinMax () |
| Set the mininum and maximum values for each histogram axis. More... | |
Private Attributes | |
| Double_t | bin_max = 0 |
| Double_t | bin_min = 0 |
| UInt_t | bin_num = 0 |
| Used if the binning of the histograms is off. More... | |
| TFile * | fCorrectionFile = NULL |
| Name of file containing correction histogram. More... | |
| TH1 * | fCorrectionHist = NULL |
| Name of correction histogram. More... | |
| std::vector< TTreeFormula * > | fFormulas |
| Formulae of fInExpressions. More... | |
| HistReader | fHistReader = eValue |
| The method to reading histograms. More... | |
| std::vector< TString > | fInExpressions |
| Expressions to read from tree. More... | |
| TString | fMatchFileName = "" |
| std::vector< Double_t > | fMaxs |
| Maximum possible values of each axis. More... | |
| std::vector< Double_t > | fMins |
| Minimum possible values of each axis. More... | |
| Int_t | fNumDims = 0 |
| Number of dimensions in the correction histogram. More... | |
Can be created using the CrombieTools.SkimmingTools.Corrector module.
A Corrector reads from a tree and histogram and returns a correction factor. The CorrectorApplicator facilitates this application by providing the trees and writes the result to a branch.
Definition at line 32 of file Corrector.h.
Used to set the way to read the correction histogram.
Note that the uncertainty is added in quadrature, so the unity-centered uncertainty can safely be used for both up and down histograms.
Definition at line 80 of file Corrector.h.
| Corrector::Corrector | ( | TString | name = "correction" | ) |
Constructor setting the name of a branch it would like to write to.
Referenced by Copy().
|
virtual |
Definition at line 23 of file Corrector.cc.
References fCorrectionFile, fCutFormula, fFormulas, and fIsCopy.
|
inline |
Add an expression to read from the histogram.
In most normal uses (reading from a TH1) this function needs to only be called once. If reading from a 2D histogram, call it twice. This gets the bin contents in the order that the expressions were added. Up to 3D histograms is supported.
Definition at line 66 of file Corrector.h.
References fInExpressions, and fNumDims.
Referenced by TMVACorrector::ReadVarConfig().
| Bool_t Corrector::CompareFileName | ( | TString | fileName | ) |
Compares the file name to the Regex and returns true if corrections will be applied.
Definition at line 185 of file Corrector.cc.
References fMatchedFileName, and fMatchFileName.
|
virtual |
Copy this Corrector for parallelization.
Reimplemented in TwoScaleFactorCorrector, TMVACorrector, and FormulaCorrector.
Definition at line 211 of file Corrector.cc.
References Corrector(), fIsCopy, and CrombieTools.SkimmingTools.Corrector::newCorrector.
|
protectedvirtual |
Function that actually does the evaluation of the correction factor.
Reimplemented in TwoScaleFactorCorrector, FormulaCorrector, and TMVACorrector.
Definition at line 98 of file Corrector.cc.
References bin_max, bin_min, bin_num, fCorrectionHist, fNumDims, and GetFormulaResult().
Referenced by EvaluateWithFlag().
| Float_t Corrector::Evaluate | ( | ) |
Evaluate the TTree pointer fInTree at its current entry.
Definition at line 154 of file Corrector.cc.
References EvaluateWithFlag().
| std::pair< bool, Float_t > Corrector::EvaluateWithFlag | ( | ) |
Evaluate the TTree pointer fInTree at its current entry and return a status bit corresponding to cut.
Definition at line 128 of file Corrector.cc.
References DoEval(), eUnityCenteredUnc, eZeroCenteredUnc, fCutFormula, fHistReader, fInTree, and fMatchedFileName.
Referenced by Evaluate().
|
protected |
Evaluate one of the formulae. If use_lims, then don't give a result that would go off the relevant axis.
Definition at line 80 of file Corrector.cc.
References bin_max, bin_min, bin_num, fFormulas, fMaxs, and fMins.
Referenced by TMVACorrector::DoEval(), and DoEval().
|
virtual |
Gets the list of formulas that this corrector is using.
Reimplemented in TwoScaleFactorCorrector, and FormulaCorrector.
Definition at line 219 of file Corrector.cc.
References fInCut, and fInExpressions.
Referenced by FormulaCorrector::GetFormulas(), and SetInTree().
|
inline |
Get the name of the branch that this Corrector would like to write to.
Definition at line 58 of file Corrector.h.
References fName.
|
inlineprotected |
Get the number of dimensions that the formulas hold.
Definition at line 112 of file Corrector.h.
References fNumDims.
Referenced by TMVACorrector::Copy(), and TMVACorrector::DoEval().
|
protected |
Function to initialize TTreeFormula on the tree.
Definition at line 162 of file Corrector.cc.
References fCutFormula, fFormulas, fInCut, fInExpressions, and fInTree.
Referenced by SetInTree().
|
inline |
Set the binning when the histograms do not store the correct x values.
Definition at line 95 of file Corrector.h.
| void Corrector::SetCorrectionFile | ( | TString | fileName | ) |
Set the file containing the correction histogram by name.
Definition at line 36 of file Corrector.cc.
References Debug::eError, fCorrectionFile, and Debug::Message().
| void Corrector::SetCorrectionHist | ( | TString | histName | ) |
Set the correction histogram name within the correction file.
Definition at line 46 of file Corrector.cc.
References Debug::eError, fCorrectionFile, fCorrectionHist, Debug::Message(), and SetMinMax().
| void Corrector::SetCorrectionHist | ( | TString | hist1, |
| TString | hist2 | ||
| ) |
Set two histograms to divide in order to obtain the correction histogram.
Definition at line 58 of file Corrector.cc.
References Debug::eError, fCorrectionFile, fCorrectionHist, Debug::Message(), and SetMinMax().
|
inline |
Set the type of histogram reader.
Definition at line 87 of file Corrector.h.
References fHistReader.
|
inline |
|
inlinevirtual |
Set the pointer to the TTree this Corrector is reading.
Reimplemented in TwoScaleFactorCorrector, and FormulaCorrector.
Definition at line 70 of file Corrector.h.
References fInTree, GetFormulas(), and InitializeTree().
Referenced by FormulaCorrector::SetInTree(), and TwoScaleFactorCorrector::SetInTree().
|
inline |
Set a RegEx for the Corrector to check against the filename. If no match, corrections are not applied.
Definition at line 90 of file Corrector.h.
References fMatchFileName.
|
private |
Set the mininum and maximum values for each histogram axis.
Definition at line 191 of file Corrector.cc.
References Debug::eError, fCorrectionHist, fMaxs, fMins, fNumDims, and Debug::Message().
Referenced by SetCorrectionHist().
|
private |
Definition at line 128 of file Corrector.h.
Referenced by DoEval(), GetFormulaResult(), and SetBinning().
|
private |
Definition at line 127 of file Corrector.h.
Referenced by DoEval(), GetFormulaResult(), and SetBinning().
|
private |
Used if the binning of the histograms is off.
Definition at line 126 of file Corrector.h.
Referenced by DoEval(), GetFormulaResult(), and SetBinning().
|
private |
Name of file containing correction histogram.
Definition at line 115 of file Corrector.h.
Referenced by SetCorrectionFile(), SetCorrectionHist(), and ~Corrector().
|
private |
Name of correction histogram.
Definition at line 116 of file Corrector.h.
Referenced by DoEval(), SetCorrectionHist(), and SetMinMax().
|
protected |
Formula for cut.
Definition at line 105 of file Corrector.h.
Referenced by EvaluateWithFlag(), InitializeTree(), and ~Corrector().
|
private |
Formulae of fInExpressions.
Definition at line 121 of file Corrector.h.
Referenced by GetFormulaResult(), InitializeTree(), and ~Corrector().
|
private |
The method to reading histograms.
Definition at line 124 of file Corrector.h.
Referenced by EvaluateWithFlag(), and SetHistReader().
|
protected |
Corrector cut.
Definition at line 104 of file Corrector.h.
Referenced by GetFormulas(), InitializeTree(), and SetInCut().
|
private |
Expressions to read from tree.
Definition at line 120 of file Corrector.h.
Referenced by AddInExpression(), GetFormulas(), and InitializeTree().
|
protected |
Pointer to tree being read.
Definition at line 103 of file Corrector.h.
Referenced by EvaluateWithFlag(), InitializeTree(), FormulaCorrector::SetInTree(), and SetInTree().
|
protected |
Track if instance is a copy.
Definition at line 106 of file Corrector.h.
Referenced by FormulaCorrector::Copy(), TMVACorrector::Copy(), Copy(), TwoScaleFactorCorrector::Copy(), and ~Corrector().
|
protected |
A flag telling this corrector if the file has been matched.
Definition at line 107 of file Corrector.h.
Referenced by CompareFileName(), and EvaluateWithFlag().
|
private |
Definition at line 130 of file Corrector.h.
Referenced by CompareFileName(), and SetMatchFileName().
|
private |
Maximum possible values of each axis.
Definition at line 123 of file Corrector.h.
Referenced by GetFormulaResult(), and SetMinMax().
|
private |
Minimum possible values of each axis.
Definition at line 122 of file Corrector.h.
Referenced by GetFormulaResult(), and SetMinMax().
|
protected |
Name of branch to write to.
Definition at line 99 of file Corrector.h.
Referenced by TMVACorrector::Copy(), GetName(), and TMVACorrector::ReadVarConfig().
|
private |
Number of dimensions in the correction histogram.
Definition at line 119 of file Corrector.h.
Referenced by AddInExpression(), DoEval(), GetNumDims(), and SetMinMax().
| bool Corrector::Merge = true |
Flag determining whether or not to merge into the CorrectorApplicator branch.
Definition at line 92 of file Corrector.h.