KLFitter  v1.3.2
Documentation of the KLFitter library -- The Kinematic Likelihood Fitter
Public Types | Protected Member Functions | Protected Attributes | List of all members
KLFitter::LikelihoodBase Class Referenceabstract

A base class for likelihoods. More...

#include <LikelihoodBase.h>

Inheritance diagram for KLFitter::LikelihoodBase:
KLFitter::BoostedLikelihoodTopLeptonJets KLFitter::LikelihoodOneHadronicTop KLFitter::LikelihoodSgTopWtLJ KLFitter::LikelihoodTopAllHadronic KLFitter::LikelihoodTopDilepton KLFitter::LikelihoodTopLeptonJets KLFitter::LikelihoodTTHLeptonJets KLFitter::LikelihoodTTZTrilepton KLFitter::LikelihoodTwoTracks

Public Types

enum  BtaggingMethod {
  kNotag, kVeto, kVetoNoFit, kVetoNoFitLight,
  kVetoNoFitBoth, kVetoHybridNoFit, kWorkingPoint, kVetoLight,
  kVetoBoth
}
 Enumerate for b-tagging possibilities.
 

Public Member Functions

Constructors and destructors
 LikelihoodBase (Particles **particles=0)
 The default constructor. More...
 
virtual ~LikelihoodBase ()
 The default destructor.
 
Member functions (Get)
KLFitter::PhysicsConstantsPhysicsConstants ()
 Return the table of physics constants. More...
 
KLFitter::DetectorBaseDetector ()
 Return the detector. More...
 
KLFitter::Particles ** PParticlesPermuted ()
 Return the set of measured particles. More...
 
KLFitter::ParticlesParticlesModel ()
 Return the set of model particles. More...
 
int NParticlesModel ()
 Return the number of model particles. More...
 
int NParameters ()
 Return the number of parameters. More...
 
double ParMin (int index)
 Return the lower boundary of a parameter. More...
 
double ParMax (int index)
 Return the upper boundary of a parameter. More...
 
BtaggingMethod GetBTagging ()
 Get flag to use b-tagging or not. More...
 
bool FlagIntegrate ()
 
Member functions (Set)
int SetPhysicsConstants (KLFitter::PhysicsConstants *physicsconstants)
 Set the physics constants. More...
 
virtual int SetDetector (KLFitter::DetectorBase **detector)
 Set the detector. More...
 
int SetParticlesPermuted (KLFitter::Particles **particles)
 Set the measured particles. More...
 
virtual int SetET_miss_XY_SumET (double etx, double ety, double sumet)=0
 Set the values for the missing ET x and y components and the SumET. More...
 
int SetPermutations (std::unique_ptr< KLFitter::Permutations > *permutations)
 Set the permutation object. More...
 
int SetParameterRange (int index, double parmin, double parmax)
 Set the range of a model parameter. More...
 
int SetInitialParameters (std::vector< double > const &parameters)
 Set the initial values for the minimization, etc. More...
 
int SetInitialParametersNChains (std::vector< double > const &parameters, unsigned int nchains)
 Set the initial values for the minimization, etc. More...
 
int SetBTagging (BtaggingMethod btagmethod)
 Set which b-tagging you wish to use. More...
 
int SetFlagBTagging (bool flag)
 THIS IS AN OUTDATED METHOD - JUST HERE FOR BACKWARD COMPATIBILITY. More...
 
int SetFlagIsNan (bool flag)
 Set flag FlagIsNan. More...
 
bool GetFlagIsNan (void)
 Get flag FlagIsNan. More...
 
int SetFlagIntegrate (bool flag)
 Set flag to integrate or not. More...
 
void SetFlagUseJetMass (bool flag)
 Set flag to use measured jet masses (true) instead of parton masses (false);.
 
Member functions (misc)
virtual int CalculateLorentzVectors (std::vector< double > const &parameters)=0
 Update 4-vectors of model particles. More...
 
