laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.

Class for defining the SPlot technique. More...

#include <LauSPlot.hh>

Inheritance diagram for LauSPlot:

Public Types

typedef std::set< TString > NameSet
 Type to store names, e.g. of the discriminating/control variables.
 
typedef std::map< TString, Double_t > NumbMap
 Type to associate a category name with a double precision number, e.g. a yield or PDF value for a given species.
 
typedef std::map< TString, TLeaf * > LeafMap
 Type to associate a variable name with the leaf of the input tree.
 
typedef std::multimap< TString, std::pair< TString, TString > > TwoDMap
 Type to associate the name of the species that have 2D PDFs with the names of the two variables involved in each such PDF.
 

Public Member Functions

 LauSPlot (const TString &fileName, const TString &treeName, Int_t firstExpt, Int_t nExpt, const NameSet &variableNames, const LauSPlot::NumbMap &freeSpecies, const LauSPlot::NumbMap &fixdSpecies, const TwoDMap &twodimPDFs, Bool_t sigSplit=kFALSE, Bool_t scfDPSmeared=kFALSE)
 Constructor. More...
 
virtual ~LauSPlot ()
 Destructor.
 
void runCalculations (const TString &option="q")
 Method to calculate the sWeights and cN coeffs. More...
 
void writeOutResults ()
 Save the sWeight results as a friend tree to the input tree (in the same file)
 
const std::vector< LauSPlot::NumbMap > & totalPdf () const
 Access the per-event total PDF values for each species. More...
 

Protected Member Functions

Bool_t readInput () const
 Check whether the input tree has been successfully read. More...
 
void readInput (Bool_t ok)
 Set that the input tree has been successfully read. More...
 
Bool_t signalSplit () const
 Check whether the signal is split into Truth Matched and Self Cross Feed. More...
 
Bool_t scfDPSmear () const
 Check whether the Self Cross Feed is smeared in the DP. More...
 
Bool_t definedCNBranches () const
 Check whether the cN branches have been already created. More...
 
void definedCNBranches (Bool_t defined)
 Set that the cN branches have been already defined. More...
 
Bool_t definedSWeightBranches () const
 Check whether the sWeights branches have been already created. More...
 
void definedSWeightBranches (Bool_t defined)
 Set that the sWeights branches have been already defined. More...
 
void openInputFileAndTree ()
 Method to open the file in "update" mode and grab the input tree for reading.
 
void readInputInfo ()
 Read the leaf structure from the tree and check the status of the read (calls LauSPlot::readInputLeaves and LauSPlot::checkLeaves)
 
Bool_t readInputLeaves ()
 Read the leaf structure from the tree and setup the leaf map.
 
Bool_t checkLeaves () const
 Check whether the leaf structure makes sense given the PDFs we are expecting.
 
void createCNTree ()
 Create (if not already done) the tree for storing the cN coeffs.
 
void defineCNBranches ()
 Create the branches for each cN coefficient.
 
void createSWeightTree ()
 Create (if not already done) the tree for storing the sWeights.
 
void defineSWeightBranches ()
 Create the branches to store the sWeights.
 
void setExperiment (Int_t iExpt)
 Set the event list to contain only events from the given experiment. More...
 
void readExpt ()
 Reads the values of each PDF likelihood for every event in the experiment.
 
void checkFitter () const
 Make sure that we're using Minuit.
 
void initialiseFitter (const TString &opt)
 Initialise Minuit, set the verbosity. More...
 
void setFitParameters () const
 Add the species yields as fit parameters and fix them as appropriate.
 
void runFit ()
 Perform the minimisation wrt the yields alone.
 
void retrieveFittedParameters (const TString &opt)
 Update the yields with the newly fitted values and print them (unless print option is "Q"). More...
 
void printCovMatrixElements (const Double_t *covmat=0) const
 Print the supplied covariance matrix or, if pointer is null, the one previously calculated. More...
 
void printSumOfWeights (const TString &exclName) const
 Print the sum of sWeights for all species. More...
 
Bool_t calcCovMatrix ()
 
