laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
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. More...
 
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. More...
 
typedef std::map< TString,
TLeaf * > 
LeafMap
 Type to associate a variable name with the leaf of the input tree. More...
 
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. More...
 

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. More...
 
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) More...
 
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. More...
 
void readInputInfo ()
 Read the leaf structure from the tree and check the status of the read (calls LauSPlot::readInputLeaves and LauSPlot::checkLeaves) More...
 
Bool_t readInputLeaves ()
 Read the leaf structure from the tree and setup the leaf map. More...
 
Bool_t checkLeaves () const
 Check whether the leaf structure makes sense given the PDFs we are expecting. More...
 
void createCNTree ()
 Create (if not already done) the tree for storing the cN coeffs. More...
 
void defineCNBranches ()
 Create the branches for each cN coefficient. More...
 
void createSWeightTree ()
 Create (if not already done) the tree for storing the sWeights. More...
 
void defineSWeightBranches ()
 Create the branches to store the sWeights. More...
 
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. More...
 
void checkFitter () const
 Make sure that we're using Minuit. More...
 
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. More...
 
void runFit ()
 Perform the minimisation wrt the yields alone. More...
 
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. More...
 
void fillSWeightBranches ()
 Fill the sWeights branches. More...
 
void addFriendTree ()
 Add the sWeightTree as a friend tree of the input tree. More...
 

Private Member Functions

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

Private Attributes

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

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 69 of file LauSPlot.hh.

Member Typedef Documentation

typedef std::map<TString,TLeaf*> LauSPlot::LeafMap

Type to associate a variable name with the leaf of the input tree.

Definition at line 79 of file LauSPlot.hh.

typedef std::set<TString> LauSPlot::NameSet

Type to store names, e.g. of the discriminating/control variables.

Definition at line 73 of file LauSPlot.hh.

typedef std::map<TString,Double_t> LauSPlot::NumbMap

Type to associate a category name with a double precision number, e.g. a yield or PDF value for a given species.

Definition at line 76 of file LauSPlot.hh.

typedef std::multimap< TString, std::pair<TString,TString> > LauSPlot::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.

Definition at line 82 of file LauSPlot.hh.

Constructor & Destructor Documentation

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 63 of file LauSPlot.cc.

LauSPlot::~LauSPlot ( )
virtual

Destructor.

Definition at line 109 of file LauSPlot.cc.

LauSPlot::LauSPlot ( const LauSPlot rhs)
private

Copy constructor (not implemented)

Member Function Documentation

void LauSPlot::addFriendTree ( )
protected

Add the sWeightTree as a friend tree of the input tree.

Definition at line 1260 of file LauSPlot.cc.

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 1136 of file LauSPlot.cc.

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

Definition at line 888 of file LauSPlot.cc.

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 1162 of file LauSPlot.cc.

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 942 of file LauSPlot.cc.

void LauSPlot::checkFitter ( ) const
protected

Make sure that we're using Minuit.

Definition at line 736 of file LauSPlot.cc.

Bool_t LauSPlot::checkLeaves ( ) const
protected

Check whether the leaf structure makes sense given the PDFs we are expecting.

Definition at line 203 of file LauSPlot.cc.

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 1226 of file LauSPlot.cc.

void LauSPlot::createCNTree ( )
protected

Create (if not already done) the tree for storing the cN coeffs.

Definition at line 372 of file LauSPlot.cc.

void LauSPlot::createSWeightTree ( )
protected

Create (if not already done) the tree for storing the sWeights.

Definition at line 386 of file LauSPlot.cc.

void LauSPlot::defineCNBranches ( )
protected

Create the branches for each cN coefficient.

Definition at line 400 of file LauSPlot.cc.

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.

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.

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.

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.

void LauSPlot::defineSWeightBranches ( )
protected

Create the branches to store the sWeights.

Definition at line 438 of file LauSPlot.cc.

void LauSPlot::fillCNBranches ( )
protected

Fill the cN branches.

Definition at line 1196 of file LauSPlot.cc.

void LauSPlot::fillSWeightBranches ( )
protected

Fill the sWeights branches.

Definition at line 1207 of file LauSPlot.cc.

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 749 of file LauSPlot.cc.

void LauSPlot::openInputFileAndTree ( )
protected

Method to open the file in "update" mode and grab the input tree for reading.

Definition at line 121 of file LauSPlot.cc.

LauSPlot& LauSPlot::operator= ( const LauSPlot rhs)
private

Copy assignment operator (not implemented)

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 828 of file LauSPlot.cc.

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 873 of file LauSPlot.cc.

void LauSPlot::readExpt ( )
protected

Reads the values of each PDF likelihood for every event in the experiment.

Definition at line 508 of file LauSPlot.cc.

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.

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.

void LauSPlot::readInputInfo ( )
protected

Read the leaf structure from the tree and check the status of the read (calls LauSPlot::readInputLeaves and LauSPlot::checkLeaves)

Definition at line 144 of file LauSPlot.cc.

Bool_t LauSPlot::readInputLeaves ( )
protected

Read the leaf structure from the tree and setup the leaf map.

Definition at line 160 of file LauSPlot.cc.

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 851 of file LauSPlot.cc.

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 640 of file LauSPlot.cc.

void LauSPlot::runFit ( )
protected

Perform the minimisation wrt the yields alone.

Definition at line 806 of file LauSPlot.cc.

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.

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 473 of file LauSPlot.cc.

void LauSPlot::setFitParameters ( ) const
protected

Add the species yields as fit parameters and fix them as appropriate.

Definition at line 775 of file LauSPlot.cc.

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.

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.