virtual int Initialize ()
 Initialize the likelihood for the event. More...
 
virtual int AdjustParameterRanges ()=0
 Adjust parameter ranges.
 
virtual int DefineModelParticles ()=0
 Define the model particles. More...
 
void PropagateBTaggingInformation ()
 Propagate the b-tagging information from the permuted (measured) particles to the model particles.
 
virtual void RequestResolutionFunctions ()=0
 Request necessary resolution functions from the detector. More...
 
Member functions (BAT)
virtual void DefineParameters ()=0
 Define the parameters of the fit.
 
virtual double LogAPrioriProbability (const std::vector< double > &) override
 The prior probability definition, overloaded from BCModel. More...
 
virtual double LogLikelihood (const std::vector< double > &parameters) override=0
 The posterior probability definition, overloaded from BCModel. More...
 
virtual std::vector< double > LogLikelihoodComponents (std::vector< double > parameters)=0
 The posterior probability definition, overloaded from BCModel. More...
 
virtual double LogEventProbability ()
 Return the log of the event probability fof the current combination. More...
 
virtual double LogEventProbabilityBTag ()
 Return the contribution from b tagging to the log of the event probability for the current combination. More...
 
virtual int RemoveInvariantParticlePermutations ()=0
 Remove invariant particle permutations. More...
 
virtual int RemoveForbiddenParticlePermutations ()
 Remove forbidden particle permutations. More...
 
virtual int BuildModelParticles ()=0
 Build the model particles from the best fit parameters. More...
 
virtual std::vector< double > GetInitialParameters ()=0
 Get initial values for the parameters. More...
 
virtual bool NoTFProblem (std::vector< double > parameters)
 Check if there are TF problems. More...
 
std::vector< double > GetBestFitParameters ()
 Returns the best fit parameters, overloaded from BCModel. More...
 
std::vector< double > GetBestFitParameterErrors ()
 Returns the errors of the best fit parameters, overloaded from BCModel. More...
 
double GetBestFitParameter (unsigned int index)
 Returns the best fit parameters, overloaded from BCModel. More...
 
double GetBestFitParameterError (unsigned int index)
 Returns the errors of the best fit parameter i, overloaded from BCModel. More...
 
virtual int LHInvariantPermutationPartner (int, int, int *, int *)
 Check if the permutation is LH invariant. More...
 
int GetParametersFromCache (int iperm)
 Write parameters from fCachedParametersVector.at(iperm) to fCachedParameters. More...
 
int SetParametersToCache (int iperm, int nperms)
 Write parameters to fCachedParametersVector.at(iperm) from GetBestFitParameter() More...
 
double GetIntegral ()
 
int ResetCache ()
 Resets the values of all parameter cache vectors. More...
 

Protected Member Functions

virtual int SavePermutedParticles ()=0
 Save permuted particles.
 
virtual int SaveResolutionFunctions ()=0
 Save resolution functions.
 
double SetPartonMass (double jetmass, double quarkmass, double *px, double *py, double *pz, double e)
 Set model parton mass according to fFlagUseJetMass. More...
 

Protected Attributes

KLFitter::Particles ** fParticlesPermuted
 A pointer to the measured particles.
 
std::unique_ptr< KLFitter::Permutations > * fPermutations
 A pointer to the permutation object.
 
std::unique_ptr< KLFitter::ParticlesfParticlesModel
 A pointer to the model particles.
 
KLFitter::PhysicsConstants fPhysicsConstants
 A pointer to the table of physics constants.
 
KLFitter::DetectorBase ** fDetector
 A pointer to the detector.
 
std::vector< double > fEventProbability
 The event probabilities for the different permutations.
 
bool fFlagIntegrate
 A flag to integrate over the likelihood or not.
 
bool fFlagIsNan
 A flag for knowing that Minuit gave parameters with NaN values to LogLikelihood.
 
