Commit 405eb29c authored by James David Shinner's avatar James David Shinner
Browse files

Add KLFitter support for additional likelihood function LikelihoodTopLeptonJets_Angular

parent 8fb5162f
......@@ -1216,7 +1216,7 @@ namespace top {
if (m_config->KLFitterOutput() == "FULL" || m_config->KLFitterOutput() == "JETPERM_ONLY") {
/// Model
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_Angular" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
systematicTree->makeOutputVariable(m_klfitter_model_bhad_pt, "klfitter_model_bhad_pt");
systematicTree->makeOutputVariable(m_klfitter_model_bhad_eta, "klfitter_model_bhad_eta");
systematicTree->makeOutputVariable(m_klfitter_model_bhad_phi, "klfitter_model_bhad_phi");
......@@ -1322,7 +1322,7 @@ namespace top {
}
if (m_config->KLFitterOutput() == "FULL" || m_config->KLFitterOutput() == "FITTEDTOPS_ONLY") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_Angular") {
systematicTree->makeOutputVariable(m_klfitter_bestPerm_topLep_pt, "klfitter_bestPerm_topLep_pt");
systematicTree->makeOutputVariable(m_klfitter_bestPerm_topLep_eta, "klfitter_bestPerm_topLep_eta");
systematicTree->makeOutputVariable(m_klfitter_bestPerm_topLep_phi, "klfitter_bestPerm_topLep_phi");
......@@ -3458,7 +3458,7 @@ namespace top {
m_klfitter_parameters.resize(nPermutations);
m_klfitter_parameterErrors.resize(nPermutations);
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_Angular" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
/// Model
m_klfitter_model_bhad_pt.resize(nPermutations);
m_klfitter_model_bhad_eta.resize(nPermutations);
......@@ -3587,7 +3587,7 @@ namespace top {
m_klfitter_parameterErrors[iPerm] = klPtr->parameterErrors();
/// Model
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_Angular" || m_config->KLFitterLH() == "ttbar_BoostedLJets") {
m_klfitter_model_bhad_pt[iPerm] = klPtr->model_bhad_pt();
m_klfitter_model_bhad_eta[iPerm] = klPtr->model_bhad_eta();
m_klfitter_model_bhad_phi[iPerm] = klPtr->model_bhad_phi();
......@@ -3692,7 +3692,7 @@ namespace top {
}
// now take the best permutation and build the tops and the ttbar system!
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles") {
if (m_config->KLFitterLH() == "ttbar" || m_config->KLFitterLH() == "ttZTrilepton" || m_config->KLFitterLH() == "ttH" || m_config->KLFitterLH() == "ttbar_JetAngles" || m_config->KLFitterLH() == "ttbar_Angular") {
if (nPermutations != 0) {
TLorentzVector bhad, blep, lq1, lq2, lep, nu, top_had, top_lep, ttbar;
......
......@@ -597,7 +597,7 @@ namespace top {
"kBtagPriorityFourJets");
registerParameter("KLFitterBTaggingMethod", "Recommend use kNotag or kVetoNoFit - see KLFitter TWiki", "kNotag");
registerParameter("KLFitterLH",
"Select likelihood depending on signal, ttbar, ttbar_angles, ttH, ttZTrilepton, ttbar_AllHadronic, ttbar_BoostedLJets",
"Select likelihood depending on signal, ttbar, ttbar_JetAngles, ttbar_Angular, ttH, ttZTrilepton, ttbar_AllHadronic, ttbar_BoostedLJets",
"ttbar");
registerParameter("KLFitterTopMassFixed", "Fix the mass of the top quark? True or False", "True");
registerParameter("KLFitterSaveAllPermutations",
......
......@@ -79,6 +79,10 @@ namespace top {
// according to your needs
m_myLikelihood_JetAngles = std::make_unique<KLFitter::LikelihoodTopLeptonJets_JetAngles>();
// 4) create an instance of the likelihood for ttbar->l+jets channel using angular W-helicity info and
// customize it according to your needs
m_myLikelihood_Angular = std::make_unique<KLFitter::LikelihoodTopLeptonJets_Angular>();
// 4) create an instance of the likelihood for ttZ -> trilepton channel and customize it according to your needs
m_myLikelihood_TTZ = std::make_unique<KLFitter::LikelihoodTTZTrilepton>();
......@@ -94,12 +98,14 @@ namespace top {
m_leptonTypeKLFitterEnum = KLFitter::LikelihoodTopLeptonJets::LeptonType::kElectron;
m_leptonTypeKLFitterEnum_TTH = KLFitter::LikelihoodTTHLeptonJets::LeptonType::kElectron;
m_leptonTypeKLFitterEnum_JetAngles = KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kElectron;
m_leptonTypeKLFitterEnum_Angular = KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kElectron;
m_leptonTypeKLFitterEnum_TTZ = KLFitter::LikelihoodTTZTrilepton::LeptonType::kElectron;
m_leptonTypeKLFitterEnum_BoostedLJets = KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType::kElectron;
} else if (m_leptonType == "kMuon") {
m_leptonTypeKLFitterEnum = KLFitter::LikelihoodTopLeptonJets::LeptonType::kMuon;
m_leptonTypeKLFitterEnum_TTH = KLFitter::LikelihoodTTHLeptonJets::LeptonType::kMuon;
m_leptonTypeKLFitterEnum_JetAngles = KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kMuon;
m_leptonTypeKLFitterEnum_Angular = KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kMuon;
m_leptonTypeKLFitterEnum_TTZ = KLFitter::LikelihoodTTZTrilepton::LeptonType::kMuon;
m_leptonTypeKLFitterEnum_BoostedLJets = KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType::kMuon;
} else if (m_leptonType == "kTriElectron") {
......@@ -130,6 +136,7 @@ namespace top {
m_myLikelihood->SetLeptonType(m_leptonTypeKLFitterEnum);
m_myLikelihood_TTH->SetLeptonType(m_leptonTypeKLFitterEnum_TTH);
m_myLikelihood_JetAngles->SetLeptonType(m_leptonTypeKLFitterEnum_JetAngles);
m_myLikelihood_Angular->SetLeptonType(m_leptonTypeKLFitterEnum_Angular);
m_myLikelihood_TTZ->SetLeptonType(m_leptonTypeKLFitterEnum_TTZ);
m_myLikelihood_BoostedLJets->SetLeptonType(m_leptonTypeKLFitterEnum_BoostedLJets);
}
......@@ -218,6 +225,7 @@ namespace top {
m_myLikelihood->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_TTH->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_JetAngles->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_Angular->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_TTZ->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_AllHadronic->SetBTagging(m_bTaggingMethodKLFitterEnum);
m_myLikelihood_BoostedLJets->SetBTagging(m_bTaggingMethodKLFitterEnum);
......@@ -225,6 +233,7 @@ namespace top {
m_myLikelihood->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_TTH->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_JetAngles->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_Angular->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_TTZ->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_AllHadronic->PhysicsConstants()->SetMassTop(m_massTop);
m_myLikelihood_BoostedLJets->PhysicsConstants()->SetMassTop(m_massTop);
......@@ -242,6 +251,7 @@ namespace top {
m_myLikelihood->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_TTH->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_JetAngles->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_Angular->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_TTZ->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_AllHadronic->SetFlagTopMassFixed(FixTopMass);
m_myLikelihood_BoostedLJets->SetFlagTopMassFixed(FixTopMass);
......@@ -256,7 +266,9 @@ namespace top {
else if (m_LHType == "ttbar_JetAngles") top::check(m_myFitter->SetLikelihood(
m_myLikelihood_JetAngles.get()),
"KLFitterTool::initialize() ERROR setting likelihood for KLFitter");
else if (m_LHType == "ttbar_Angular") top::check(m_myFitter->SetLikelihood(
m_myLikelihood_Angular.get()),
"KLFitterTool::initialize() ERROR setting likelihood for KLFitter");
else if (m_LHType == "ttZTrilepton" && (m_leptonType == "kTriElectron" || m_leptonType == "kTriMuon")) {
// For ttZ->trilepton, we can have difficult combinations of leptons in the
// final state (3x same flavour, or mixed case). The latter is trivial, for
......@@ -412,7 +424,20 @@ namespace top {
myParticles->AddParticle(&mu, mu.Eta(), KLFitter::Particles::kMuon);
}
}
if (m_LHType == "ttbar_Angular") {
if (m_leptonTypeKLFitterEnum_Angular == KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kElectron) {
TLorentzVector el;
el.SetPtEtaPhiE(event.m_electrons.at(0)->pt() / 1.e3, event.m_electrons.at(0)->eta(), event.m_electrons.at(
0)->phi(), event.m_electrons.at(0)->e() / 1.e3);
myParticles->AddParticle(&el, event.m_electrons.at(0)->caloCluster()->etaBE(2), KLFitter::Particles::kElectron);
}
if (m_leptonTypeKLFitterEnum_Angular == KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kMuon) {
TLorentzVector mu;
mu.SetPtEtaPhiE(event.m_muons.at(0)->pt() / 1.e3, event.m_muons.at(0)->eta(), event.m_muons.at(
0)->phi(), event.m_muons.at(0)->e() / 1.e3);
myParticles->AddParticle(&mu, mu.Eta(), KLFitter::Particles::kMuon);
}
}
if (m_LHType == "ttZTrilepton") {
if (m_leptonTypeKLFitterEnum_TTZ == KLFitter::LikelihoodTTZTrilepton::LeptonType::kElectron) {
if (m_leptonType == "kTriElectron") {
......@@ -554,8 +579,8 @@ namespace top {
KLFitter::Particles** myPermutedParticles = m_myFitter->Likelihood()->PParticlesPermuted();
if (m_LHType == "ttbar" || m_LHType == "ttH" || m_LHType == "ttbar_JetAngles" || m_LHType == "ttZTrilepton" ||
m_LHType == "ttbar_BoostedLJets") {
if (m_LHType == "ttbar" || m_LHType == "ttH" || m_LHType == "ttbar_JetAngles" || m_LHType == "ttbar_Angular" ||
m_LHType == "ttZTrilepton" || m_LHType == "ttbar_BoostedLJets") {
result->setModel_bhad_pt(myModelParticles->Parton(0)->Pt());
result->setModel_bhad_eta(myModelParticles->Parton(0)->Eta());
result->setModel_bhad_phi(myModelParticles->Parton(0)->Phi());
......@@ -601,7 +626,8 @@ namespace top {
m_leptonTypeKLFitterEnum_TTH == KLFitter::LikelihoodTTHLeptonJets::LeptonType::kElectron ||
m_leptonTypeKLFitterEnum_TTZ == KLFitter::LikelihoodTTZTrilepton::LeptonType::kElectron ||
m_leptonTypeKLFitterEnum_BoostedLJets == KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType::kElectron ||
m_leptonTypeKLFitterEnum_JetAngles == KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kElectron) {
m_leptonTypeKLFitterEnum_JetAngles == KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kElectron ||
m_leptonTypeKLFitterEnum_Angular == KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kElectron) {
result->setModel_lep_pt(myModelParticles->Electron(0)->Pt());
result->setModel_lep_eta(myModelParticles->Electron(0)->Eta());
result->setModel_lep_phi(myModelParticles->Electron(0)->Phi());
......@@ -628,7 +654,8 @@ namespace top {
m_leptonTypeKLFitterEnum_TTH == KLFitter::LikelihoodTTHLeptonJets::LeptonType::kMuon ||
m_leptonTypeKLFitterEnum_TTZ == KLFitter::LikelihoodTTZTrilepton::LeptonType::kMuon ||
m_leptonTypeKLFitterEnum_BoostedLJets == KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType::kMuon ||
m_leptonTypeKLFitterEnum_JetAngles == KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kMuon) {
m_leptonTypeKLFitterEnum_JetAngles == KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType::kMuon ||
m_leptonTypeKLFitterEnum_Angular == KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType::kMuon) {
result->setModel_lep_pt(myModelParticles->Muon(0)->Pt());
result->setModel_lep_eta(myModelParticles->Muon(0)->Eta());
result->setModel_lep_phi(myModelParticles->Muon(0)->Phi());
......
......@@ -19,6 +19,7 @@
#include "KLFitter/LikelihoodTopLeptonJets.h"
#include "KLFitter/LikelihoodTTHLeptonJets.h"
#include "KLFitter/LikelihoodTopLeptonJets_JetAngles.h"
#include "KLFitter/LikelihoodTopLeptonJets_Angular.h"
#include "KLFitter/LikelihoodTTZTrilepton.h"
#include "KLFitter/LikelihoodTopAllHadronic.h"
#include "KLFitter/BoostedLikelihoodTopLeptonJets.h"
......@@ -122,12 +123,14 @@ namespace top {
KLFitter::LikelihoodTopLeptonJets::LeptonType m_leptonTypeKLFitterEnum;
KLFitter::LikelihoodTTHLeptonJets::LeptonType m_leptonTypeKLFitterEnum_TTH;
KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType m_leptonTypeKLFitterEnum_JetAngles;
KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType m_leptonTypeKLFitterEnum_Angular;
KLFitter::LikelihoodTTZTrilepton::LeptonType m_leptonTypeKLFitterEnum_TTZ;
KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType m_leptonTypeKLFitterEnum_BoostedLJets;
std::unique_ptr<KLFitter::LikelihoodTopLeptonJets> m_myLikelihood;
std::unique_ptr<KLFitter::LikelihoodTTHLeptonJets> m_myLikelihood_TTH;
std::unique_ptr<KLFitter::LikelihoodTopLeptonJets_JetAngles> m_myLikelihood_JetAngles;
std::unique_ptr<KLFitter::LikelihoodTopLeptonJets_Angular> m_myLikelihood_Angular;
std::unique_ptr<KLFitter::LikelihoodTTZTrilepton> m_myLikelihood_TTZ;
std::unique_ptr<KLFitter::LikelihoodTopAllHadronic> m_myLikelihood_AllHadronic;
std::unique_ptr<KLFitter::BoostedLikelihoodTopLeptonJets> m_myLikelihood_BoostedLJets;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment