Commit a0735f89 authored by James Catmore's avatar James Catmore Committed by Atlas Nightlybuild
Browse files

Merge branch '21.2-addAnalysisTopAndProject' into '21.2'

21.2 add analysis top and project

See merge request !2226
parent b61d25c9
# Auto-generated on: 2017-03-09 17:44:32.719752
# Declare the name of this package:
atlas_subdir( KLFitter None )
# This package uses ROOT:
#find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathMore MathCore Graf Physics )
find_package( ROOT REQUIRED COMPONENTS Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread Minuit )
MESSAGE( STATUS "CMAKE_MODULE_PATH : " ${CMAKE_MODULE_PATH} )
find_package( BAT REQUIRED )
MESSAGE( STATUS "BAT_LIBRARIES used in KLFitter : " ${BAT_LIBRARIES} )
# Build a library that other components can link against:
atlas_add_library( KLFitter Root/*.cxx Root/*.h Root/*.icc
KLFitter/*.h KLFitter/*.icc KLFitter/*/*.h
KLFitter/*/*.icc
PUBLIC_HEADERS KLFitter
LINK_LIBRARIES ${ROOT_LIBRARIES}
${BAT_LIBRARIES}
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
${BAT_INCLUDE_DIRS})
# Install data files from the package:
atlas_install_data( data/* )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*!
* \class KLFitter::LikelihoodTopLeptonJets
* \brief A class implementing a likelihood for the ttbar lepton+jets channel.
* \author Kevin Kröninger
* \version 1.3
* \date 03.12.2009
*
* This class represents a likelihood for the ttbar into lepton+jets.
*/
// ---------------------------------------------------------
#ifndef BOOSTEDLIKELIHOODTOPLEPTONJETS
#define BOOSTEDLIKELIHOODTOPLEPTONJETS
// ---------------------------------------------------------
#include "LikelihoodBase.h"
#include "TLorentzVector.h"
#include "ResolutionBase.h"
#include <iostream>
// ---------------------------------------------------------
/*!
* \namespace KLFitter
* \brief The KLFitter namespace
*/
namespace KLFitter
{
class BoostedLikelihoodTopLeptonJets : public KLFitter::LikelihoodBase
{
public:
/** \name Constructors and destructors */
/* @{ */
/**
* The default constructor.
*/
BoostedLikelihoodTopLeptonJets();
/**
* The default destructor.
*/
virtual ~BoostedLikelihoodTopLeptonJets();
/* @} */
/** \name Member functions (Get) */
/* @{ */
/* @} */
/** \name Member functions (Set) */
/* @{ */
/**
* Enumerator for the lepton type.
*/
enum LeptonType { kElectron, kMuon };
/**
* Enumerator for the parameters.
*/
enum Parameters { parBhadE, parBlepE, parLQE, parLepE, parNuPx, parNuPy, parNuPz, parTopM };
/**
* Set the values for the missing ET x and y components and the SumET.
* @param etx missing ET x component.
* @param ety missing ET y component.
* @param sumet total scalar ET.
* @return An error flag.
*/
int SetET_miss_XY_SumET(double etx, double ety, double sumet);
/**
* Set a flag. If flag is true the invariant top quark mass is
* fixed to the pole mass.
* @param flag The flag.
*/
void SetFlagTopMassFixed(bool flag)
{ fFlagTopMassFixed = flag; };
void SetFlagUseJetMass(bool flag)
{ fFlagUseJetMass = flag; };
void SetFlagGetParSigmasFromTFs(bool flag)
{ fFlagGetParSigmasFromTFs = flag; };
/**
* Set the type of lepton
* @param leptontype The type of lepton: kElectron or kMuon
*/
void SetLeptonType(LeptonType leptontype);
/**
* Set the type of lepton
* @param leptontype The type of lepton: electron(1) or muon (2)
*/
void SetLeptonType(int leptontype);
/* @} */
/** \name Member functions (misc) */
/* @{ */
/* @} */
/** \name Member functions (BAT) */
/* @{ */
/**
* Define the parameters of the fit.
*/
virtual void DefineParameters();
/**
* The prior probability definition, overloaded from BCModel.
* @param parameters A vector of parameters (double values).
* @return The logarithm of the prior probability.
*/
virtual double LogAPrioriProbability(const std::vector <double> & /*parameters*/)
{ return 0; };
/**
* The posterior probability definition, overloaded from BCModel.
* @param parameters A vector of parameters (double values).
* @return The logarithm of the prior probability.
*/
virtual double LogLikelihood(const std::vector <double> & parameters);
/**
* The posterior probability definition, overloaded from BCModel. Split up into several subcomponents
* @param parameters A vector of parameters (double values).
* @return A vector with the components of the logarithm of the prior probability. Its components are:
* 0: TF_bhad
* 1: TF_blep
* 2: TF_lq
* 3: TF_lep
* 4: TF_METx
* 5: TF_METy
* 6: BW_Wlep
* 7: BW_Thad
* 8: BW_Tlep
*/
virtual std::vector<double> LogLikelihoodComponents(std::vector <double> parameters);
/**
* Get initial values for the parameters.
* @return vector of initial values.
*/
virtual std::vector<double> GetInitialParameters();
/**
* 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().
* @return vector of initial values.
*/
virtual std::vector<double> GetInitialParametersWoNeutrinoPz();
/**
* Check if there are TF problems.
* @return Return false if TF problem.
*/
virtual bool NoTFProblem(std::vector<double> parameters);
/**
* Return the set of model particles.
* @return A pointer to the particles.
*/
virtual KLFitter::Particles* ParticlesModel() {
BuildModelParticles();
return fParticlesModel;
};
virtual KLFitter::Particles** PParticlesModel() {
BuildModelParticles();
return &fParticlesModel;
};
/* @} */
protected:
/** \name Member functions (misc) */
/* @{ */
/**
* Update 4-vectors of model particles.
* @return An error flag.
*/
virtual int CalculateLorentzVectors(std::vector <double> const& parameters);
/**
* Initialize the likelihood for the event
*/
virtual int Initialize();
/**
* Adjust parameter ranges
*/
virtual int AdjustParameterRanges();
/**
* Define the model particles
* @return An error code.
*/
virtual int DefineModelParticles();
/**
* Remove invariant particle permutations.
* @return An error code.
*/
int RemoveInvariantParticlePermutations();
/**
* Remove forbidden particle permutations.
* @return An error code.
*/
int RemoveForbiddenParticlePermutations();
/**
* Build the model particles from the best fit parameters.
* @return An error code.
*/
int BuildModelParticles();
/* @} */
protected:
/**
* A flag for using a fixed top mass (true) or not (false).
*/
bool fFlagTopMassFixed;
/**
* A flag for using the measured jet masses (true) instead of
* parton masses (false);
*/
bool fFlagUseJetMass;
/**
* Flag for using ResolutionBase::GetSigma() to retrieve the parameter ranges
*/
bool fFlagGetParSigmasFromTFs;
/**
* Return the neutrino pz solutions from the measured values
* and the W mass.
* @return A vector with 0, 1 or 2 neutrino pz solutions.
*/
virtual std::vector<double> GetNeutrinoPzSolutions();
/**
* 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;
* @param Pointer to a 4-vector of a particle which is added to the charged lepton in the calculation
* @return A vector with 0, 1 or 2 neutrino pz solutions.
*/
std::vector<double> CalculateNeutrinoPzSolutions(TLorentzVector * additionalParticle = 0x0);
/**
* Save permuted particles.
*/
int SavePermutedParticles();
/**
* Save resolution functions.
*/
int SaveResolutionFunctions();
/**
* Set model parton mass according to fFlagUseJetMass.
* @param The jet mass.
* @param The quark mass.
* @param The parton px (will be modified, if necessary).
* @param The parton py (will be modified, if necessary).
* @param The parton pz (will be modified, if necessary).
* @param The parton energy (not modified).
* @return The parton mass.
*/
inline double SetPartonMass(double jetmass, double quarkmass, double &px, double &py, double &pz, double e) {
double mass(0.);
if (fFlagUseJetMass)
mass = jetmass > 0. ? jetmass : 0.;
else
mass = quarkmass;
double p_orig = sqrt(px*px + py*py + pz*pz);
double p_newmass = sqrt(e*e - mass*mass);
double scale = p_newmass / p_orig;
px *= scale;
py *= scale;
pz *= scale;
return mass;
}
/**
* The values of the x component of the missing ET.
*/
double ETmiss_x;
/**
* The values of the y component of the missing ET.
*/
double ETmiss_y;
/**
* The values of the total scalar ET.
*/
double SumET;
/**
* An index deciding if the event is electron (1) or muon (2) plus
* jets.
*/
LeptonType fTypeLepton;
/**
* Global variable for TF problems.
*/
bool fTFgood;
/**
* Save resolution functions since the eta of the partons is not fitted.
*/
ResolutionBase * fResEnergyBhad;
ResolutionBase * fResEnergyBlep;
ResolutionBase * fResEnergyLQ;
ResolutionBase * fResLepton;
ResolutionBase * fResMET;
/**
* Save measured particle values for frequent calls
*/
double bhad_meas_e;
double bhad_meas_p;
double bhad_meas_m;
double bhad_meas_deteta;
double bhad_meas_eta;
double bhad_meas_phi;
double bhad_meas_px;
double bhad_meas_py;
double bhad_meas_pz;
double blep_meas_e;
double blep_meas_p;
double blep_meas_m;
double blep_meas_deteta;
double blep_meas_eta;
double blep_meas_phi;
double blep_meas_px;
double blep_meas_py;
double blep_meas_pz;
double lq_meas_e;
double lq_meas_p;
double lq_meas_m;
double lq_meas_deteta;
double lq_meas_eta;
double lq_meas_phi;
double lq_meas_px;
double lq_meas_py;
double lq_meas_pz;
double lep_meas_e;
double lep_meas_deteta;
double lep_meas_sintheta;
double lep_meas_pt;
double lep_meas_px;
double lep_meas_py;
double lep_meas_pz;
/**
* Save fit particle values for frequent calls
*/
double bhad_fit_e;
double bhad_fit_px;
double bhad_fit_py;
double bhad_fit_pz;
double blep_fit_e;
double blep_fit_px;
double blep_fit_py;
double blep_fit_pz;
double lq_fit_e;
double lq_fit_px;
double lq_fit_py;
double lq_fit_pz;
double lep_fit_e;
double lep_fit_px;
double lep_fit_py;
double lep_fit_pz;
double nu_fit_e;
double nu_fit_px;
double nu_fit_py;
double nu_fit_pz;
double whad_fit_m;
double wlep_fit_m;
double thad_fit_m;
double tlep_fit_m;
};
} // namespace KLFitter
// ---------------------------------------------------------
#endif
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*!
* \class KLFitter::DetectorAtlas_7TeV
* \brief A class for describing of the ATLAS detector.
* \author Kevin Kr&ouml;ninger
* \version 1.3
* \date 03.12.2009
*
* This class holds the description of the ATLAS detector.
*/
// ---------------------------------------------------------
#ifndef DETECTORATLAS_7TEV
#define DETECTORATLAS_7TEV
// ---------------------------------------------------------
#include "DetectorBase.h"
#include <string>
// ---------------------------------------------------------
/*!
* \namespace KLFitter
* \brief The KLFitter namespace
*/
namespace KLFitter
{
class DetectorAtlas_7TeV : public DetectorBase
{
public:
/** \name Constructors and destructors */
/* @{ */
/**
* The default constructor.
* @param folder The folder with transfer function parameters.
*/
DetectorAtlas_7TeV(std::string folder = "");
/**
* The default destructor.
*/
virtual ~DetectorAtlas_7TeV();
/* @} */
/** \name Member functions (Get) */
/* @{ */
/**
* Return the energy resolution of light jets.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyLightJet(double eta = 0.);
/**
* Return the energy resolution of b jets.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyBJet(double eta = 0.);
/**
* Return the energy resolution of gluon jets.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyGluonJet(double eta = 0.);
/**
* Return the energy resolution of electrons.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyElectron(double eta = 0.);
/**
* Return the energy resolution of muons.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyMuon(double eta = 0.);
/**
* Return the energy resolution of photons.
* @param eta The eta of the particle.
* @return A pointer to the energy resolution object.
*/
KLFitter::ResolutionBase * ResEnergyPhoton(double eta = 0.);
/**
* Return the missing ET resolution.
* @return A pointer to the missing ET resolution.
*/
KLFitter::ResolutionBase * ResMissingET();
/**
* Return the eta resolution of light jets.
* @param eta The eta of the particle.
* @return A pointer to the eta resolution object.
*/
KLFitter::ResolutionBase * ResEtaLightJet(double eta = 0.);
/**
* Return the eta resolution of b jets.
* @param eta The eta of the particle.
* @return A pointer to the eta resolution object.
*/
KLFitter::ResolutionBase * ResEtaBJet(double eta = 0.);
/**
* Return the phi resolution of light jets.
* @param eta The phi of the particle.
* @return A pointer to the phi resolution object.
*/
KLFitter::ResolutionBase * ResPhiLightJet(double eta = 0.);
/**
* Return the phi resolution of b jets.
* @param eta The phi of the particle.
* @return A pointer to the phi resolution object.
*/
KLFitter::ResolutionBase * ResPhiBJet(double eta = 0.);
/* @} */
private:
/**
* The energy resolution of light jets for different eta regions.
*/
KLFitter::ResolutionBase * fResEnergyLightJet_eta1;
KLFitter::ResolutionBase * fResEnergyLightJet_eta2;
KLFitter::ResolutionBase * fResEnergyLightJet_eta3;
KLFitter::ResolutionBase * fResEnergyLightJet_eta4;
KLFitter::ResolutionBase * fResEnergyLightJet_eta5;
/**
* The energy resolution of b jets for different eta regions.
*/
KLFitter::ResolutionBase * fResEnergyBJet_eta1;
KLFitter::ResolutionBase * fResEnergyBJet_eta2;
KLFitter::ResolutionBase * fResEnergyBJet_eta3;
KLFitter::ResolutionBase * fResEnergyBJet_eta4;
KLFitter::ResolutionBase * fResEnergyBJet_eta5;