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

A class implementing a likelihood for the ttbar lepton+jets channel. More...

#include <LikelihoodTopLeptonJets.h>

Inheritance diagram for KLFitter::LikelihoodTopLeptonJets:
KLFitter::LikelihoodBase KLFitter::LikelihoodTopLeptonJets_Angular KLFitter::LikelihoodTopLeptonJets_JetAngles KLFitter::LikelihoodTopLeptonJetsUDSep

Public Types

enum  LeptonType { kElectron, kMuon }
 Enumerator for the lepton type. More...
 
enum  Parameters {
  parBhadE, parBlepE, parLQ1E, parLQ2E,
  parLepE, parNuPx, parNuPy, parNuPz,
  parTopM
}
 Enumerator for the fitted parameters of this likelihood. More...
 
- Public Types inherited from KLFitter::LikelihoodBase
enum  BtaggingMethod {
  kNotag, kVeto, kVetoNoFit, kVetoNoFitLight,
  kVetoNoFitBoth, kVetoHybridNoFit, kWorkingPoint, kVetoLight,
  kVetoBoth
}
 Enumerate for b-tagging possibilities.
 

Public Member Functions

Constructors and destructors
 LikelihoodTopLeptonJets ()
 The default constructor. More...
 
 ~LikelihoodTopLeptonJets ()
 The (defaulted) destructor.
 
Member functions (Set)
void SetFlagTopMassFixed (bool flag)
 Set a flag. More...
 
void SetFlagGetParSigmasFromTFs (bool flag)
 Set a flag. More...
 
void SetLeptonType (LeptonType leptontype)
 Set the type of lepton. More...
 
void SetLeptonType (int leptontype)
 Set the type of lepton. More...
 
Member functions (BAT)
void DefineParameters () override
 Define the parameters of the fit. More...
 
std::vector< double > GetInitialParameters () override
 Get initial values for the parameters. More...
 
virtual std::vector< double > GetInitialParametersWoNeutrinoPz ()
 Get initial values for the parameters with a dummy of "0.0" for the neutrino pz. More...
 
double LogLikelihood (const std::vector< double > &parameters) override
 The posterior probability definition, overloaded from BCModel. More...
 
std::vector< double > LogLikelihoodComponents (std::vector< double > parameters) override
 The posterior probability definition, overloaded from BCModel. More...
 
Member functions (misc)
int SetET_miss_XY_SumET (double etx, double ety, double sumet) override
 Set the values for the missing ET x and y components and the m_et_miss_sum. More...
 
void RequestResolutionFunctions () override
 Request the necessary resolution functions from the detector.
 
- Public Member Functions inherited from KLFitter::LikelihoodBase
 LikelihoodBase (Particles **particles=0)
 The default constructor. More...
 
virtual ~LikelihoodBase ()
 The default destructor.
 
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 ()
 
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...
 
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);.
 
virtual int Initialize ()
 Initialize the likelihood for the event. More...
 
void PropagateBTaggingInformation ()
 Propagate the b-tagging information from the permuted (measured) particles to the model particles.
 
virtual double LogAPrioriProbability (const std::vector< double > &) override
 The prior 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 RemoveForbiddenParticlePermutations ()
 Remove forbidden particle permutations. 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

int AdjustParameterRanges () override
 Adjust ranges of the parameters. More...
 
int BuildModelParticles () override
 Build the model particles from the best fit parameters. More...
 
int CalculateLorentzVectors (std::vector< double > const &parameters) override
 Update 4-vector values of the model particles. More...
 
std::vector< double > CalculateNeutrinoPzSolutions (TLorentzVector *additionalParticle=nullptr)
 Calculates the neutrino pz solutions from the measured values and the W mass. More...
 
int DefineModelParticles () override
 Define the model particles. More...
 
std::vector< double > GetNeutrinoPzSolutions ()
 Return the neutrino pz solutions from the measured values and the W mass. More...
 
int RemoveInvariantParticlePermutations () override
 Remove the invariant particle permutations. More...
 
int SavePermutedParticles () override
 Save permuted particles. More...
 