bool fFlagUseJetMass
 A flag for using the measured jet masses (true) instead of parton masses (false);.
 
bool fTFgood
 Global variable for TF problems.
 
BtaggingMethod fBTagMethod
 Name of btagging enum.
 
std::vector< double > fCachedParameters
 The cached parameters used for the current permutation.
 
std::vector< double > fCachedParameterErrors
 The cached parameter errors used for the current permutation.
 
std::vector< std::vector< double > > fCachedParametersVector
 A vector of cached parameters, one for each permutation. More...
 
std::vector< std::vector< double > > fCachedParameterErrorsVector
 A vector of cached parameter errors, one for each permutation. More...
 
double fCachedNormalization
 The cached normalization, needed for the overloaded BCIntegrate::GetIntegral.
 
std::vector< double > fCachedNormalizationVector
 A vector of cached parameters, one for each permutation. More...
 

Detailed Description

A base class for likelihoods.

Constructor & Destructor Documentation

KLFitter::LikelihoodBase::LikelihoodBase ( Particles **  particles = 0)
explicit

The default constructor.

Parameters
particlesA pointer to the measured particles.

Member Function Documentation

virtual int KLFitter::LikelihoodBase::BuildModelParticles ( )
pure virtual
virtual int KLFitter::LikelihoodBase::CalculateLorentzVectors ( std::vector< double > const &  parameters)
pure virtual
virtual int KLFitter::LikelihoodBase::DefineModelParticles ( )
pure virtual
KLFitter::DetectorBase* KLFitter::LikelihoodBase::Detector ( )
inline

Return the detector.

Returns
A pointer to the detector.
double KLFitter::LikelihoodBase::GetBestFitParameter ( unsigned int  index)

Returns the best fit parameters, overloaded from BCModel.

Returns
The best fit parameters
double KLFitter::LikelihoodBase::GetBestFitParameterError ( unsigned int  index)

Returns the errors of the best fit parameter i, overloaded from BCModel.

Returns
The errors of the best fit parameters
std::vector< double > KLFitter::LikelihoodBase::GetBestFitParameterErrors ( )

Returns the errors of the best fit parameters, overloaded from BCModel.

Returns
The errors of the best fit parameters
std::vector< double > KLFitter::LikelihoodBase::GetBestFitParameters ( )

Returns the best fit parameters, overloaded from BCModel.

Returns
The best fit parameters
BtaggingMethod KLFitter::LikelihoodBase::GetBTagging ( )
inline

Get flag to use b-tagging or not.

Returns
An error flag.
bool KLFitter::LikelihoodBase::GetFlagIsNan ( void  )
inline

Get flag FlagIsNan.

This Flag should be true if Minuit gave parameters with NaN values to LogLikelihood.

Returns
The flag.
virtual std::vector<double> KLFitter::LikelihoodBase::GetInitialParameters ( )
pure virtual
double KLFitter::LikelihoodBase::GetIntegral ( )
Returns
The normalization factor of the probability, overloaded from BCModel
int KLFitter::LikelihoodBase::GetParametersFromCache ( int  iperm)

Write parameters from fCachedParametersVector.at(iperm) to fCachedParameters.

Parameters
ipermCurrent permutation
Returns
An error code.
int KLFitter::LikelihoodBase::Initialize ( )
virtual

Initialize the likelihood for the event.

Returns
An error code

Reimplemented in KLFitter::LikelihoodTopDilepton, KLFitter::LikelihoodSgTopWtLJ, and KLFitter::LikelihoodTwoTracks.

virtual int KLFitter::LikelihoodBase::LHInvariantPermutationPartner ( int  ,
int  ,
int *  ,
int *   
)
inlinevirtual

Check if the permutation is LH invariant.

Parameters
ipermCurrent permutation
npermsTotal number of permutations
switchpar1???
switchpar2???
Returns
Permutation of the invariant partner, -1 if there is no one.

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