void calcTotPDFValues (const TString &exclName)
 Calculate the total likelihood for each species by multiply together all the PDFs for that species. More...
 
void calcCNCoeffs (const TString &exclName, const Double_t *covmat=0)
 Computes the cN for the extended sPlots from the covariance matrix. More...
 
void calcSWeights (const TString &exclName, Double_t *covmat=0)
 Computes the sWeights from the PDFs and covariance matrix. More...
 
void copyEventWeights (Int_t iEvent)
 Copy the sWeight of a given event into LauSPlot::sWeightsCurrent_, from which they can be stored in the output tree. More...
 
void fillCNBranches ()
 Fill the cN branches.
 
void fillSWeightBranches ()
 Fill the sWeights branches.
 
void addFriendTree ()
 Add the sWeightTree as a friend tree of the input tree.
 

Private Member Functions

 LauSPlot (const LauSPlot &rhs)
 Copy constructor (not implemented)
 
LauSPlotoperator= (const LauSPlot &rhs)
 Copy assignment operator (not implemented)
 

Private Attributes

TString fileName_
 The name of the data file.
 
TString inputTreeName_
 The name of the input tree (containing the per-event llhds)
 
TString cnTreeName_
 The name of the cn tree (containing the cN coefficients)
 
TString sweightTreeName_
 The name of the sweight tree (containing the sWeights)
 
TFile * file_
 Pointer to the data file object.
 
TTree * inputTree_
 Pointer to the input tree.
 
TTree * cnTree_
 Pointer to the output tree containing the cN coefficients.
 
TTree * sweightTree_
 Pointer to the output tree containing the sWeights.
 
TEventList * eventList_
 Pointer to an event list, that is used to loop through the experiments.
 
LeafMap leaves_
 Collection to hold pointers to the leaves of the input tree.
 
NameSet variableNames_
 The names of the discriminating variables.
 
NumbMap freeSpecies_
 The names and estimated yields of the free species.
 
NumbMap fixdSpecies_
 The names and estimated yields of the fixed species.
 
NumbMap origFreeSpecies_
 The names and estimated yields of the free species - need to keep the original values.
 
NumbMap origFixdSpecies_
 The names and estimated yields of the fixed species - need to keep the original values.
 
TwoDMap twodimPDFs_
 The names of the species that have 2D PDFs and the names of the variables involved.
 
const Bool_t signalSplit_
 Is the signal split into TM and SCF?
 
const Bool_t scfDPSmear_
 If so then is the SCF smeared in the DP?
 
Bool_t readInput_
 Flag whether the input tree has been successfully read.
 
Bool_t definedCNBranches_
 Flag whether the cN branches have already been created.
 
Bool_t definedSWeightBranches_
 Flag whether the sWeights branches have already been created.
 
Int_t firstExpt_
 First experiment.
 
Int_t nExpt_
 Number of experiments.
 
Int_t iExpt_
 The current experiment.
 
Int_t nEvents_
 Number of events in current experiment.
 
Int_t nDiscVars_
 Number of discriminating variables.
 
Int_t nFreeSpecies_
 Number of species free to float in the fit.
 
Int_t nFixdSpecies_
 Number of species fixed in the fit.
 
Int_t nSpecies_
 Total number of species (free + fixed)
 
std::vector< NumbMappdfTot_
 The per-event values of the total PDF for each species.
 
std::vector< std::map< TString, NumbMap > > discPdf_
 The per-event values of the PDFs for each species for each disc variable.
 
std::vector< Double_t > scfFrac_
 The per-event values of the SCF fraction.
 
TMatrixD covMat_
 The calculated covariance matrix.
 
std::vector< std::map< TString, NumbMap > > sWeights_
 The per-event values of the computed sWeights (for each species and for each combination of excluded vars)
 
std::map< TString, NumbMapsWeightsCurrent_
 The current-event values of the computed sWeights.
 
std::map< TString, NumbMapcN_
 The extended sPlot coefficients (for each species and for each combination of excluded vars)
 

Detailed Description

Class for defining the SPlot technique.

Class for defining the SPlot technique based on TSplot from ROOT by the following authors: Muriel Pivk, Anna Kreshuk (10/2005). (Original copyright notice below)

Code extended to deal with the following two extra scenarios:

  • Extended sPlots (see appendix B of sPlot paper)
  • 2D PDFs, i.e. one PDF for 2 variables

When performing a multidimensional fit, the sWeights are calculated excluding each dimension in turn and excluding none of the variables. This allows sPlots of the fit variables to be made by using the weight calculated when that variable is excluded, while variables not in the fit can be plotted from the complete information.

Definition at line 68 of file LauSPlot.hh.

Constructor & Destructor Documentation

◆ LauSPlot()

LauSPlot::LauSPlot ( const TString &  fileName,
const TString &  treeName,
Int_t  firstExpt,
Int_t  nExpt,
const NameSet variableNames,
const LauSPlot::NumbMap freeSpecies,
const LauSPlot::NumbMap fixdSpecies,
const TwoDMap twodimPDFs,
Bool_t  sigSplit = kFALSE,
Bool_t  scfDPSmeared = kFALSE 
)

Constructor.

Parameters
[in]fileNamethe name of the data file (containing the input tree)
[in]treeNamethe name of the input tree (containing the per-event llhds)
[in]firstExptthe first experiment
[in]nExptthe number of experiments
[in]variableNamesthe names of the discriminating variables
[in]freeSpeciesthe species that are free to float in the fit
[in]fixdSpeciesthe species that are fixed in the fit
[in]twodimPDFsthe species that have 2D PDFs and the name of the variables involved in each such PDF
[in]sigSplitboolean flag to check whether the signal is split into Truth Matched and Self Cross Feed
[in]scfDPSmearedboolean flag to check whether the SCF is smeared in the DP

Definition at line 59 of file LauSPlot.cc.

Member Function Documentation

◆ calcCNCoeffs()

void LauSPlot::calcCNCoeffs ( const TString &  exclName,
const Double_t *  covmat = 0 
)
protected

Computes the cN for the extended sPlots from the covariance matrix.

Parameters
[in]exclNamethe name of excluded variable (or "none")
[in]covmat2D array containing the covariace matrix elements

Definition at line 1243 of file LauSPlot.cc.

◆ calcCovMatrix()

Bool_t LauSPlot::calcCovMatrix ( )
protected
Returns
true if calculation succeeded or false in case the covariance matrix can not be inverted

Definition at line 967 of file LauSPlot.cc.

◆ calcSWeights()

void LauSPlot::calcSWeights ( const TString &  exclName,
Double_t *  covmat = 0 
)
protected

Computes the sWeights from the PDFs and covariance matrix.

Parameters
[in]exclNamethe name of excluded variable (or "none")
[in]covmat2D array containing the covariace matrix elements

Definition at line 1271 of file LauSPlot.cc.

◆ calcTotPDFValues()

void LauSPlot::calcTotPDFValues ( const TString &  exclName)
protected

Calculate the total likelihood for each species by multiply together all the PDFs for that species.

Parameters
[in]exclNamethe name of excluded variable (or "none")

Definition at line 1030 of file LauSPlot.cc.

◆ copyEventWeights()

void LauSPlot::copyEventWeights ( Int_t  iEvent)
protected

Copy the sWeight of a given event into LauSPlot::sWeightsCurrent_, from which they can be stored in the output tree.

Parameters
[in]iEventthe requested event

Definition at line 1344 of file LauSPlot.cc.

◆ definedCNBranches() [1/2]

Bool_t LauSPlot::definedCNBranches ( ) const
inlineprotected

Check whether the cN branches have been already created.

Returns
true/false whether cN branches have been already created

Definition at line 157 of file LauSPlot.hh.

◆ definedCNBranches() [2/2]

void LauSPlot::definedCNBranches ( Bool_t  defined)
inlineprotected

Set that the cN branches have been already defined.

Parameters
[in]definedset that the cN branches have been already defined