void LauSPlot::writeOutResults ( )

Save the sWeight results as a friend tree to the input tree (in the same file)

Definition at line 1238 of file LauSPlot.cc.

Member Data Documentation

std::map<TString,NumbMap> LauSPlot::cN_
private

The extended sPlot coefficients (for each species and for each combination of excluded vars)

Definition at line 369 of file LauSPlot.hh.

TTree* LauSPlot::cnTree_
private

Pointer to the output tree containing the cN coefficients.

Definition at line 302 of file LauSPlot.hh.

TString LauSPlot::cnTreeName_
private

The name of the cn tree (containing the cN coefficients)

Definition at line 294 of file LauSPlot.hh.

TMatrixD LauSPlot::covMat_
private

The calculated covariance matrix.

Definition at line 362 of file LauSPlot.hh.

Bool_t LauSPlot::definedCNBranches_
private

Flag whether the cN branches have already been created.

Definition at line 333 of file LauSPlot.hh.

Bool_t LauSPlot::definedSWeightBranches_
private

Flag whether the sWeights branches have already been created.

Definition at line 335 of file LauSPlot.hh.

std::vector<std::map<TString,NumbMap> > LauSPlot::discPdf_
private

The per-event values of the PDFs for each species for each disc variable.

Definition at line 357 of file LauSPlot.hh.

TEventList* LauSPlot::eventList_
private

Pointer to an event list, that is used to loop through the experiments.

Definition at line 307 of file LauSPlot.hh.

TFile* LauSPlot::file_
private

Pointer to the data file object.

Definition at line 298 of file LauSPlot.hh.

TString LauSPlot::fileName_
private

The name of the data file.

Definition at line 290 of file LauSPlot.hh.

Int_t LauSPlot::firstExpt_
private

First experiment.

Definition at line 338 of file LauSPlot.hh.

NumbMap LauSPlot::fixdSpecies_
private

The names and estimated yields of the fixed species.

Definition at line 317 of file LauSPlot.hh.

NumbMap LauSPlot::freeSpecies_
private

The names and estimated yields of the free species.

Definition at line 315 of file LauSPlot.hh.

Int_t LauSPlot::iExpt_
private

The current experiment.

Definition at line 342 of file LauSPlot.hh.

TTree* LauSPlot::inputTree_
private

Pointer to the input tree.

Definition at line 300 of file LauSPlot.hh.

TString LauSPlot::inputTreeName_
private

The name of the input tree (containing the per-event llhds)

Definition at line 292 of file LauSPlot.hh.

LeafMap LauSPlot::leaves_
private

Collection to hold pointers to the leaves of the input tree.

Definition at line 310 of file LauSPlot.hh.

Int_t LauSPlot::nDiscVars_
private

Number of discriminating variables.

Definition at line 346 of file LauSPlot.hh.

Int_t LauSPlot::nEvents_
private

Number of events in current experiment.

Definition at line 344 of file LauSPlot.hh.

Int_t LauSPlot::nExpt_
private

Number of experiments.

Definition at line 340 of file LauSPlot.hh.

Int_t LauSPlot::nFixdSpecies_
private

Number of species fixed in the fit.

Definition at line 350 of file LauSPlot.hh.

Int_t LauSPlot::nFreeSpecies_
private

Number of species free to float in the fit.

Definition at line 348 of file LauSPlot.hh.

Int_t LauSPlot::nSpecies_
private

Total number of species (free + fixed)

Definition at line 352 of file LauSPlot.hh.

NumbMap LauSPlot::origFixdSpecies_
private

The names and estimated yields of the fixed species - need to keep the original values.

Definition at line 321 of file LauSPlot.hh.

NumbMap LauSPlot::origFreeSpecies_
private

The names and estimated yields of the free species - need to keep the original values.

Definition at line 319 of file LauSPlot.hh.

std::vector<NumbMap> LauSPlot::pdfTot_
private

The per-event values of the total PDF for each species.

Definition at line 355 of file LauSPlot.hh.

Bool_t LauSPlot::readInput_
private

Flag whether the input tree has been successfully read.

Definition at line 331 of file LauSPlot.hh.

const Bool_t LauSPlot::scfDPSmear_
private

If so then is the SCF smeared in the DP?

Definition at line 328 of file LauSPlot.hh.

std::vector<Double_t> LauSPlot::scfFrac_
private

The per-event values of the SCF fraction.

Definition at line 359 of file LauSPlot.hh.

const Bool_t LauSPlot::signalSplit_
private

Is the signal split into TM and SCF?

Definition at line 326 of file LauSPlot.hh.

std::vector< std::map<TString,NumbMap> > LauSPlot::sWeights_
private

The per-event values of the computed sWeights (for each species and for each combination of excluded vars)

Definition at line 365 of file LauSPlot.hh.

std::map<TString,NumbMap> LauSPlot::sWeightsCurrent_
private

The current-event values of the computed sWeights.

Definition at line 367 of file LauSPlot.hh.

TTree* LauSPlot::sweightTree_
private

Pointer to the output tree containing the sWeights.

Definition at line 304 of file LauSPlot.hh.

TString LauSPlot::sweightTreeName_
private

The name of the sweight tree (containing the sWeights)

Definition at line 296 of file LauSPlot.hh.

TwoDMap LauSPlot::twodimPDFs_
private

The names of the species that have 2D PDFs and the names of the variables involved.

Definition at line 323 of file LauSPlot.hh.

NameSet LauSPlot::variableNames_
private

The names of the discriminating variables.

Definition at line 313 of file LauSPlot.hh.


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