virtual double KLFitter::LikelihoodBase::LogAPrioriProbability ( const std::vector< double > &  )
inlineoverridevirtual

The prior probability definition, overloaded from BCModel.

Parameters
parametersA vector of parameters (double values).
Returns
The logarithm of the prior probability.
double KLFitter::LikelihoodBase::LogEventProbability ( )
virtual

Return the log of the event probability fof the current combination.

Returns
The event probability

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

double KLFitter::LikelihoodBase::LogEventProbabilityBTag ( )
virtual

Return the contribution from b tagging to the log of the event probability for the current combination.

Returns
The event probability contribution

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

virtual double KLFitter::LikelihoodBase::LogLikelihood ( const std::vector< double > &  parameters)
overridepure virtual
virtual std::vector<double> KLFitter::LikelihoodBase::LogLikelihoodComponents ( std::vector< double >  parameters)
pure virtual

The posterior probability definition, overloaded from BCModel.

Split up into several subcomponents

Parameters
parametersA vector of parameters (double values).
Returns
A vector with the components of the logarithm of the prior probability.

Implemented in KLFitter::LikelihoodTTZTrilepton, KLFitter::LikelihoodTopDilepton, KLFitter::LikelihoodTTHLeptonJets, KLFitter::LikelihoodSgTopWtLJ, KLFitter::LikelihoodTopLeptonJets, KLFitter::BoostedLikelihoodTopLeptonJets, KLFitter::LikelihoodTopAllHadronic, KLFitter::LikelihoodTopLeptonJets_JetAngles, KLFitter::LikelihoodTwoTracks, and KLFitter::LikelihoodOneHadronicTop.

bool KLFitter::LikelihoodBase::NoTFProblem ( std::vector< double >  parameters)
virtual

Check if there are TF problems.

Returns
Return false if TF problem.
int KLFitter::LikelihoodBase::NParameters ( )
inline

Return the number of parameters.

Returns
The number of parameters of the model.
int KLFitter::LikelihoodBase::NParticlesModel ( )
inline

Return the number of model particles.

Returns
The number of model particles.
double KLFitter::LikelihoodBase::ParMax ( int  index)

Return the upper boundary of a parameter.

Parameters
indexThe index of the parameter.
Returns
The upper boundary.
double KLFitter::LikelihoodBase::ParMin ( int  index)

Return the lower boundary of a parameter.

Parameters
indexThe index of the parameter.
Returns
The lower boundary.
KLFitter::Particles* KLFitter::LikelihoodBase::ParticlesModel ( )
inline

Return the set of model particles.

Returns
A pointer to the particles.
KLFitter::PhysicsConstants* KLFitter::LikelihoodBase::PhysicsConstants ( )
inline

Return the table of physics constants.

Returns
A pointer to the physics constants.
KLFitter::Particles** KLFitter::LikelihoodBase::PParticlesPermuted ( )
inline

Return the set of measured particles.

Returns
A pointer to the particles.
int KLFitter::LikelihoodBase::RemoveForbiddenParticlePermutations ( )
virtual

Remove forbidden particle permutations.

Returns
An error code.

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

virtual int KLFitter::LikelihoodBase::RemoveInvariantParticlePermutations ( )
pure virtual
virtual void KLFitter::LikelihoodBase::RequestResolutionFunctions ( )
pure virtual
int KLFitter::LikelihoodBase::ResetCache ( )

Resets the values of all parameter cache vectors.

Returns
An error code.
int KLFitter::LikelihoodBase::SetBTagging ( BtaggingMethod  btagmethod)
inline

Set which b-tagging you wish to use.

Parameters
btagmethodThe enum of btagging method.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetDetector ( KLFitter::DetectorBase **  detector)
virtual

Set the detector.

Parameters
detectorA pointer to a pointer of the detector.
Returns
An error flag
virtual int KLFitter::LikelihoodBase::SetET_miss_XY_SumET ( double  etx,
double  ety,
double  sumet 
)
pure virtual