Definition at line 163 of file LauSPlot.hh.

◆ definedSWeightBranches() [1/2]

Bool_t LauSPlot::definedSWeightBranches ( ) const
inlineprotected

Check whether the sWeights branches have been already created.

Returns
true/false whether sWeights branches have been already created

Definition at line 169 of file LauSPlot.hh.

◆ definedSWeightBranches() [2/2]

void LauSPlot::definedSWeightBranches ( Bool_t  defined)
inlineprotected

Set that the sWeights branches have been already defined.

Parameters
[in]definedset that the sWeights branches have been already defined

Definition at line 175 of file LauSPlot.hh.

◆ initialiseFitter()

void LauSPlot::initialiseFitter ( const TString &  opt)
protected

Initialise Minuit, set the verbosity.

Parameters
[in]optoption to set the print level (opt = "Q", "V" or "W" == "VV")

Definition at line 818 of file LauSPlot.cc.

◆ printCovMatrixElements()

void LauSPlot::printCovMatrixElements ( const Double_t *  covmat = 0) const
protected

Print the supplied covariance matrix or, if pointer is null, the one previously calculated.

Parameters
[in]covmat2D array containing the covariace matrix elements

Definition at line 898 of file LauSPlot.cc.

◆ printSumOfWeights()

void LauSPlot::printSumOfWeights ( const TString &  exclName) const
protected

Print the sum of sWeights for all species.

Parameters
[in]exclNamethe name of variable excluded (or "none")

Definition at line 951 of file LauSPlot.cc.

◆ readInput() [1/2]

Bool_t LauSPlot::readInput ( ) const
inlineprotected

Check whether the input tree has been successfully read.

Returns
true/false whether the task have been successfully performed

Definition at line 133 of file LauSPlot.hh.

◆ readInput() [2/2]

void LauSPlot::readInput ( Bool_t  ok)
inlineprotected

Set that the input tree has been successfully read.

Parameters
[in]okset that the input tree has been succeessfully read

Definition at line 139 of file LauSPlot.hh.

◆ retrieveFittedParameters()

void LauSPlot::retrieveFittedParameters ( const TString &  opt)
protected

Update the yields with the newly fitted values and print them (unless print option is "Q").

Parameters
[in]optoption to set the print level (opt = "Q", "V" or "W")

Definition at line 925 of file LauSPlot.cc.

◆ runCalculations()

void LauSPlot::runCalculations ( const TString &  option = "q")

Method to calculate the sWeights and cN coeffs.

Parameters
[in]optioncontrol print level (default set to no print out)
"Q" - no print out (default)
"V" - prints the estimated # of events in species
"VV" - as "V" + the MINUIT printing + sums of weights for control

Definition at line 703 of file LauSPlot.cc.

◆ scfDPSmear()

Bool_t LauSPlot::scfDPSmear ( ) const
inlineprotected

Check whether the Self Cross Feed is smeared in the DP.

Returns
true/false whether the Self Cross Feed is smeared in the DP

Definition at line 151 of file LauSPlot.hh.

◆ setExperiment()

void LauSPlot::setExperiment ( Int_t  iExpt)
protected

Set the event list to contain only events from the given experiment.

Parameters
[in]iExptthe required experiment number

Definition at line 514 of file LauSPlot.cc.

◆ signalSplit()

Bool_t LauSPlot::signalSplit ( ) const
inlineprotected

Check whether the signal is split into Truth Matched and Self Cross Feed.

Returns
true/false whether the signal is split into TM and SCF

Definition at line 145 of file LauSPlot.hh.

◆ totalPdf()

const std::vector<LauSPlot::NumbMap>& LauSPlot::totalPdf ( ) const
inline

Access the per-event total PDF values for each species.

Returns
the per-event total PDF values

Definition at line 126 of file LauSPlot.hh.


The documentation for this class was generated from the following files:
  • /home/epp/phsdba/Development/Laura++/master-dev/laura/inc/LauSPlot.hh
  • /home/epp/phsdba/Development/Laura++/master-dev/laura/src/LauSPlot.cc