int SaveResolutionFunctions () override
 Save the resolution functions from the detector to the internal pointers. More...
 
- Protected Member Functions inherited from KLFitter::LikelihoodBase
double SetPartonMass (double jetmass, double quarkmass, double *px, double *py, double *pz, double e)
 Set model parton mass according to fFlagUseJetMass. More...
 

Protected Attributes

Member attributes
bool m_flag_top_mass_fixed
 A flag for using a fixed top mass (true) or not (false).
 
bool m_flag_get_par_sigmas_from_TFs
 Flag for using ResolutionBase::GetSigma() to retrieve the parameter ranges.
 
double m_et_miss_x
 The values of the x component of the missing ET.
 
double m_et_miss_y
 The values of the y component of the missing ET.
 
double m_et_miss_sum
 The values of the total scalar ET.
 
LeptonType m_lepton_type
 An index deciding if the event is electron (1) or muon (2) plus jets.
 
ResolutionBasem_res_energy_bhad
 Pointer to resolution function for hadronic b quark.
 
ResolutionBasem_res_energy_blep
 Pointer to resolution function for leptonic b quark.
 
ResolutionBasem_res_energy_lq1
 Pointer to resolution function for first light quark jet.
 
ResolutionBasem_res_energy_lq2
 Pointer to resolution function for second light quark jet.
 
ResolutionBasem_res_lepton
 Pointer to resolution function for the lepton.
 
ResolutionBasem_res_met
 Pointer to resolution function for MET.
 
Member attributes (measured parameters)
double m_bhad_meas_e
 
double m_bhad_meas_p
 
double m_bhad_meas_m
 
double m_bhad_meas_deteta
 
double m_bhad_meas_eta
 
double m_bhad_meas_phi
 
double m_bhad_meas_px
 
double m_bhad_meas_py
 
double m_bhad_meas_pz
 
double m_blep_meas_e
 
double m_blep_meas_p
 
double m_blep_meas_m
 
double m_blep_meas_deteta
 
double m_blep_meas_eta
 
double m_blep_meas_phi
 
double m_blep_meas_px
 
double m_blep_meas_py
 
double m_blep_meas_pz
 
double m_lq1_meas_e
 
double m_lq1_meas_p
 
double m_lq1_meas_m
 
double m_lq1_meas_deteta
 
double m_lq1_meas_eta
 
double m_lq1_meas_phi
 
double m_lq1_meas_px
 
double m_lq1_meas_py
 
double m_lq1_meas_pz
 
double m_lq2_meas_e
 
double m_lq2_meas_p
 
double m_lq2_meas_m
 
double m_lq2_meas_deteta
 
double m_lq2_meas_eta
 
double m_lq2_meas_phi
 
double m_lq2_meas_px
 
double m_lq2_meas_py
 
double m_lq2_meas_pz
 
double m_lep_meas_e
 
double m_lep_meas_deteta
 
double m_lep_meas_sintheta
 
double m_lep_meas_pt
 
double m_lep_meas_px
 
double m_lep_meas_py
 
double m_lep_meas_pz
 
Member attributes (fitted parameters)
double m_bhad_fit_e
 
double m_bhad_fit_px
 
double m_bhad_fit_py
 
double m_bhad_fit_pz
 
double m_blep_fit_e
 
double m_blep_fit_px
 
double m_blep_fit_py
 
double m_blep_fit_pz
 
double m_lq1_fit_e
 
double m_lq1_fit_px
 
double m_lq1_fit_py
 
double m_lq1_fit_pz
 
double m_lq2_fit_e
 
double m_lq2_fit_px
 
double m_lq2_fit_py
 
double m_lq2_fit_pz
 
double m_lep_fit_e
 
double m_lep_fit_px
 
double m_lep_fit_py
 
double m_lep_fit_pz
 
double m_nu_fit_e
 
double m_nu_fit_px
 
double m_nu_fit_py
 
double m_nu_fit_pz
 
double m_wlep_fit_e
 
double m_wlep_fit_px
 
double m_wlep_fit_py
 