Set the values for the missing ET x and y components and the SumET.

Parameters
etxmissing ET x component.
etymissing ET y component.
sumettotal scalar ET.
Returns
An error flag.

Implemented in KLFitter::LikelihoodTopLeptonJets, KLFitter::LikelihoodOneHadronicTop, KLFitter::LikelihoodTwoTracks, KLFitter::LikelihoodSgTopWtLJ, KLFitter::LikelihoodTTZTrilepton, KLFitter::LikelihoodTopDilepton, KLFitter::LikelihoodTTHLeptonJets, KLFitter::BoostedLikelihoodTopLeptonJets, and KLFitter::LikelihoodTopAllHadronic.

int KLFitter::LikelihoodBase::SetFlagBTagging ( bool  flag)
inline

THIS IS AN OUTDATED METHOD - JUST HERE FOR BACKWARD COMPATIBILITY.

Set flag to use b-tagging or not.

Parameters
flagThe flag.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetFlagIntegrate ( bool  flag)
inline

Set flag to integrate or not.

Parameters
flagThe flag.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetFlagIsNan ( bool  flag)
inline

Set flag FlagIsNan.

This Flag should be true if Minuit gave parameters with NaN values to LogLikelihood.

Parameters
flagThe flag.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetInitialParameters ( std::vector< double > const &  parameters)

Set the initial values for the minimization, etc.

Parameters
parametersThe initial values.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetInitialParametersNChains ( std::vector< double > const &  parameters,
unsigned int  nchains 
)

Set the initial values for the minimization, etc.

for each chain

Parameters
parametersThe initial values.
nchainsThe number of chains.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetParameterRange ( int  index,
double  parmin,
double  parmax 
)

Set the range of a model parameter.

Parameters
indexThe index of the parameter.
parminThe minimum value.
parmaxThe maximum value.
int KLFitter::LikelihoodBase::SetParametersToCache ( int  iperm,
int  nperms 
)

Write parameters to fCachedParametersVector.at(iperm) from GetBestFitParameter()

Parameters
ipermCurrent permutation
npermsNumber of permutations
Returns
An error code.
int KLFitter::LikelihoodBase::SetParticlesPermuted ( KLFitter::Particles **  particles)

Set the measured particles.

Parameters
particlesThe measured particles.
Returns
An error flag.
double KLFitter::LikelihoodBase::SetPartonMass ( double  jetmass,
double  quarkmass,
double *  px,
double *  py,
double *  pz,
double  e 
)
protected

Set model parton mass according to fFlagUseJetMass.

Parameters
jetmassThe jet mass.
quarkmassThe quark mass.
pxThe parton px (will be modified, if necessary).
pyThe parton py (will be modified, if necessary).
pzThe parton pz (will be modified, if necessary).
eThe parton energy (not modified).
Returns
The parton mass.
int KLFitter::LikelihoodBase::SetPermutations ( std::unique_ptr< KLFitter::Permutations > *  permutations)

Set the permutation object.

Parameters
permutationsThe permutation object.
Returns
An error flag.
int KLFitter::LikelihoodBase::SetPhysicsConstants ( KLFitter::PhysicsConstants physicsconstants)

Set the physics constants.

Parameters
physicsconstantsA pointer to physics constants.
Returns
An error flag

Member Data Documentation

std::vector<double> KLFitter::LikelihoodBase::fCachedNormalizationVector
protected

A vector of cached parameters, one for each permutation.

Has to be set via fitter.

std::vector<std::vector<double> > KLFitter::LikelihoodBase::fCachedParameterErrorsVector
protected

A vector of cached parameter errors, one for each permutation.

Has to be set via fitter.

std::vector<std::vector<double> > KLFitter::LikelihoodBase::fCachedParametersVector
protected

A vector of cached parameters, one for each permutation.

Has to be set via fitter.


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