double m_wlep_fit_pz
 
double m_whad_fit_e
 
double m_whad_fit_px
 
double m_whad_fit_py
 
double m_whad_fit_pz
 
double m_whad_fit_m
 
double m_wlep_fit_m
 
double m_thad_fit_m
 
double m_tlep_fit_m
 
- Protected Attributes inherited from KLFitter::LikelihoodBase
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 class implementing a likelihood for the ttbar lepton+jets channel.

This class represents a likelihood for the ttbar into lepton+jets.

Member Enumeration Documentation

Enumerator for the lepton type.

Enumerator
kElectron 

Leptons of type electron.

kMuon 

Leptons of type muon.

Enumerator for the fitted parameters of this likelihood.

Enumerator
parBhadE 

Energy of the hadronic b quark.

parBlepE 

Energy of the leptonic b quark.

parLQ1E 

Energy of the light quark 1.

parLQ2E 

Energy of the light quark 2.

parLepE 

Energy of the lepton.

parNuPx 

p_x of the neutrino

parNuPy 

p_y of the neutrino

parNuPz 

p_z of the neutrino

parTopM 

Mass of the top quark.

Constructor & Destructor Documentation

KLFitter::LikelihoodTopLeptonJets::LikelihoodTopLeptonJets ( )

The default constructor.

This initializes all member attributes and calls the functions DefineModelParticles() and DefineParameters().

Member Function Documentation

int KLFitter::LikelihoodTopLeptonJets::AdjustParameterRanges ( )
overrideprotectedvirtual

Adjust ranges of the parameters.

This either takes the parameter sigmas from the transfer functions, if m_flag_get_par_sigmas_from_TFs is set. Otherwise, a fixed sigma is used to calculate the parameter ranges. Then, SetParameterRange() is called to set the range. If m_flag_top_mass_fixed is set, the top mass will be fixed to the pole mass.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJets_JetAngles, and KLFitter::LikelihoodTopLeptonJets_Angular.

int KLFitter::LikelihoodTopLeptonJets::BuildModelParticles ( )
overrideprotectedvirtual

Build the model particles from the best fit parameters.

This sets the particles of fParticlesModel to the fitted parameter values. The W boson and top quark parameters are combined from the other particles.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

int KLFitter::LikelihoodTopLeptonJets::CalculateLorentzVectors ( std::vector< double > const &  parameters)
overrideprotectedvirtual

Update 4-vector values of the model particles.

This updates the internal variables, such as #m_bhad_fit_px or #m_thad_fit_m to the latest values from the fit. These variables are for example used in the log likelihood calculation.

Returns
An error flag.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJets_JetAngles.

std::vector< double > KLFitter::LikelihoodTopLeptonJets::CalculateNeutrinoPzSolutions ( TLorentzVector *  additionalParticle = nullptr)
protected

Calculates the neutrino pz solutions from the measured values and the W mass.

An additional particle to be added to the charged lepton may be specified, for example a photon in ttbargamma, which is radiated from the leptonic W or the charged lepton;

Parameters
additionalParticlePointer to a 4-vector of a particle which is added to the charged lepton in the calculation.
Returns
A vector with 0, 1 or 2 neutrino pz solutions.
int KLFitter::LikelihoodTopLeptonJets::DefineModelParticles ( )
overrideprotectedvirtual

Define the model particles.

Create the object fParticlesModel and add all particles of this likelihood. The 4-vector components are set to zero.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

void KLFitter::LikelihoodTopLeptonJets::DefineParameters ( )
overridevirtual

Define the parameters of the fit.

This calls BCModel::AddParameter() for all parameters in the enum Parameters.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep, and KLFitter::LikelihoodTopLeptonJets_JetAngles.

std::vector< double > KLFitter::LikelihoodTopLeptonJets::GetInitialParameters ( )
overridevirtual

Get initial values for the parameters.

This calls GetInitialParametersWoNeutrinoPz() and retrieves the neutrino solutions via GetNeutrinoPzSolutions(). The initial values are then set accordingly.

Returns
vector of initial values.

Implements KLFitter::LikelihoodBase.

std::vector< double > KLFitter::LikelihoodTopLeptonJets::GetInitialParametersWoNeutrinoPz ( )
virtual

Get initial values for the parameters with a dummy of "0.0" for the neutrino pz.

The decision on the initial value for the neutrino pz then needs to be done in GetInitialParameters().

Returns
vector of initial values.

Reimplemented in KLFitter::LikelihoodTopLeptonJets_JetAngles.

std::vector< double > KLFitter::LikelihoodTopLeptonJets::GetNeutrinoPzSolutions ( )
protected

Return the neutrino pz solutions from the measured values and the W mass.

This calls CalculateNeutrinoPzSolutions() and returns the results.

Returns
A vector with 0, 1 or 2 neutrino pz solutions.
double KLFitter::LikelihoodTopLeptonJets::LogLikelihood ( const std::vector< double > &  parameters)
overridevirtual

The posterior probability definition, overloaded from BCModel.

Parameters
parametersA vector of parameters (double values).
Returns
The logarithm of the prior probability.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJets_JetAngles, and KLFitter::LikelihoodTopLeptonJets_Angular.

std::vector< double > KLFitter::LikelihoodTopLeptonJets::LogLikelihoodComponents ( std::vector< double >  parameters)
overridevirtual

The posterior probability definition, overloaded from BCModel.

Instead of the final log likelihood value as in LogLikelihood(), this returns all subcomponents.

Parameters
parametersA vector of parameters (double values).
Returns
A vector with the components of the logarithm of the prior probability. Its components are:
0) TF_bhad
1) TF_blep
2) TF_lq1
3) TF_lq2
4) TF_lep
5) TF_METx
6) TF_METy
7) BW_Whad
8) BW_Wlep
9) BW_Thad
10) BW_Tlep

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJets_JetAngles.

int KLFitter::LikelihoodTopLeptonJets::RemoveInvariantParticlePermutations ( )
overrideprotectedvirtual

Remove the invariant particle permutations.

In particular, this removes permutations where the two light jets are swapped. In addition, in case two types of leptons were added, only permutations with leptons of type m_lepton_type are kept.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

Reimplemented in KLFitter::LikelihoodTopLeptonJetsUDSep.

int KLFitter::LikelihoodTopLeptonJets::SavePermutedParticles ( )
overrideprotectedvirtual

Save permuted particles.

This takes the permuted particles, stored in fParticlesPermuted, and saves their values in the internal variables, such as #m_bhad_meas_eta.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

int KLFitter::LikelihoodTopLeptonJets::SaveResolutionFunctions ( )
overrideprotectedvirtual

Save the resolution functions from the detector to the internal pointers.

This sets the internal pointers, such as m_res_energy_bhad to the resolution objects stored in the detector.

Returns
An error code.

Implements KLFitter::LikelihoodBase.

int KLFitter::LikelihoodTopLeptonJets::SetET_miss_XY_SumET ( double  etx,
double  ety,
double  sumet 
)
overridevirtual

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

This sets the internal variables m_et_miss_x, m_et_miss_y and m_et_miss_sum to the given values.

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

Implements KLFitter::LikelihoodBase.

void KLFitter::LikelihoodTopLeptonJets::SetFlagGetParSigmasFromTFs ( bool  flag)
inline

Set a flag.

If flag is true, take the parameter sigma values from the transfer functions.

Parameters
flagThe flag.
void KLFitter::LikelihoodTopLeptonJets::SetFlagTopMassFixed ( bool  flag)
inline

Set a flag.

If flag is true the invariant top quark mass is fixed to the pole mass.

Parameters
flagThe flag.
void KLFitter::LikelihoodTopLeptonJets::SetLeptonType ( LeptonType  leptontype)

Set the type of lepton.

Parameters
leptontypeThe type of lepton: kElectron or kMuon
void KLFitter::LikelihoodTopLeptonJets::SetLeptonType ( int  leptontype)

Set the type of lepton.

Parameters
leptontypeThe type of lepton: electron(1) or muon (2)

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